Skip to content

Commit

Permalink
fix(fix-typography-extend): [DefaultTheme] fix typography type extension
Browse files Browse the repository at this point in the history
  • Loading branch information
233mawile authored and 233mawile-rc committed Jun 26, 2023
1 parent 33a3f57 commit 68680ba
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions packages/juno-core/src/foundation/theme/DefaultTheme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/** that theme provide user to custom with */
export interface DefaultTheme {}
1 change: 1 addition & 0 deletions packages/juno-core/src/foundation/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from './paletteProp.type';
export * from './theme.type';
export * from './typography.type';
export * from './useThemeProps';
export * from './DefaultTheme';
4 changes: 1 addition & 3 deletions packages/juno-core/src/foundation/theme/theme.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,7 @@ import radius from './assets/radius.json';
import shape from './assets/shape.json';
import zIndex from './assets/zIndex.json';
import { RcTypographyType } from './typography.type';

/** that theme provide user to custom with */
export interface DefaultTheme {}
import { DefaultTheme } from './DefaultTheme';

/** inner for make `(DefaultTheme & ForExtendTheme)['palette']` work with ts */
type ForExtendTheme = { palette: {} };
Expand Down
22 changes: 13 additions & 9 deletions packages/juno-core/src/foundation/theme/typography.type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Theme as MuiTheme } from '@material-ui/core/styles';

import typography from './assets/typography.json';
import { DefaultTheme } from './DefaultTheme';

type RcTypographyPickFields =
| 'fontFamily'
Expand All @@ -27,22 +28,25 @@ export type RcTypographyKeys =
| 'body1'
| 'caption2'
| 'caption1'
| 'inherit';
| 'inherit'
| keyof ExtensionTypography;

export type RcTypographyAddition = Pick<
typeof typography,
RcTypographyPickFields
>;

export type RcTypographies = Record<
RcTypographyKeys,
{
fontSize: string | number;
fontWeight: number | number;
lineHeight: string | number;
}
>;
export type RcTypographyDetail = {
fontSize: string | number;
fontWeight: number;
lineHeight: string | number;
};

export type RcTypographies = Record<RcTypographyKeys, RcTypographyDetail>;

type ExtensionTypography = (DefaultTheme & { typography: {} })['typography'];

export type RcTypographyType = RcTypographyAddition &
ExtensionTypography &
RcTypographies &
MuiTheme['typography'];
2 changes: 1 addition & 1 deletion sync-github.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"latestCommitSHA": "58bdb5c97105f25bda64d9af3a92c58cc5f29b86"
"latestCommitSHA": "b5e53517b7e548cf7e84f72da4189ab459ab9ca2"
}

0 comments on commit 68680ba

Please sign in to comment.