|
1 | 1 | import * as React from 'react';
|
2 | 2 | import styled, { css } from 'styled-components';
|
3 |
| -import palette from '../../lib/styles/palette'; |
| 3 | +import palette, { buttonColorMap } from '../../lib/styles/palette'; |
4 | 4 | import { Route } from 'react-router';
|
5 | 5 |
|
6 | 6 | type ButtonSize = 'SMALL' | 'DEFAULT' | 'LARGE';
|
7 | 7 |
|
8 |
| -const colorMap: { |
9 |
| - [color: string]: { |
10 |
| - background: string; |
11 |
| - color: string; |
12 |
| - hoverBackground: string; |
13 |
| - }; |
14 |
| -} = { |
15 |
| - teal: { |
16 |
| - background: palette.teal6, |
17 |
| - color: 'white', |
18 |
| - hoverBackground: palette.teal5, |
19 |
| - }, |
20 |
| - gray: { |
21 |
| - background: palette.gray2, |
22 |
| - color: palette.gray7, |
23 |
| - hoverBackground: palette.gray1, |
24 |
| - }, |
25 |
| - darkGray: { |
26 |
| - background: palette.gray8, |
27 |
| - color: 'white', |
28 |
| - hoverBackground: palette.gray6, |
29 |
| - }, |
30 |
| -}; |
31 |
| - |
32 | 8 | type RoundButtonBlockProps = {
|
33 | 9 | inline?: boolean;
|
34 | 10 | color: string;
|
@@ -77,20 +53,20 @@ const RoundButtonBlock = styled.button<RoundButtonBlockProps>`
|
77 | 53 | border: none;
|
78 | 54 | outline: none;
|
79 | 55 | font-weight: bold;
|
80 |
| - background: ${props => colorMap[props.color].background}; |
81 |
| - color: ${props => colorMap[props.color].color}; |
| 56 | + background: ${props => buttonColorMap[props.color].background}; |
| 57 | + color: ${props => buttonColorMap[props.color].color}; |
82 | 58 | &:hover {
|
83 |
| - background: ${props => colorMap[props.color].hoverBackground}; |
| 59 | + background: ${props => buttonColorMap[props.color].hoverBackground}; |
84 | 60 | }
|
85 | 61 |
|
86 | 62 | ${props =>
|
87 | 63 | props.border &&
|
88 | 64 | css<RoundButtonBlockProps>`
|
89 | 65 | background: transparent;
|
90 |
| - border: 1px solid ${props => colorMap[props.color].background}; |
91 |
| - color: ${props => colorMap[props.color].background}; |
| 66 | + border: 1px solid ${props => buttonColorMap[props.color].background}; |
| 67 | + color: ${props => buttonColorMap[props.color].background}; |
92 | 68 | &:hover {
|
93 |
| - background: ${props => colorMap[props.color].background}; |
| 69 | + background: ${props => buttonColorMap[props.color].background}; |
94 | 70 | color: white;
|
95 | 71 | }
|
96 | 72 | `}
|
|
0 commit comments