Skip to content

Commit ffac6b4

Browse files
committedJul 24, 2020
update styles
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
·
v0.19.4v0.12.0
1 parent 6f4fc38 commit ffac6b4

File tree

15 files changed

+85
-131
lines changed

15 files changed

+85
-131
lines changed
 

‎web-app/src/components/BetaBadge/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Theme } from '../../styles/theme'
55

66
const styles = {
77
betaBadge: (theme: Theme) => ({
8-
backgroundColor: theme['$color-brand1-9'], // '#6a67ce',
8+
backgroundColor: theme['$color-brand1-9'],
99
color: theme['$color-white'],
1010
}),
1111
}

‎web-app/src/components/Divider.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎web-app/src/containers/SelectTutorial/SelectTutorialForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import TutorialFile from './forms/TutorialFile'
88
const styles = {
99
formWrapper: {
1010
padding: '1rem',
11-
width: '100wvw',
11+
width: '100vw',
1212
height: 'auto',
1313
},
1414
}

‎web-app/src/containers/SelectTutorial/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const styles = {
99
page: {
1010
position: 'relative' as 'relative',
1111
height: 'auto',
12-
width: 'vw',
12+
width: '100vw',
1313
},
1414
selectPage: {
1515
padding: '1rem',

‎web-app/src/containers/Start/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const styles = {
1010
position: 'relative' as 'relative',
1111
display: 'flex' as 'flex',
1212
flexDirection: 'column' as 'column',
13-
width: '100%',
14-
height: window.innerHeight,
13+
width: '100vw',
14+
height: '100vh',
1515
},
1616
header: {
1717
flex: 1,

‎web-app/src/containers/Tutorial/components/CompletedBanner.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import * as React from 'react'
22
import { css, jsx } from '@emotion/core'
33
import { Button, Icon } from '@alifd/next'
4+
import { Theme } from '../../../styles/theme'
45

56
const styles = {
6-
banner: {
7+
banner: (theme: Theme) => ({
78
height: 'auto',
8-
width: '100%',
9-
backgroundColor: 'rgb(85, 132, 255)',
10-
color: 'white',
9+
width: '100vw',
10+
backgroundColor: theme['$color-brand1-9'],
11+
color: theme['$color-white'],
1112
padding: '0.5rem 1rem',
12-
},
13+
}),
1314
header: {
1415
position: 'relative' as 'relative',
15-
width: '100%',
16+
width: '100vw',
1617
},
1718
headerMessage: {
1819
marginLeft: '0.5rem',

‎web-app/src/containers/Tutorial/components/Hints.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as React from 'react'
22
import { css, jsx } from '@emotion/core'
33
import Markdown from '../../../components/Markdown'
44
import Button from '../../../components/Button'
5+
import { Theme } from '../../../styles/theme'
56

67
const styles = {
78
hints: {
@@ -10,13 +11,11 @@ const styles = {
1011
hintList: {
1112
marginBottom: '0.5rem',
1213
},
13-
hint: {
14+
hint: (theme: Theme) => ({
1415
marginBottom: '0.5rem',
15-
backgroundColor: 'rgba(255,229,100,0.3)',
16-
borderLeft: '#ffe564',
17-
borderRadius: '2px',
16+
backgroundColor: theme['$color-warning-1'],
1817
padding: '0 0.5rem',
19-
},
18+
}),
2019
}
2120

2221
interface Props {

‎web-app/src/containers/Tutorial/components/Level.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ import * as T from 'typings'
33
import { css, jsx } from '@emotion/core'
44
import Content from './Content'
55
import Steps from './Steps'
6+
import { Theme } from '../../../styles/theme'
67

78
const styles = {
8-
page: {
9-
backgroundColor: 'white',
9+
page: (theme: Theme) => ({
10+
backgroundColor: theme['$color-white'],
1011
position: 'relative' as 'relative',
1112
height: 'auto',
12-
width: '100%',
13-
},
13+
width: '100vw',
14+
}),
1415
content: {
1516
display: 'flex' as 'flex',
1617
flexDirection: 'column' as 'column',

‎web-app/src/containers/Tutorial/components/SideMenu.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as React from 'react'
22
import { Menu, Icon, Drawer } from '@alifd/next'
3+
import { useTheme } from 'emotion-theming'
4+
import { Theme } from '../../../styles/theme'
35

46
const { Item, Divider } = Menu
57

@@ -11,10 +13,10 @@ const styles = {
1113
margin: 0,
1214
height: '100%',
1315
},
14-
active: {
15-
color: 'white',
16-
backgroundColor: 'rgb(85, 132, 255)',
17-
},
16+
active: (theme: Theme) => ({
17+
color: theme['$color-white'],
18+
backgroundColor: theme['$color-brand1-9'],
19+
}),
1820
itemText: {
1921
marginLeft: '0.5rem',
2022
},
@@ -31,6 +33,7 @@ const SideMenu = (props: Props) => {
3133
const onMenuClose = () => {
3234
props.toggleVisible(false)
3335
}
36+
const theme: Theme = useTheme()
3437
return (
3538
<Drawer
3639
bodyStyle={styles.drawer}
@@ -44,7 +47,7 @@ const SideMenu = (props: Props) => {
4447
<Item
4548
key="level"
4649
disabled={props.page === 'level'}
47-
style={props.page === 'level' ? styles.active : {}}
50+
style={props.page === 'level' ? styles.active(theme) : {}}
4851
onClick={() => {
4952
onMenuClose()
5053
props.setPage('level')
@@ -56,7 +59,7 @@ const SideMenu = (props: Props) => {
5659
<Item
5760
key="review"
5861
disabled={props.page === 'review'}
59-
style={props.page === 'review' ? styles.active : {}}
62+
style={props.page === 'review' ? styles.active(theme) : {}}
6063
onClick={() => {
6164
onMenuClose()
6265
props.setPage('review')
@@ -69,7 +72,7 @@ const SideMenu = (props: Props) => {
6972
<Item
7073
key="about"
7174
disabled={props.page === 'about'}
72-
style={props.page === 'about' ? styles.active : {}}
75+
style={props.page === 'about' ? styles.active(theme) : {}}
7376
onClick={() => {
7477
onMenuClose()
7578
props.setPage('about')
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
import * as React from 'react'
22
import { Progress } from '@alifd/next'
33
import useMedia from 'use-media'
4+
import { useTheme } from 'emotion-theming'
5+
import { Theme } from '../../../styles/theme'
46

57
const styles = {
6-
progress: {
8+
progress: (theme: Theme) => ({
79
display: 'flex' as 'flex',
810
justifyContent: 'flex-end' as 'flex-end',
911
alignItems: 'center' as 'center',
1012
width: '10rem',
11-
color: 'white',
12-
},
13-
text: { color: 'white' },
13+
color: theme['$color-white'],
14+
}),
15+
text: (theme: Theme) => ({
16+
color: theme['$color-white'],
17+
marginRight: '0.5rem',
18+
fontSize: '80%',
19+
}),
1420
}
1521

1622
interface Props {
@@ -19,30 +25,27 @@ interface Props {
1925
}
2026

2127
const StepProgress = (props: Props) => {
22-
const Text = (
23-
<span style={styles.text}>
24-
{props.current} of {props.max}
25-
</span>
26-
)
27-
28+
const theme: Theme = useTheme()
2829
const isWide = useMedia({ minWidth: '340px' })
2930

31+
const Text = `${props.current} of ${props.max}`
32+
3033
if (isWide) {
3134
return (
3235
<Progress
3336
state="success"
3437
progressive
3538
percent={(props.current / props.max) * 100}
3639
shape="line"
37-
color="rgb(85, 132, 255)"
40+
color={theme['$color-brand1-9']}
3841
css={styles.progress}
3942
textRender={() => {
4043
return Text
4144
}}
4245
/>
4346
)
4447
}
45-
return <div css={{ marginRight: '0.5rem', fontSize: '80%' }}>{Text}</div>
48+
return <div css={styles.text}>{Text}</div>
4649
}
4750

4851
export default StepProgress

‎web-app/src/containers/Tutorial/components/TestStatusIcon.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,36 @@
11
import * as React from 'react'
2+
import { useTheme } from 'emotion-theming'
23
import Icon from '../../../components/Icon'
4+
import { Theme } from '../../../styles/theme'
35

46
interface Props {
57
size: 'small' | 'xs'
68
status: 'COMPLETE' | 'ACTIVE' | 'INCOMPLETE' | 'FAIL'
79
}
810

911
const styles = {
10-
complete: {
12+
complete: (theme: Theme) => ({
1113
icon: 'success-filling',
12-
color: '#37B809',
13-
},
14-
active: {
14+
color: theme['$color-success-3'],
15+
}),
16+
active: (theme: Theme) => ({
1517
icon: 'success-filling',
16-
color: 'lightgrey',
17-
},
18-
fail: {
18+
color: theme['$color-disabled-1'],
19+
}),
20+
fail: (theme: Theme) => ({
1921
icon: 'warning',
20-
color: '#ff9300',
21-
},
22-
incomplete: {
22+
color: theme['$color-warning-3'],
23+
}),
24+
incomplete: (theme: Theme) => ({
2325
icon: 'lock',
24-
color: 'lightgrey',
25-
},
26+
color: theme['$color-disabled-1'],
27+
}),
2628
}
2729

2830
const TestStatusIcon = (props: Props) => {
29-
// @ts-ignore
30-
const style: { icon: string; color: string } = styles[props.status.toLowerCase()]
31+
const theme: Theme = useTheme()
32+
// @ts-ignore(
33+
const style: { icon: string; color: string } = styles[props.status.toLowerCase()](theme)
3134
return <Icon type={style.icon} size={props.size} style={{ color: style.color }} />
3235
}
3336

‎web-app/src/containers/Tutorial/containers/About.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
import * as React from 'react'
22
import Markdown from '../../../components/Markdown'
3+
import { Theme } from '../../../styles/theme'
34

45
const styles = {
56
container: {
67
display: 'flex' as 'flex',
78
flexDirection: 'column' as 'column',
89
},
9-
header: {
10+
header: (theme: Theme) => ({
1011
display: 'flex' as 'flex',
1112
alignItems: 'center',
1213
justifyContent: 'space-between',
1314
height: '2rem',
14-
backgroundColor: '#EBEBEB',
15+
backgroundColor: theme['$color-fill1-2'],
1516
fontSize: '1rem',
1617
lineHeight: '1rem',
1718
padding: '10px 0.4rem',
18-
},
19+
}),
1920
content: {
2021
padding: '0.5rem',
2122
},

‎web-app/src/containers/Tutorial/containers/Review.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as T from 'typings'
33
import { Switch } from '@alifd/next'
44
import Steps from '../components/Steps'
55
import Content from '../components/Content'
6+
import { Theme } from '../../../styles/theme'
67

78
interface Props {
89
levels: T.LevelUI[]
@@ -14,16 +15,16 @@ const styles = {
1415
display: 'flex' as 'flex',
1516
flexDirection: 'column' as 'column',
1617
},
17-
header: {
18+
header: (theme: Theme) => ({
1819
display: 'flex' as 'flex',
1920
alignItems: 'center',
2021
justifyContent: 'space-between',
2122
height: '2rem',
22-
backgroundColor: '#EBEBEB',
23+
backgroundColor: theme['$color-fill1-2'],
2324
fontSize: '1rem',
2425
lineHeight: '1rem',
2526
padding: '10px 0.4rem',
26-
},
27+
}),
2728
title: {
2829
marginLeft: '0.5rem',
2930
},

‎web-app/src/containers/Tutorial/index.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,35 @@ import Reset from './components/Reset'
1616
import Continue from './components/Continue'
1717
import ScrollContent from './components/ScrollContent'
1818
import CompletedBanner from './components/CompletedBanner'
19+
import { Theme } from '../../styles/theme'
20+
import { useTheme } from 'emotion-theming'
1921

2022
const styles = {
2123
page: {
2224
width: '100vw',
2325
paddingBottom: '5rem',
2426
},
25-
header: {
27+
header: (theme: Theme) => ({
2628
display: 'flex' as 'flex',
2729
alignItems: 'center',
2830
justifyContent: 'flex-start',
2931
height: '2rem',
30-
backgroundColor: '#EBEBEB',
32+
backgroundColor: theme['$color-fill1-4'],
3133
fontSize: '1rem',
3234
lineHeight: '1rem',
3335
padding: '10px 0.4rem',
34-
},
36+
}),
37+
menuIcon: (theme: Theme) => ({
38+
color: theme['$color-text1-4'],
39+
}),
3540
title: {
3641
marginLeft: '0.5rem',
3742
},
3843
learn: {
3944
textDecoration: 'none',
4045
color: 'inherit',
4146
},
42-
footer: {
47+
footer: (theme: Theme) => ({
4348
display: 'flex' as 'flex',
4449
flexDirection: 'row' as 'row',
4550
justifyContent: 'space-between',
@@ -53,9 +58,9 @@ const styles = {
5358
bottom: 0,
5459
left: 0,
5560
right: 0,
56-
color: 'white',
61+
color: theme['$color-white'],
5762
zIndex: 1000,
58-
},
63+
}),
5964
completeFooter: {
6065
position: 'fixed' as 'fixed',
6166
bottom: 0,
@@ -93,6 +98,7 @@ interface PageProps {
9398
*/
9499

95100
const TutorialPage = (props: PageProps) => {
101+
const theme: Theme = useTheme()
96102
const { position, progress, processes, testStatus } = props.context
97103

98104
const tutorial = selectors.currentTutorial(props.context)
@@ -130,7 +136,7 @@ const TutorialPage = (props: PageProps) => {
130136
<div css={styles.page}>
131137
<div css={styles.header}>
132138
<a onClick={() => setMenuVisible(!menuVisible)}>
133-
<Icon type="toggle-left" size="small" style={{ color: '#333' }} />
139+
<Icon type="toggle-left" size="small" style={styles.menuIcon(theme)} />
134140
</a>
135141
<span css={styles.title}>{tutorial.summary.title}</span>
136142
</div>

‎web-app/src/styles/theme.tsx

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const theme = {
8383
'$color-text1-2': '#999999',
8484
'$color-text1-3': '#666666',
8585
'$color-text1-4': '#000000',
86+
'$color-disabled-1': 'lightgrey',
8687
'$corner-1': '3px',
8788
'$corner-2': '6px',
8889
'$corner-3': '20px',
@@ -142,57 +143,6 @@ const theme = {
142143
'$shadow-3-right': '4px 0px 10px 0px rgba(0, 0, 0, 0.1)',
143144
'$shadow-3-down': '0px 4px 10px 0px rgba(0, 0, 0, 0.1)',
144145
'$shadow-3-left': '-4px 0px 10px 0px rgba(0, 0, 0, 0.1)',
145-
'$s-zero': '0',
146-
'$s-1': '4px',
147-
'$s-2': '8px',
148-
'$s-3': '12px',
149-
'$s-4': '16px',
150-
'$s-5': '20px',
151-
'$s-6': '24px',
152-
'$s-7': '28px',
153-
'$s-8': '32px',
154-
'$s-9': '36px',
155-
'$s-10': '40px',
156-
'$s-11': '44px',
157-
'$s-12': '48px',
158-
'$s-13': '52px',
159-
'$s-14': '56px',
160-
'$s-15': '60px',
161-
'$s-16': '64px',
162-
'$s-17': '68px',
163-
'$s-18': '72px',
164-
'$s-19': '76px',
165-
'$s-20': '80px',
166-
'$s-21': '84px',
167-
'$s-22': '88px',
168-
'$s-23': '92px',
169-
'$s-24': '96px',
170-
'$s-25': '100px',
171-
'$s-26': '104px',
172-
'$s-27': '108px',
173-
'$s-28': '112px',
174-
'$s-29': '116px',
175-
'$s-30': '120px',
176-
'$s-31': '124px',
177-
'$s-32': '128px',
178-
'$s-33': '132px',
179-
'$s-34': '136px',
180-
'$s-35': '140px',
181-
'$s-36': '144px',
182-
'$s-37': '148px',
183-
'$s-38': '152px',
184-
'$s-39': '156px',
185-
'$s-40': '160px',
186-
'$s-41': '164px',
187-
'$s-42': '168px',
188-
'$s-43': '172px',
189-
'$s-44': '176px',
190-
'$s-45': '180px',
191-
'$s-46': '184px',
192-
'$s-47': '188px',
193-
'$s-48': '192px',
194-
'$s-49': '196px',
195-
'$s-50': '200px',
196146
'$footer-height': '3rem',
197147
'$nav-height': '2rem',
198148
}

0 commit comments

Comments
 (0)
Please sign in to comment.