Skip to content

Commit

Permalink
feat: generate grid gap types
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Sammy authored and muhammadsammy committed Jun 24, 2020
1 parent 9a173a7 commit cb70a1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/generation/ClassesGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ export class ClassesGenerator implements IClassesGenerator {
gridRow: Object.keys(this.configScanner.themeConfig.gridRow).map(value => `row-${value}`),
gridRowStart: Object.keys(this.configScanner.themeConfig.gridRowStart).map(value => `row-start-${value}`),
gridRowEnd: Object.keys(this.configScanner.themeConfig.gridRowEnd).map(value => `row-end-${value}`),
gridGap: ['gap-', 'row-gap-', 'col-gap-'].flatMap(x => {
return Object.keys(
// NOTE: grid gap inherits its values from theme.spacing by default, but theme.gap overrides it.
isEmpty(this.configScanner.themeConfig.gap)
? this.configScanner.themeConfig.spacing
: (this.configScanner.themeConfig.gap as { [key: string]: string }),
).map(gapValue => x + gapValue);
}),
};

this.allGeneratedClasses.Grid = Grid;
Expand Down
2 changes: 1 addition & 1 deletion src/generation/_definitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ interface IThemeProps {
colors?: {
[key: string]: string | { [key: string]: string };
};
spacing?: {
spacing: {
[key: string]: string;
};
backgroundPosition: {
Expand Down

0 comments on commit cb70a1a

Please sign in to comment.