Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Sep 22, 2023
1 parent 53f626e commit 2b0a634
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CssVarsType } from '../utils/CssVarsType';
import { GenerateCssVarsType } from '../utils/CssVarsType';

const circularProgressCssVars = {
thickness: '--CircularProgress-thickness',
Expand All @@ -13,7 +13,7 @@ const circularProgressCssVars = {
circulation: '--CircularProgress-circulation',
} as const;

export type CircularProgressCssVarsType = CssVarsType<
export type CircularProgressCssVarsType = GenerateCssVarsType<
keyof typeof circularProgressCssVars,
'CircularProgress'
>;
Expand Down
4 changes: 3 additions & 1 deletion packages/mui-joy/src/styles/types/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export interface Theme extends ThemeScales, RuntimeColorSystem {
unstable_sx: (props: SxProps) => CSSObject;
}

export type SxProps = SystemSxProps<Theme> & CircularProgressCssVarsType;
type CssVarsType = CircularProgressCssVarsType;

export type SxProps = SystemSxProps<Theme> & CssVarsType;

export type SystemProps = SystemSystemProps<Theme>;
6 changes: 3 additions & 3 deletions packages/mui-joy/src/utils/CssVarsType.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* A type which generates CSS Variables.
* @example
* type ButtonCssVars = CssVarsType<'color' | 'size', 'Button'>;
* ButtonCssVars = {
* type ButtonCssVars = GenerateCssVarsType<'color' | 'size', 'Button'>;
* ButtonCssVars wouldb be {
* '--Button-color'?: string | number;
* '--Button-size'?: string | number;
* }
*/
export type CssVarsType<Keys extends string, Component extends string> = Partial<
export type GenerateCssVarsType<Keys extends string, Component extends string> = Partial<
Record<`--${Component}-${Keys}`, string | number>
>;

0 comments on commit 2b0a634

Please sign in to comment.