Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite370e9b

Browse files
committed
create provider, fix styles for storybook
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parenta2a1857 commite370e9b

File tree

9 files changed

+71
-78
lines changed

9 files changed

+71
-78
lines changed

‎web-app/src/App.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
import*asReactfrom'react'
2-
import{ConfigProvider}from'@alifd/next'
3-
importenUSfrom'@alifd/next/lib/locale/en-us'
4-
importErrorBoundaryfrom'./components/ErrorBoundary'
5-
importWorkspacefrom'./components/Workspace'
6-
import{ThemeProvider}from'emotion-theming'
7-
importthemefrom'./styles/theme'
2+
importProviderfrom'./Provider'
83
importRoutesfrom'./Routes'
94

105
constApp=()=>(
11-
/*@ts-ignore invalid in enUS locale typings for @alifd/next@1.20.20 https://github.com/alibaba-fusion/next/commit/e3b934b */
12-
<ConfigProviderlocale={enUS}>
13-
<Workspace>
14-
<ErrorBoundary>
15-
<ThemeProvidertheme={theme}>
16-
<Routes/>
17-
</ThemeProvider>
18-
</ErrorBoundary>
19-
</Workspace>
20-
</ConfigProvider>
6+
<Provider>
7+
<Routes/>
8+
</Provider>
219
)
2210

2311
exportdefaultApp

‎web-app/src/Provider.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import*asReactfrom'react'
2+
import{css,jsx}from'@emotion/core'
3+
import{ConfigProvider}from'@alifd/next'
4+
importenUSfrom'@alifd/next/lib/locale/en-us'
5+
importErrorBoundaryfrom'./components/ErrorBoundary'
6+
import{ThemeProvider}from'emotion-theming'
7+
import{AdminProvider}from'./services/admin/context'
8+
importtheme,{Theme}from'./styles/theme'
9+
10+
typeProps={
11+
children:React.ReactElement
12+
}
13+
14+
conststyles={
15+
page:(theme:Theme)=>({
16+
display:'flex'as'flex',
17+
position:'relative'as'relative',
18+
margin:0,
19+
width:'100vw',
20+
maxWidth:'100%',
21+
minHeight:'100vh',
22+
backgroundColor:theme['$color-white'],
23+
overflow:'auto',
24+
}),
25+
}
26+
27+
constProvider=(props:Props)=>(
28+
/*@ts-ignore invalid in enUS locale typings for @alifd/next@1.20.20 https://github.com/alibaba-fusion/next/commit/e3b934b */
29+
<ConfigProviderlocale={enUS}>
30+
<divcss={styles.page}>
31+
<AdminProvider>
32+
<ErrorBoundary>
33+
<ThemeProvidertheme={theme}>{props.children}</ThemeProvider>
34+
</ErrorBoundary>
35+
</AdminProvider>
36+
</div>
37+
</ConfigProvider>
38+
)
39+
40+
exportdefaultProvider

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

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

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ interface Props {
1111

1212
conststyles={
1313
page:{
14-
position:'relative'as'relative',
1514
display:'flex'as'flex',
1615
flexDirection:'column'as'column',
1716
alignItems:'center'as'center',
1817
justifyContent:'center'as'center',
19-
height:'100vh',
20-
width:'100vw',
18+
position:'absolute'as'absolute',
19+
top:0,
20+
bottom:0,
21+
left:0,
22+
right:0,
2123
},
2224
processes:{
2325
padding:'0 1rem',
24-
position:'fixed'as'fixed',
26+
position:'absolute'as'absolute',
2527
bottom:0,
2628
left:0,
2729
right:0,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const styles = {
4545
paddingLeft:'1.1rem',
4646
},
4747
footer:(theme:Theme)=>({
48-
position:'fixed'as'fixed',
48+
position:'absolute'as'absolute',
4949
bottom:0,
5050
left:0,
5151
right:0,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,23 @@ const styles = {
5656
fontSize:'1rem',
5757
lineHeight:'1rem',
5858
padding:'10px 0rem',
59-
position:'fixed'as'fixed',
59+
position:'absolute'as'absolute',
6060
bottom:0,
6161
left:0,
6262
right:0,
6363
color:theme['$color-white'],
6464
zIndex:1000,
6565
}),
6666
completeFooter:{
67-
position:'fixed'as'fixed',
67+
position:'absolute'as'absolute',
6868
bottom:0,
6969
left:0,
7070
right:0,
7171
zIndex:1000,
7272
},
7373
processes:(theme:Theme)=>({
7474
padding:'0 1rem',
75-
position:'fixed'as'fixed',
75+
position:'absolute'as'absolute',
7676
bottom:theme['$footer-height'],
7777
left:0,
7878
right:0,

‎web-app/src/environment.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ export const TUTORIAL_LIST_URL: string = process.env.REACT_APP_TUTORIAL_LIST_URL
1414

1515
// config variables
1616
exportconstDISPLAY_RUN_TEST_BUTTON=(process.env.CODEROAD_DISPLAY_RUN_TEST_BUTTON||'true').toLowerCase()==='true'
17+
18+
exportconstADMIN_MODE=true
19+
// (process.env.CODEROAD_ADMIN_MODE || process.env.STORYBOOK_ADMIN_MODE || '').toLowerCase() === 'true'

‎web-app/stories/utils/ProviderDecorator.tsx

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

‎web-app/stories/utils/SideBarDecorator.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import*asReactfrom'react'
22
import{css,jsx}from'@emotion/core'
3-
import{Provider}from'./ProviderDecorator'
4-
import{ThemeProvider}from'emotion-theming'
5-
importthemefrom'../../src/styles/theme'
3+
importProviderfrom'../../src/Provider'
64

75
conststyles={
8-
container:{
9-
left:'25rem',
10-
position:'absolute'as'absolute',
11-
boxSizing:'border-box'as'border-box',
12-
borderLeft:'2px solid black',
13-
borderRight:'2px solid black',
6+
limitedWidthContainer:{
7+
left:0,
8+
top:0,
9+
position:'fixed'as'fixed',
10+
borderRight:'1px solid black',
1411
width:'50rem',
15-
height:window.innerHeight,
16-
backgroundColor:'white',
12+
height:'100%',
13+
// backgroundColor: 'white',
14+
},
15+
container:{
16+
position:'relative'as'relative',
1717
},
1818
}
1919

2020
constSideBarDecorator=(storyFn)=>(
2121
<Provider>
22-
<ThemeProvidertheme={theme}>
23-
<divcss={styles.container}>{storyFn()}</div>
24-
</ThemeProvider>
22+
<divcss={styles.container}>
23+
<divcss={styles.limitedWidthContainer}>{storyFn()}</div>
24+
</div>
2525
</Provider>
2626
)
2727

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp