Skip to content

Commit

Permalink
add the remaining files
Browse files Browse the repository at this point in the history
  • Loading branch information
horam-deriv committed Nov 17, 2023
1 parent 83c2c97 commit 97d1c02
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
10 changes: 7 additions & 3 deletions src/generators/tailwind/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
stringValueTransformer,
tailwindTransforms,
tokenPathTransformer,
mobileColorTransformer,
} from '../../transformers/tailwind.transformers';
import { makeFontStylesAction, makeStylesAction } from '../../actions/tailwind.actions';
import { desktopTargetFormatter } from '../../formatters/desktop-target.formatter';
Expand All @@ -30,6 +31,7 @@ StyleDictionary.registerAction(makeFontStylesAction);
StyleDictionary.registerFormat(desktopTargetFormatter);
StyleDictionary.registerTransform(stringValueTransformer);
StyleDictionary.registerFormat(TokenNamesFormatter);
StyleDictionary.registerTransform(mobileColorTransformer);

export const CoreSdConfig = StyleDictionary.extend({
source: [RAW_CORE_SOURCE_FOLDER],
Expand Down Expand Up @@ -100,7 +102,8 @@ export const SemanticLightMobileConfig = StyleDictionary.extend({
source: [RAW_CORE_SOURCE_FOLDER, `${RAW_TOKENS_BASE_FOLDER}/semantic/theme/light.json`],
platforms: {
semantic_mobile_flutter_light: {
transforms: [...TokenStudioTransforms, 'deriv/mobile-color', 'color/hex8flutter'],
// Todo(Horam): remove the commented code before merging the PR.
transforms:['color/hex8flutter'], //[...TokenStudioTransforms,], // 'deriv/mobile-color', 'color/hex8flutter'
buildPath: QUILL_TAILWIND_BUILD_PATH,
files: [
{
Expand All @@ -121,13 +124,14 @@ export const SemanticDarkMobileConfig = StyleDictionary.extend({
source: [RAW_CORE_SOURCE_FOLDER, `${RAW_TOKENS_BASE_FOLDER}/semantic/theme/dark.json`],
platforms: {
semantic_mobile_flutter_dark: {
transforms: [...TokenStudioTransforms, 'deriv/mobile-color', 'color/hex8flutter'],
// Todo(Horam): remove the commented code before merging the PR.
transforms: ['deriv/mobile-color'],//[...TokenStudioTransforms, ], // 'deriv/mobile-color', 'color/hex8flutter'
buildPath: QUILL_TAILWIND_BUILD_PATH,
files: [
{
destination: 'mobile_dark_colors.dart',
format: 'flutter/class.dart',
filter: (token) => token.path.includes('semantic'),
filter: (token) => token.path.includes('semantic'),
options: {
outputReferences: false,
showFileHeader: false,
Expand Down
13 changes: 8 additions & 5 deletions src/transformers/tailwind.transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ export const spacingNameTransformer: Named<Transform> = {
transformer: (token) => token.path.join('-'),
};

export const mobileColorTransforner: Named<Transform> = {
export const mobileColorTransformer: Named<Transform> = {
name: 'deriv/mobile-color',
type: 'value',
matcher:(token)=>token.type === 'color',
transformer: (token)=> token.value,

matcher:(token)=> token.type === 'color',
transformer: (token)=>{
// Todo (Horam): remove commented codes.
// console.log(token.name);
// console.log(token.path);
return token.value;
},
};

export const tokenPathTransformer: Named<Transform> = {
Expand Down Expand Up @@ -96,7 +100,6 @@ export const tailwindTransforms = [
'deriv/spacing-name',
'deriv/token-path',
'deriv/tw/string-value',
'deriv/mobile-color',
];

export const tailwindTransferGroup: Named<TransformGroup> = {
Expand Down

0 comments on commit 97d1c02

Please sign in to comment.