|
1 | 1 | import React from 'react'; |
2 | 2 | import './color-page.scss'; |
| 3 | +import { useLocaleContext } from '../../context/locale-context'; |
3 | 4 |
|
4 | 5 | type ColorCardProps = { |
5 | 6 | name: string; |
6 | 7 | hex: string; |
| 8 | + nameLabel: string; |
| 9 | + hexLabel: string; |
7 | 10 | }; |
8 | 11 |
|
9 | | -const ColorCard = ({ name, hex }: ColorCardProps): React.ReactElement => ( |
| 12 | +const ColorCard = ({ name, hex, nameLabel, hexLabel }: ColorCardProps): React.ReactElement => ( |
10 | 13 | <div className="color-card"> |
11 | 14 | <div className="color-card__header" style={{ backgroundColor: hex }} /> |
12 | 15 | <div className="color-card__footer"> |
13 | 16 | <div> |
14 | | - <p className="color-card__title">NAME</p> |
| 17 | + <p className="color-card__title">{nameLabel}</p> |
15 | 18 | <p className="color-card__subtitle">{name}</p> |
16 | 19 | </div> |
17 | 20 | <div> |
18 | | - <p className="color-card__title">HEX</p> |
| 21 | + <p className="color-card__title">{hexLabel}</p> |
19 | 22 | <p className="color-card__subtitle">{hex}</p> |
20 | 23 | </div> |
21 | 24 | </div> |
22 | 25 | </div> |
23 | 26 | ); |
24 | 27 |
|
25 | 28 | const NEUTRALS = [ |
26 | | - { |
27 | | - name: 'Gray 100', |
28 | | - hex: '#f6f9fc', |
29 | | - }, |
30 | | - { |
31 | | - name: 'Gray 200', |
32 | | - hex: '#e9ecef', |
33 | | - }, |
34 | | - { |
35 | | - name: 'Gray 300', |
36 | | - hex: '#dee2e6', |
37 | | - }, |
38 | | - { |
39 | | - name: 'Gray 400', |
40 | | - hex: '#ced4da', |
41 | | - }, |
42 | | - { |
43 | | - name: 'Gray 500', |
44 | | - hex: '#adb5bd', |
45 | | - }, |
46 | | - { |
47 | | - name: 'Gray 600', |
48 | | - hex: '#8898aa', |
49 | | - }, |
50 | | - { |
51 | | - name: 'Gray 700', |
52 | | - hex: '#525f7f', |
53 | | - }, |
54 | | - { |
55 | | - name: 'Gray 800', |
56 | | - hex: '#32325d', |
57 | | - }, |
58 | | - { |
59 | | - name: 'Gray 900', |
60 | | - hex: '#212529', |
61 | | - }, |
| 29 | + { name: 'Gray 100', hex: '#f6f9fc' }, |
| 30 | + { name: 'Gray 200', hex: '#e9ecef' }, |
| 31 | + { name: 'Gray 300', hex: '#dee2e6' }, |
| 32 | + { name: 'Gray 400', hex: '#ced4da' }, |
| 33 | + { name: 'Gray 500', hex: '#adb5bd' }, |
| 34 | + { name: 'Gray 600', hex: '#8898aa' }, |
| 35 | + { name: 'Gray 700', hex: '#525f7f' }, |
| 36 | + { name: 'Gray 800', hex: '#32325d' }, |
| 37 | + { name: 'Gray 900', hex: '#212529' }, |
62 | 38 | ]; |
63 | 39 |
|
64 | 40 | const ColorPage = (): React.ReactElement => { |
| 41 | + const { siteLocale: s } = useLocaleContext(); |
| 42 | + |
65 | 43 | return ( |
66 | 44 | <div className="color-page"> |
67 | | - <h1 className="markdown__heading-1">Color</h1> |
68 | | - <p className="markdown__p"> |
69 | | - Tiny UI uses a specific set of palettes to specify colors to provide a consistent look and |
70 | | - feel for the products you build. |
71 | | - </p> |
| 45 | + <h1 className="markdown__heading-1">{s.color.title}</h1> |
| 46 | + <p className="markdown__p">{s.color.intro}</p> |
72 | 47 |
|
73 | | - <h2 className="markdown__heading-2">Primary colors</h2> |
74 | | - <p className="markdown__p"> |
75 | | - Primary palette is comprised of neutrals, white, and purple. These colors are present across |
76 | | - most touch points from marketing to product. |
77 | | - </p> |
| 48 | + <h2 className="markdown__heading-2">{s.color.primaryTitle}</h2> |
| 49 | + <p className="markdown__p">{s.color.primaryDesc}</p> |
78 | 50 | <div className="color-page__color-panel"> |
79 | | - <ColorCard name="Default" hex="#172b4d" /> |
80 | | - <ColorCard name="Primary" hex="#6E41BF" /> |
81 | | - <ColorCard name="Secondary" hex="#f7fafc" /> |
82 | | - <ColorCard name="Info" hex="#00bcd4" /> |
83 | | - <ColorCard name="Success" hex="#4caf50" /> |
84 | | - <ColorCard name="Danger" hex="#f44336" /> |
85 | | - <ColorCard name="Warning" hex="#ff9800" /> |
| 51 | + <ColorCard name={s.color.defaultColor} hex="#172b4d" nameLabel={s.color.nameLabel} hexLabel={s.color.hexLabel} /> |
| 52 | + <ColorCard name={s.color.primary} hex="#6E41BF" nameLabel={s.color.nameLabel} hexLabel={s.color.hexLabel} /> |
| 53 | + <ColorCard name={s.color.secondary} hex="#f7fafc" nameLabel={s.color.nameLabel} hexLabel={s.color.hexLabel} /> |
| 54 | + <ColorCard name={s.color.info} hex="#00bcd4" nameLabel={s.color.nameLabel} hexLabel={s.color.hexLabel} /> |
| 55 | + <ColorCard name={s.color.success} hex="#4caf50" nameLabel={s.color.nameLabel} hexLabel={s.color.hexLabel} /> |
| 56 | + <ColorCard name={s.color.danger} hex="#f44336" nameLabel={s.color.nameLabel} hexLabel={s.color.hexLabel} /> |
| 57 | + <ColorCard name={s.color.warning} hex="#ff9800" nameLabel={s.color.nameLabel} hexLabel={s.color.hexLabel} /> |
86 | 58 | </div> |
87 | 59 |
|
88 | | - <h2 className="markdown__heading-2">Light neutrals</h2> |
89 | | - <p className="markdown__p"> |
90 | | - Light neutrals are helpful for offsetting content in a primarily white layout without losing |
91 | | - warmth and cleanliness, and are therefore often used as a background color for web |
92 | | - components. |
93 | | - </p> |
| 60 | + <h2 className="markdown__heading-2">{s.color.neutralsTitle}</h2> |
| 61 | + <p className="markdown__p">{s.color.neutralsDesc}</p> |
94 | 62 |
|
95 | 63 | <div className="code-table-container"> |
96 | 64 | <table className="color-page__table"> |
|
0 commit comments