Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor level content
Signed-off-by: shmck <[email protected]>
  • Loading branch information
ShMcK committed Jul 11, 2020
commit 8b83f53beaf303a0310ef7cc45084af414c5e5f8
33 changes: 33 additions & 0 deletions web-app/src/containers/Tutorial/components/Content.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import * as React from 'react'
import Markdown from '../../../components/Markdown'

const styles = {
text: {
padding: '0rem 1rem',
paddingBottom: '1rem',
},
title: {
fontSize: '1.2rem',
fontWeight: 'bold' as 'bold',
lineHeight: '1.2rem',
},
}

interface Props {
title: string
content: string
}

const Content = (props: Props) => {
if (!props.content.length) {
return null
}
return (
<div css={styles.text}>
<h2 css={styles.title}>{props.title}</h2>
<Markdown>{props.content || ''}</Markdown>
</div>
)
}

export default Content
9 changes: 2 additions & 7 deletions web-app/src/containers/Tutorial/components/Level.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react'
import * as T from 'typings'
import * as TT from 'typings/tutorial'
import { css, jsx } from '@emotion/core'
import Markdown from '../../../components/Markdown'
import Content from './Content'
import Step from './Step'

const styles = {
Expand Down Expand Up @@ -90,12 +90,7 @@ const Level = ({ level, progress, position, onLoadSolution, currentStep, testSta
return (
<div css={styles.page}>
<div css={styles.content}>
{level.content.length ? (
<div css={styles.text}>
<h2 css={styles.title}>{level.title}</h2>
<Markdown>{level.content || ''}</Markdown>
</div>
) : null}
<Content title={level.title} content={level.content} />

{level.content.length && steps.length ? <div css={styles.separator} /> : null}

Expand Down