Skip to content

Commit ad97c63

Browse files
authored
Merge pull request #404 from coderoad/feature/theme
Feature/theme
2 parents c9a34ed + e94b95c commit ad97c63

36 files changed

+405
-471
lines changed

src/commands.ts

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export const createCommands = ({ extensionPath, workspaceState }: CreateCommandP
2828
return {
2929
// initialize
3030
[COMMANDS.START]: async () => {
31-
console.log('start')
3231
if (webview && webview.state.loaded) {
3332
webview.createOrShow()
3433
} else {

web-app/.storybook/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { configure } from '@storybook/react'
2-
import '../src/styles/index.css'
2+
import '../src/styles/reset.css'
33

44
// setup acquireVsCodeApi mock
55
// @ts-ignore

web-app/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
},
2727
"dependencies": {
2828
"@alifd/next": "^1.20.20",
29-
"@alifd/theme-4": "^0.3.1",
3029
"@emotion/babel-preset-css-prop": "^10.0.27",
3130
"@emotion/core": "^10.0.28",
3231
"babel-jest": "^26.1.0",

web-app/src/App.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ import { ConfigProvider } from '@alifd/next'
33
import enUS from '@alifd/next/lib/locale/en-us'
44
import ErrorBoundary from './components/ErrorBoundary'
55
import Workspace from './components/Workspace'
6+
import { ThemeProvider } from 'emotion-theming'
7+
import theme from './styles/theme'
68
import Routes from './Routes'
79

810
const App = () => (
911
/* @ts-ignore invalid in enUS locale typings for @alifd/[email protected] https://github.com/alibaba-fusion/next/commit/e3b934b */
1012
<ConfigProvider locale={enUS}>
11-
<ErrorBoundary>
12-
<Workspace>
13-
<Routes />
14-
</Workspace>
15-
</ErrorBoundary>
13+
<Workspace>
14+
<ErrorBoundary>
15+
<ThemeProvider theme={theme}>
16+
<Routes />
17+
</ThemeProvider>
18+
</ErrorBoundary>
19+
</Workspace>
1620
</ConfigProvider>
1721
)
1822

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
import * as React from 'react'
2+
import { useTheme } from 'emotion-theming'
23
import { Badge } from '@alifd/next'
4+
import { Theme } from '../../styles/theme'
35

46
const styles = {
5-
betaBadge: {
6-
backgroundColor: '#6a67ce',
7-
color: '#FFFFFF',
8-
},
7+
betaBadge: (theme: Theme) => ({
8+
backgroundColor: theme['$color-brand1-9'],
9+
color: theme['$color-white'],
10+
}),
911
}
1012

1113
type Props = {
1214
children: React.ReactElement | string
1315
}
1416

1517
const BetaBadge = ({ children }: Props) => {
18+
const theme: Theme = useTheme()
1619
return (
17-
<Badge content="beta" style={styles.betaBadge}>
20+
<Badge content="beta" style={styles.betaBadge(theme)}>
1821
{children}&nbsp;&nbsp;
1922
</Badge>
2023
)

web-app/src/components/Card/index.tsx

-29
This file was deleted.

web-app/src/components/Divider.tsx

-14
This file was deleted.

web-app/src/components/Error/index.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ import * as T from 'typings'
44
import { css, jsx } from '@emotion/core'
55
import Markdown from '../Markdown'
66
import Button from '../../components/Button'
7+
import { Theme } from '../../styles/theme'
78

89
const styles = {
9-
container: {
10+
container: (theme: Theme) => ({
1011
display: 'flex' as 'flex',
1112
flexDirection: 'column' as 'column',
1213
justifyContent: 'center' as 'center',
1314
alignItems: 'center' as 'center',
14-
border: '0.5rem solid #FFBABA',
15+
border: `0.5rem solid ${theme['$color-error-2']}`,
1516
padding: '1rem',
1617
width: '100%',
18+
maxWidth: '100%',
1719
height: '100%',
18-
},
19-
content: {
20+
}),
21+
content: (theme: Theme) => ({
2022
textAlign: 'center' as 'center',
21-
color: 'rgb(40, 40, 40);',
22-
},
23+
color: theme['$color-text1-3'],
24+
}),
2325
options: {
2426
display: 'flex' as 'flex',
2527
flexDirection: 'column' as 'column',

web-app/src/components/Markdown/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import MarkdownIt from 'markdown-it'
22
import Prism from 'prismjs'
3+
import { css, jsx, InterpolationWithTheme } from '@emotion/core'
34
// @ts-ignore no types for package
45
import markdownEmoji from 'markdown-it-emoji'
56
import * as React from 'react'

web-app/src/components/NewUserExperience/NuxTutorial.tsx

-134
This file was deleted.

web-app/src/components/NewUserExperience/transition.css

-21
This file was deleted.

web-app/src/components/Tag/index.tsx

-18
This file was deleted.

web-app/src/components/TestMessage/index.tsx

+15-12
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
import * as React from 'react'
22
import Icon from '../Icon'
33
import { css, jsx } from '@emotion/core'
4+
import { useTheme } from 'emotion-theming'
5+
import { Theme } from '../../styles/theme'
46

57
const styles = {
6-
container: {
7-
backgroundColor: '#fff3e0',
8+
container: (theme: Theme) => ({
9+
backgroundColor: theme['$color-warning-1'],
810
padding: '0.5rem',
911
animationDuration: '0.3s',
1012
animationTimingFunction: 'ease-in-out',
11-
borderTopLeftRadius: '4px',
12-
borderTopRightRadius: '4px',
13-
color: 'rgb(51, 51, 51)',
14-
fontSize: '0.8rem',
15-
},
16-
icon: {
17-
color: '#ff9300',
18-
},
13+
borderTopLeftRadius: theme['$corner-1'],
14+
borderTopRightRadius: theme['$corner-1'],
15+
color: theme['$color-text1-3'],
16+
fontSize: theme['$font-size-caption'],
17+
}),
18+
icon: (theme: Theme) => ({
19+
color: theme['$color-warning-3'],
20+
}),
1921
content: {
20-
marginLeft: '0.5rem',
22+
padding: '0 0.5rem',
2123
},
2224
}
2325

@@ -38,9 +40,10 @@ const TestMessage = (props: Props) => {
3840
}
3941
}, [props.message])
4042

43+
const theme: Theme = useTheme()
4144
return visible && props.message ? (
4245
<div css={styles.container}>
43-
<Icon type="warning" style={styles.icon} size="xs" />
46+
<Icon type="warning" style={styles.icon(theme)} size="xs" />
4447
<span css={styles.content}>{props.message}</span>
4548
</div>
4649
) : null

0 commit comments

Comments
 (0)