-
Notifications
You must be signed in to change notification settings - Fork 8
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
1 parent
ee7de16
commit c92732a
Showing
7 changed files
with
153 additions
and
23 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
32 changes: 32 additions & 0 deletions
32
ui/design-tokens/src/Colors/SeekColor/SeekColor.stories.tsx
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import { ControlTypes } from '@component-controls/core'; | ||
import { SeekColor, SeekColorPalette } from './SeekColor'; | ||
import { ColorProps } from '../../types'; | ||
|
||
export default { | ||
title: 'Design Tokens/Colors/SeekColor', | ||
component: SeekColor, | ||
}; | ||
|
||
export const overview = ({ name, color }: ColorProps) => ( | ||
<SeekColor name={name} color={color} /> | ||
); | ||
|
||
overview.controls = { | ||
name: '@sk-blue-darker', | ||
color: { type: ControlTypes.COLOR, value: '#071d40' }, | ||
}; | ||
|
||
export const palette = () => ( | ||
<SeekColorPalette | ||
palette={{ | ||
'@sk-blue-darker': '#001b38', | ||
'@sk-blue-dark': '#042763', | ||
'@sk-blue': '#0d3880', | ||
'@sk-blue-light': '#184da8', | ||
'@sk-blue-lighter': '#2765cf', | ||
'@sk-pink': '#e60278', | ||
'@sk-green': '#157e00', | ||
}} | ||
/> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** @jsx jsx */ | ||
import { FC } from 'react'; | ||
import { jsx } from 'theme-ui'; | ||
import { CopyContainer } from '@component-controls/components'; | ||
import { colorToStr } from '../utils'; | ||
import { ColorBlockProps, ColorValue } from '../../types'; | ||
import { GridContainerProps, GridContainer } from '../../components'; | ||
|
||
/** | ||
* Color item displaying the color as a cirlce with the hev value and variable name below. | ||
* Design inspired from [Seek OSS](https://seek-oss.github.io/seek-style-guide/palette). | ||
*/ | ||
export const SeekColor: FC<ColorBlockProps> = ({ name, color }) => { | ||
const colorObj: ColorValue = | ||
typeof color === 'string' ? { value: color } : color; | ||
const { value: colorValue, name: colorName = name } = colorObj; | ||
|
||
const { hex } = colorToStr(colorValue); | ||
return ( | ||
<div | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
maxWidth: 320, | ||
}} | ||
> | ||
<CopyContainer value={hex} name={name} sx={{ px: 2, pt: 2 }}> | ||
<div | ||
sx={{ | ||
width: 100, | ||
height: 100, | ||
bg: colorValue, | ||
borderRadius: '50%', | ||
}} | ||
/> | ||
</CopyContainer> | ||
|
||
<div sx={{ fontSize: 2 }}> | ||
<div sx={{ pt: 1, textAlign: 'center', color: 'mutedText' }}>{hex}</div> | ||
<div sx={{ textAlign: 'center' }}>{colorName}</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
/** | ||
* | ||
* palette displayed with SeekColor items | ||
* using a css grid for the dsplay | ||
*/ | ||
export const SeekColorPalette: FC<Omit< | ||
GridContainerProps, | ||
'children' | ||
>> = props => ( | ||
<GridContainer width={150} gap={2} {...props}> | ||
{({ name, value }) => ( | ||
<SeekColor key={`color_item_${name}}`} name={name} color={value} /> | ||
)} | ||
</GridContainer> | ||
); |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './SeekColor'; |
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