Skip to content

Commit

Permalink
fix(theme): replace raw colors with palette synonim
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed Apr 29, 2019
1 parent 49223fc commit 9ee5952
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 37 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const customTheme = createTheme({
/** Change the pallete of the color. */
COLORS: {
PRIMARY: '#3EB7F9',
PRIMARY_TEXT_COLOR: 'darkorange',
SECONDARY_TEXT_COLOR: 'orange',
},
/** Change the custom components styles if it needed. */
components: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Avatar/Avatar.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const [AvatarTag, themeAvatar] = createThemeTag(name, ({ COLORS }: *) => ({
alignItems: 'center',
position: 'relative',
backgroundColor: getBackgroundColorByName(props.name),
color: COLORS.DARK_GRAY1,
color: COLORS.PRIMARY_TEXT_COLOR,

[`&:hover ${AvatarHandleTag}`]: {
bottom: 0,
Expand Down Expand Up @@ -76,7 +76,7 @@ const [AvatarHandleTag, themeHandle] = createThemeTag(`${name}Handle`, ({ COLORS
fontSize: '8px',
transition: 'all .15s ease-in-out',
userSelect: 'none',
color: COLORS.LIGHT_GRAY1,
color: COLORS.SECONDARY_TEXT_COLOR,
},
}));

Expand Down
2 changes: 1 addition & 1 deletion src/components/Button/Button.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const spinner = keyframes`


const getLoading = (props: *, COLORS: *) => {
const color = props.variant === 'outlined' ? COLORS.LIGHT_GRAY1 : COLORS.WHITE;
const color = props.variant === 'outlined' ? COLORS.PRIMARY_BORDER_COLOR : COLORS.WHITE;
return props.loading
? {
'&:after': {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Code/Code.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const [CodeWrapperTag, themeWrapper] = createThemeTag(`${name}Wrapper`, ({ COLOR

const [CodeLineCounterTag, themeCounter] = createThemeTag(`${name}Counter`, ({ COLORS, SIZES }: *) => ({
root: {
color: COLORS.DARK_GRAY1,
color: COLORS.PRIMARY_TEXT_COLOR,
fontFamily: 'Courier',
opacity: '0.5',
textAlign: 'center',
Expand All @@ -26,7 +26,7 @@ const [CodeLineCounterTag, themeCounter] = createThemeTag(`${name}Counter`, ({ C

const [CodeBodyTag, themeBody] = createThemeTag(`${name}Body`, ({ COLORS }: *) => ({
root: {
color: COLORS.DARK_GRAY1,
color: COLORS.PRIMARY_TEXT_COLOR,
fontFamily: 'Courier',
overflow: 'auto',
height: '100%',
Expand Down
12 changes: 6 additions & 6 deletions src/components/DateInput/DateInput.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createThemeTag } from '../../theme/createThemeTag';
const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
globals: `
.react-datepicker {
border: 1px solid ${COLORS.LIGHT_GRAY1};
border: 1px solid ${COLORS.PRIMARY_BORDER_COLOR};
box-shadow: 0 2px 10px 0 rgba(208,215,221,0.5);
display: flex;
padding-bottom: 32px;
Expand Down Expand Up @@ -61,7 +61,7 @@ const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
.react-datepicker__day--selected {
border-radius: 24px;
background-color: ${COLORS.LIGHT_BLUE};
color: ${COLORS.LIGHT_PRIMARY_TEXT_COLOR};
color: ${COLORS.PRIMARY_TEXT_COLOR};
}
.react-datepicker__day:hover {
Expand All @@ -86,12 +86,12 @@ const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
.react-datepicker__time-container {
position: initial;
border: none;
border-left: 1px solid ${COLORS.LIGHT_GRAY1};
border-left: 1px solid ${COLORS.PRIMARY_BORDER_COLOR};
border-radius: 0;
}
.react-datepicker__header--time {
border-bottom: 1px solid ${COLORS.LIGHT_GRAY1};
border-bottom: 1px solid ${COLORS.PRIMARY_BORDER_COLOR};
}
.react-datepicker-time__header {
Expand All @@ -117,7 +117,7 @@ const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
font-family: Poppins;
color: ${COLORS.PRIMARY_TEXT_COLOR};
font-weight: 600;
border-top: 1px solid ${COLORS.LIGHT_GRAY1};
border-top: 1px solid ${COLORS.PRIMARY_BORDER_COLOR};
}
.react-datepicker__header {
Expand All @@ -129,7 +129,7 @@ const [_, theme] = createThemeTag('dateInput', ({ COLORS }: *) => ({
height: 32px;
font-size: 12px;
display: flex;
border-bottom: 1px solid ${COLORS.LIGHT_GRAY1};
border-bottom: 1px solid ${COLORS.PRIMARY_BORDER_COLOR};
}
.react-datepicker__current-month {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialog/DialogHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function DialogHeader({
}: DialogHeaderProps) {
return (
<Card.Header offset="lg" { ...rest }>
<Text weight="semibold" color="DARK_GRAY1">{ title }</Text>
<Text weight="semibold">{ title }</Text>
<HeaderCloseTag onClick={ onClose }>
<Icon size="sm" name="Delete" title="Close Dialog" />
</HeaderCloseTag>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/FormError.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function FormError({ error, children, ...rest }: FormErrorProps) {
<FormErrorPlateTag tagName="div" { ...rest } >
<Row gap="md">
<Icon name="Alert" color="DANGER" />
<Text color="GRAY1">{ errorText }</Text>
<Text color="SECONDARY_TEXT_COLOR">{ errorText }</Text>
</Row>
</FormErrorPlateTag>
)
Expand Down
3 changes: 2 additions & 1 deletion src/components/Form/FormSectionTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ type FormSectionTitleProps = {

const name = 'formSectionTitle';

const [FormSectionTitleTag, theme] = createThemeTag(name, ({ SIZES }: *) => ({
const [FormSectionTitleTag, theme] = createThemeTag(name, ({ COLORS, SIZES }: *) => ({
root: {
fontWeight: 600,
color: COLORS.PRIMARY_TEXT_COLOR,
fontSize: SIZES.OVERLINE_1,
lineHeight: SIZES.OVERLINE_1_LH,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Form/__snapshots__/Form.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ exports[`<Form /> should shallow form error 1`] = `
size="md"
/>
<Text
color="GRAY1"
color="SECONDARY_TEXT_COLOR"
ellipsis={false}
weight="normal"
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Heading/Heading.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ const [HeadingTag, theme] = createThemeTag(name, ({ COLORS, SIZES }: *) => ({
},
kind: {
primary: {
color: COLORS.TEXT_PRIMARY,
color: COLORS.PRIMARY_TEXT_COLOR,
},
secondary: {
color: COLORS.TEXT_SECONDARY,
color: COLORS.SECONDARY_TEXT_COLOR,
},
disabled: {
color: COLORS.DISABLED_TEXT_COLOR,
Expand Down
2 changes: 1 addition & 1 deletion src/components/Indicator/Indicator.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const [IndicatorTag, themeIndicator] = createThemeTag(
modifiers: {
status: {
enabled: { backgroundColor: COLORS.GREEN },
disabled: { backgroundColor: COLORS.LIGHT_GRAY1 },
disabled: { backgroundColor: COLORS.DISABLED_TEXT_COLOR },
},
},
}),
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input/Input.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const [InputClearButtonTag, themeClearButton] = createThemeTag(`${name}ClearButt
alignItems: 'center',
height: '100%',
right: '8px',
color: COLORS.LIGHT_GRAY1,
color: COLORS.PRIMARY_BORDER_COLOR,
cursor: 'pointer',
},
}));
Expand Down
2 changes: 1 addition & 1 deletion src/components/Pagination/Pagination.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const [PaginationItemTag, themePaginationItem] = createThemeTag(`${name}Item`, (
userSelect: 'none',

'&:hover': {
color: COLORS.DARK_GRAY1,
color: COLORS.PRIMARY_TEXT_COLOR,
},

'&:last-child': {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Paragraph/Paragraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const Paragraph = ({ text, children, ...rest }: ParagraphProps) => (
);

Paragraph.defaultProps = {
color: 'DARK_GRAY1',
color: 'PRIMARY_TEXT_COLOR',
weight: 'normal',
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/Paragraph/Paragraph.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export default (asStory) => {
story
.add('common ', () => (
<Fragment>
<Paragraph color="DARK_GRAY1">Primary Paragraph</Paragraph>
<Paragraph color="GRAY1">Secondary Paragraph</Paragraph>
<Paragraph color="LIGHT_GRAY1">Disabled Paragraph</Paragraph>
<Paragraph color="PRIMARY_TEXT_COLOR">Primary Paragraph</Paragraph>
<Paragraph color="SECONDARY_TEXT_COLOR">Secondary Paragraph</Paragraph>
<Paragraph color="DISABLED_TEXT_COLOR">Disabled Paragraph</Paragraph>
</Fragment>
))
.add('with text', () => (
Expand Down
10 changes: 5 additions & 5 deletions src/components/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ReactSelect, { components } from 'react-select';
import { withTheme } from 'emotion-theming';

import { SelectTag } from './Select.theme';
import { type Theme, PALETTE, Z_INDEX } from '../../theme';
import { type Theme, COLORS, Z_INDEX } from '../../theme';

type SelectProps = {|
options: Array<{ label: mixed, value: string }>,
Expand Down Expand Up @@ -33,10 +33,10 @@ const customStyles = ({ hasError, zIndex = Z_INDEX.DROPDOWN, COLORS }) => ({
...style,
minHeight: '36px',
backgroundColor: COLORS.WHITE,
borderColor: hasError ? COLORS.DANGER : (isFocused ? COLORS.PRIMARY : COLORS.LIGHT_GRAY1),
borderColor: hasError ? COLORS.DANGER : (isFocused ? COLORS.PRIMARY : COLORS.PRIMARY_BORDER_COLOR),
boxShadow: null,
'&:hover': {
borderColor: isFocused ? COLORS.PRIMARY : COLORS.LIGHT_GRAY1,
borderColor: isFocused ? COLORS.PRIMARY : COLORS.PRIMARY_BORDER_COLOR,
},
}),
menuPortal: (style) => ({
Expand All @@ -45,7 +45,7 @@ const customStyles = ({ hasError, zIndex = Z_INDEX.DROPDOWN, COLORS }) => ({
}),
placeholder: (style) => ({
...style,
color: COLORS.LIGHT_GRAY1,
color: COLORS.PLACEHOLDER_COLOR,
whiteSpace: 'nowrap',
}),
indicatorSeparator: (style) => ({
Expand Down Expand Up @@ -143,7 +143,7 @@ class Select extends React.Component<SelectProps & SelectPropsFromHOCs> {
options={ options }
placeholder={ placeholder }
valueComponent={ valueComponent }
styles={ customStyles({ ...rest, COLORS: theme.COLORS || PALETTE }) }
styles={ customStyles({ ...rest, COLORS: theme.COLORS || COLORS }) }
value={ selectValue }
components={ components }
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Switch/Switch.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const [SwitchApperanceTag, themeApperance] = createThemeTag(`${name}Appearance`,
const [SwitchLabelTag, themeLabel] = createThemeTag(`${name}Label`, ({ COLORS }: *) => ({
root: {
fontSize: COLORS.OVERLINE,
color: COLORS.GRAY1,
color: COLORS.SECONDARY_TEXT_COLOR,
marginLeft: '8px',
userSelect: 'none',
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Text({
}

Text.defaultProps = {
color: 'TEXT_PRIMARY',
color: 'PRIMARY_TEXT_COLOR',
weight: 'normal',
ellipsis: false,
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/TextArea/TextArea.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const [TextAreaTag, theme] = createThemeTag(name, ({ COLORS, SIZES }: *) => ({
borderRadius: SIZES.MAIN_BORDER_RADIUS,
fontSize: SIZES.BODY_TEXT,
lineHeight: SIZES.BODY_TEXT_LH,
color: COLORS.DARK_GRAY1,
color: COLORS.PRIMARY_TEXT_COLOR,
fontWeight: 400,
padding: '8px',

Expand Down
4 changes: 2 additions & 2 deletions src/components/TreeSelect/TreeSelect.theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ const [_, treeSelectTheme] = createThemeTag(name, ({ COLORS, SIZES }: *) => ({
margin: '2px',
borderRadius: '12px',
padding: '0 24px 0 12px',
color: COLORS.GRAY1,
border: `1px solid ${COLORS.LIGHT_GRAY1}`,
color: COLORS.SECONDARY_TEXT_COLOR,
border: `1px solid ${COLORS.PRIMARY_BORDER_COLOR}`,
backgroundColor: '#fff',
fontSize: '11px',
fontWeight: 400,
Expand Down
3 changes: 0 additions & 3 deletions src/theme/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ const PALETTE = {
DANGER: DEFINE_PALETTE.LIGHT_RED,
DANGER_DARK: DEFINE_PALETTE.RED,
TRANSPARENT: DEFINE_PALETTE.TRANSPARENT,

TEXT_PRIMARY: DEFINE_PALETTE.DARK_GRAY1,
TEXT_SECONDARY: DEFINE_PALETTE.GRAY1,
};

const COLORS = {
Expand Down

0 comments on commit 9ee5952

Please sign in to comment.