Skip to content

Commit

Permalink
fix: fix bg type & add background property
Browse files Browse the repository at this point in the history
  • Loading branch information
wwsun committed Apr 11, 2022
1 parent 45d21fb commit 011f7b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/core/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ const config: StylePropConfig = {
property: 'backgroundColor',
scale: 'colors',
},
background: {
property: 'background',
scale: 'colors',
},
opacity: true,
};

config.bg = config.backgroundColor;
config.bg = config.background;

export const color = system(config);
17 changes: 10 additions & 7 deletions src/types/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export interface SpaceProps {

export interface ColorProps {
color?: CSS.Property.Color;
bg?: CSS.Property.Color;
bg?: CSS.Property.Background;
background?: CSS.Property.Background;
backgroundColor?: CSS.Property.Color;
opacity?: CSS.Property.Opacity;
}
Expand Down Expand Up @@ -199,11 +200,8 @@ export type OmitCommonProps<Target, OmitAdditionalProps extends keyof any = neve
'transition' | 'as' | 'color' | OmitAdditionalProps
>;

export type RightJoinProps<SourceProps extends object = {}, OverrideProps extends object = {}> = OmitCommonProps<
SourceProps,
keyof OverrideProps
> &
OverrideProps;
export type RightJoinProps<SourceProps extends object = {}, OverrideProps extends object = {}> =
OmitCommonProps<SourceProps, keyof OverrideProps> & OverrideProps;

export type MergeWithAs<
ComponentProps extends object,
Expand All @@ -226,7 +224,12 @@ export type PropsOf<T extends As> = React.ComponentPropsWithoutRef<T> & {

export type ComponentWithAs<Component extends As, Props extends object = {}> = {
<AsComponent extends As>(
props: MergeWithAs<React.ComponentProps<Component>, React.ComponentProps<AsComponent>, Props, AsComponent>,
props: MergeWithAs<
React.ComponentProps<Component>,
React.ComponentProps<AsComponent>,
Props,
AsComponent
>,
): JSX.Element;

displayName?: string;
Expand Down

0 comments on commit 011f7b3

Please sign in to comment.