Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
247 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import type * as CSS from 'csstype' | ||
import type { CSSObject } from 'styled-components' | ||
|
||
import type { Props, ThemeProp, ThemeValues } from '../types' | ||
import { get } from '../utils' | ||
import type { Config, Props, ThemeProp, ThemeValues } from '../types' | ||
import { getStyles } from '../utils' | ||
|
||
export type ColorProps = Props<{ | ||
color: ThemeValues<'colors'> | CSS.Property.Color | ||
backgroundColor: ThemeValues<'colors'> | CSS.Property.BackgroundColor | ||
opacity: CSS.Property.Opacity | ||
}> | ||
|
||
export const color = (props: ColorProps & ThemeProp): CSSObject => { | ||
return { | ||
color: get(props.color, props.theme, 'colors'), | ||
backgroundColor: get(props.backgroundColor, props.theme, 'colors'), | ||
opacity: props.opacity, | ||
} | ||
const config: Config[] = [ | ||
{ property: 'color', scope: 'colors' }, | ||
{ property: 'backgroundColor', scope: 'colors' }, | ||
{ property: 'opacity' }, | ||
] | ||
|
||
export const color = (props: ColorProps & ThemeProp) => { | ||
return getStyles(config, props) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.