Skip to content

Commit

Permalink
feat: add seek oss color token
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Sep 30, 2020
1 parent ee7de16 commit c92732a
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 23 deletions.
65 changes: 50 additions & 15 deletions examples/stories/src/tutorial/design/tokens/colors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
PhotonColorPalette,
PrimerColorPalette,
SeedsColorPalette,
SeekColorPalette,
} from '@component-controls/design-tokens';

# Overview
Expand Down Expand Up @@ -331,26 +332,26 @@ import { BeelineColorPalette } from '@component-controls/design-tokens';
<BeelineColorPalette
palette={{
'Blue 5': { value: '#001b38' },
'Blue Accessibility': { value: '#0352a0' },
'Blue Primary': { value: '#0575e6' },
'Blue 1': { value: '#4fa7ff' },
'Blue 2': { value: '#85dfff' },
'Blue 3': { value: '#ecf5ff' },
'Blue 4': { value: '#FBFDFF' },
'Blue 5': '#001b38',
'Blue Accessibility': '#0352a0',
'Blue Primary': '#0575e6',
'Blue 1': '#4fa7ff',
'Blue 2': '#85dfff',
'Blue 3': '#ecf5ff',
'Blue 4': '#FBFDFF',
}}
/>
```

<BeelineColorPalette
palette={{
'Blue 5': { value: '#001b38' },
'Blue Accessibility': { value: '#0352a0' },
'Blue Primary': { value: '#0575e6' },
'Blue 1': { value: '#4fa7ff' },
'Blue 2': { value: '#85dfff' },
'Blue 3': { value: '#ecf5ff' },
'Blue 4': { value: '#FBFDFF' },
'Blue 5': '#001b38',
'Blue Accessibility': '#0352a0',
'Blue Primary': '#0575e6',
'Blue 1': '#4fa7ff',
'Blue 2': '#85dfff',
'Blue 3': '#ecf5ff',
'Blue 4': '#FBFDFF',
}}
/>

Expand Down Expand Up @@ -1501,7 +1502,7 @@ import { PrimerColorPalette } from '@component-controls/design-tokens';

## SeedsColor

The [SeedsColor](/api/design-tokens-colors-seedscolor--overview) component displays the color as a block wuth rgb and cmyk colors. Below the block are displayed the color name and description.
The [SeedsColor](/api/design-tokens-colors-seedscolor--overview) component displays the color as a block with rgb and cmyk colors. Below the block are displayed the color name and description.

Design inspired from SproutSocial's [Seed](https://seeds.sproutsocial.com/visual/color/).

Expand Down Expand Up @@ -1573,4 +1574,38 @@ import { SeedsColorPalette } from '@component-controls/design-tokens';
variants: ['cta.scondary', 'neutral.800'],
},
}}
/>

## SeekColor

The [SeekColor](/api/design-tokens-colors-seekcolor--overview) component displays 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).

```
import { SeekColorPalette } from '@component-controls/design-tokens';
<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',
}}
/>
```

<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',
}}
/>
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export const hsla = () => (
export const palette = () => (
<BeelineColorPalette
palette={{
'Blue 5': { value: '#001b38' },
'Blue Accessibility': { value: '#0352a0' },
'Blue Primary': { value: '#0575e6' },
'Blue 1': { value: '#4fa7ff' },
'Blue 2': { value: '#85dfff' },
'Blue 3': { value: '#ecf5ff' },
'Blue 4': { value: '#FBFDFF' },
'Blue 5': '#001b38',
'Blue Accessibility': '#0352a0',
'Blue Primary': '#0575e6',
'Blue 1': '#4fa7ff',
'Blue 2': '#85dfff',
'Blue 3': '#ecf5ff',
'Blue 4': '#FBFDFF',
}}
/>
);
2 changes: 1 addition & 1 deletion ui/design-tokens/src/Colors/SeedsColor/SeedsColor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ColorBlockProps, ColorValue } from '../../types';
import { GridContainerProps, GridContainer } from '../../components';

/**
* Color item displaying the color as a block wuth rgb and cmyk colors. Below the block are displayed the color name and description.
* Color item displaying the color as a block with rgb and cmyk colors. Below the block are displayed the color name and description.
* Design inspired from SproutSocial's [Seed](https://seeds.sproutsocial.com/visual/color/).
*/
export const SeedsColor: FC<ColorBlockProps> = ({ name, color }) => {
Expand Down
32 changes: 32 additions & 0 deletions ui/design-tokens/src/Colors/SeekColor/SeekColor.stories.tsx
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',
}}
/>
);
61 changes: 61 additions & 0 deletions ui/design-tokens/src/Colors/SeekColor/SeekColor.tsx
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>
);
1 change: 1 addition & 0 deletions ui/design-tokens/src/Colors/SeekColor/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './SeekColor';
1 change: 1 addition & 0 deletions ui/design-tokens/src/Colors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ export * from './PatternFlyColor';
export * from './PhotonColor';
export * from './PrimerColor';
export * from './SeedsColor';
export * from './SeekColor';

0 comments on commit c92732a

Please sign in to comment.