Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: backport Shin Color to v6 (SHRUI-232) #1157

Merged
merged 3 commits into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import { withA11y } from '@storybook/addon-a11y'
import { addReadme } from 'storybook-readme'

import { createTheme } from '../src/themes/createTheme'
import { shinColorPalette } from '../src/themes/createPalette'
import { ThemeProvider } from '../src/themes/ThemeProvider'

const req = require.context('../src/components', true, /.stories.tsx$/)

function loadStories() {
req.keys().forEach(filename => req(filename))
req.keys().forEach((filename) => req(filename))
}

addParameters({
Expand All @@ -29,7 +30,10 @@ addParameters({ viewport: { viewports: INITIAL_VIEWPORTS } })

addDecorator(withA11y)
addDecorator(addReadme)
addDecorator(Story => <ThemeProvider theme={createTheme()}><Story /></ThemeProvider>)
addDecorator((Story) => (
<ThemeProvider theme={createTheme({ palette: shinColorPalette })}>
<Story />
</ThemeProvider>
))

configure(loadStories, module)

8 changes: 8 additions & 0 deletions src/components/CheckBox/__snapshots__/CheckBox.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -125,6 +126,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -197,6 +199,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -294,6 +297,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -371,6 +375,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -465,6 +470,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -536,6 +542,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -629,6 +636,7 @@ exports[`CheckBox should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -206,6 +207,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -279,6 +281,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -377,6 +380,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -455,6 +459,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -549,6 +554,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -620,6 +626,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -713,6 +720,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -833,6 +841,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -926,6 +935,7 @@ exports[`CheckBoxLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { SelectHTMLAttributes, FC, ChangeEvent, useCallback } from 'react'
import React, { ChangeEvent, FC, SelectHTMLAttributes, useCallback } from 'react'
import styled, { css } from 'styled-components'

import { isTouchDevice } from '../../libs/ua'
import { useTheme, Theme } from '../../hooks/useTheme'
import { Theme, useTheme } from '../../hooks/useTheme'

import { Icon } from '../Icon'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ exports[`StatusLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -124,6 +125,7 @@ exports[`StatusLabel should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down
8 changes: 8 additions & 0 deletions src/components/TabBar/__snapshots__/TabBar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -125,6 +126,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -204,6 +206,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -312,6 +315,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -400,6 +404,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -508,6 +513,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -596,6 +602,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down Expand Up @@ -704,6 +711,7 @@ exports[`TabBar should be match snapshot 1`] = `
},
"palette": Object {
"BACKGROUND": "#f5f6fa",
"BASE_GREY": "#f5f5f5",
"BORDER": "#d6d6d6",
"COLUMN": "#f9f9f9",
"DANGER": "#ef475b",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export { InformationPanel } from './components/InformationPanel'
// themes
export { createTheme } from './themes/createTheme'
export { ThemeProvider } from './themes/ThemeProvider'
export { defaultPalette } from './themes/createPalette'
export { defaultPalette, shinColorPalette } from './themes/createPalette'
export { defaultInteraction } from './themes/createInteraction'
export { defaultFrame } from './themes/createFrame'
export { defaultSize } from './themes/createSize'
Expand Down
20 changes: 20 additions & 0 deletions src/themes/createPalette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface PaletteProperty {
BORDER?: string
BACKGROUND?: string
COLUMN?: string
BASE_GREY?: string
MAIN?: string
DANGER?: string
WARNING?: string
Expand All @@ -28,6 +29,7 @@ export interface CreatedPaletteTheme {
BORDER: string
BACKGROUND: string
COLUMN: string
BASE_GREY: string
MAIN: string
DANGER: string
WARNING: string
Expand All @@ -45,6 +47,7 @@ export const defaultPalette = {
BORDER: '#d6d6d6',
BACKGROUND: '#f5f6fa',
COLUMN: '#f9f9f9',
BASE_GREY: '#f5f5f5',
MAIN: '#00a5ab',
DANGER: '#ef475b',
WARNING: '#ff8800',
Expand All @@ -53,6 +56,23 @@ export const defaultPalette = {
HEADER_GREEN: '#57d0d5',
}

export const shinColorPalette = {
TEXT_BLACK: '#23221f',
TEXT_GREY: '#76736a',
TEXT_DISABLED: '#c1bdb7',
TEXT_LINK: '#0077c7',
BORDER: '#d6d3d0',
BACKGROUND: '#f8f7f6',
COLUMN: '#f9f8f7',
BASE_GREY: '#f5f4f3',
MAIN: '#0077c7',
DANGER: '#e01e5a',
WARNING: '#ff8800',
SCRIM: 'rgba(0,0,0,0.5)',
OVERLAY: 'rgba(0,0,0,0.15)',
BRAND: '#00c4cc',
}

export const createPalette = (userPalette: PaletteProperty = {}) => {
const created: CreatedPaletteTheme = merge(
{
Expand Down