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

Commit8b83f53

Browse files
committed
refactor level content
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
1 parentf7a0c29 commit8b83f53

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import*asReactfrom'react'
2+
importMarkdownfrom'../../../components/Markdown'
3+
4+
conststyles={
5+
text:{
6+
padding:'0rem 1rem',
7+
paddingBottom:'1rem',
8+
},
9+
title:{
10+
fontSize:'1.2rem',
11+
fontWeight:'bold'as'bold',
12+
lineHeight:'1.2rem',
13+
},
14+
}
15+
16+
interfaceProps{
17+
title:string
18+
content:string
19+
}
20+
21+
constContent=(props:Props)=>{
22+
if(!props.content.length){
23+
returnnull
24+
}
25+
return(
26+
<divcss={styles.text}>
27+
<h2css={styles.title}>{props.title}</h2>
28+
<Markdown>{props.content||''}</Markdown>
29+
</div>
30+
)
31+
}
32+
33+
exportdefaultContent

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react'
22
import*asTfrom'typings'
33
import*asTTfrom'typings/tutorial'
44
import{css,jsx}from'@emotion/core'
5-
importMarkdownfrom'../../../components/Markdown'
5+
importContentfrom'./Content'
66
importStepfrom'./Step'
77

88
conststyles={
@@ -90,12 +90,7 @@ const Level = ({ level, progress, position, onLoadSolution, currentStep, testSta
9090
return(
9191
<divcss={styles.page}>
9292
<divcss={styles.content}>
93-
{level.content.length ?(
94-
<divcss={styles.text}>
95-
<h2css={styles.title}>{level.title}</h2>
96-
<Markdown>{level.content||''}</Markdown>
97-
</div>
98-
) :null}
93+
<Contenttitle={level.title}content={level.content}/>
9994

10095
{level.content.length&&steps.length ?<divcss={styles.separator}/> :null}
10196

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp