Skip to content

Feature/level summary #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 26, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

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
add Level page summary
  • Loading branch information
ShMcK committed Oct 26, 2019
commit 46d020e746b83bc0adb1b7e96498a4f7306e0b2e
4 changes: 2 additions & 2 deletions web-app/src/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Router from './components/Router'
import LoadingPage from './containers/LoadingPage'
import ContinuePage from './containers/Continue'
import NewPage from './containers/New'
import SummaryPage from './containers/Tutorial/SummaryPage'
import OverviewPage from './containers/Overview'
import LevelSummaryPage from './containers/Tutorial/LevelPage'
import CompletedPage from './containers/Tutorial/CompletedPage'

Expand Down Expand Up @@ -34,7 +34,7 @@ const Routes = () => {
<LoadingPage text="Loading..." />
</Route>
<Route path="Tutorial.Summary">
<SummaryPage send={tempSend} context={{} as CR.MachineContext} />
<OverviewPage send={tempSend} context={{} as CR.MachineContext} />
</Route>
<Route path="Tutorial.Level">
<LevelSummaryPage send={tempSend} context={{} as CR.MachineContext} />
Expand Down
84 changes: 84 additions & 0 deletions web-app/src/containers/Overview/OverviewPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import * as React from 'react'
import { Button } from '@alifd/next'
import * as G from 'typings/graphql'

const styles = {
summary: {
padding: '0rem 1rem 1rem 1rem',
},
title: {
fontWeight: 'bold' as 'bold',
},
description: {
fontSize: '1rem',
},
header: {
height: '36px',
backgroundColor: '#EBEBEB',
fontSize: '16px',
lineHeight: '16px',
padding: '10px 1rem',
},
levelList: {
padding: '0rem 1rem',
},
options: {
display: 'flex' as 'flex',
flexDirection: 'row' as 'row',
alignItems: 'center' as 'center',
justifyContent: 'flex-end' as 'flex-end',
position: 'absolute' as 'absolute',
bottom: 0,
height: '50px',
padding: '1rem',
backgroundColor: 'black',
width: '100%',
},
startButton: {
backgroundColor: 'gold',
fontWeight: 'bold' as 'bold',
},
}

interface Props {
title: string
description: string
levels: G.Level[]
onNext(): void
}

const Summary = ({ title, description, levels, onNext }: Props) => (
<div>
<div style={styles.header}>
<span>CodeRoad</span>
</div>
<div style={styles.summary}>
<h2 style={styles.title}>{title}</h2>
<p style={styles.description}>{description}</p>
</div>
<div>
<div style={styles.header}>
<span>Levels</span>
</div>
<div style={styles.levelList}>
{levels.map((level: G.Level, index: number) => (
<div key={index}>
<h4>
{index + 1}. {level.title}
</h4>
<div>{level.description}</div>
</div>
))}
</div>
</div>

<div style={styles.options}>
{/* TODO: Add back button */}
<Button style={styles.startButton} onClick={() => onNext()}>
Start
</Button>
</div>
</div>
)

export default Summary
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as G from 'typings/graphql'
import * as CR from 'typings'
import { useQuery } from '@apollo/react-hooks'

import queryTutorial from '../../../services/apollo/queries/tutorial'
import queryTutorial from '../../services/apollo/queries/tutorial'
import Summary from './Summary'
import ErrorView from '../../../components/Error'
import ErrorView from '../../components/Error'

interface PageProps {
context: CR.MachineContext
Expand Down
35 changes: 0 additions & 35 deletions web-app/src/containers/Tutorial/SummaryPage/Summary/index.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion web-app/stories/Level.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { storiesOf } from '@storybook/react'
import SideBarDecorator from './utils/SideBarDecorator'
import Level from '../src/containers/Tutorial/LevelPage/Level/index'

storiesOf('Tutorial SideBar', module)
storiesOf('Level', module)
.addDecorator(SideBarDecorator)
.addDecorator(withKnobs)
.add('Level', () => {
Expand Down
2 changes: 1 addition & 1 deletion web-app/stories/New.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const tutorialList = [
},
]

storiesOf('New', module)
storiesOf('Start', module)
.addDecorator(SideBarDecorator)
.add('New Page', () => {
return <NewPage tutorialList={tutorialList} />
Expand Down
37 changes: 37 additions & 0 deletions web-app/stories/Overview.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react'

import { linkTo } from '@storybook/addon-links'
import { storiesOf } from '@storybook/react'

import SideBarDecorator from './utils/SideBarDecorator'
import OverViewPage from '../src/containers/Overview/OverviewPage'

storiesOf('Overview', module)
.addDecorator(SideBarDecorator)
.add('OverView Page', () => {
const levels = [
{
id: 'L1',
title: 'The First Level',
description: 'A Summary of the first level',
},
{
id: 'L2',
title: 'The Second Level',
description: 'A Summary of the second level',
},
{
id: 'L3',
title: 'The Third Level',
description: 'A Summary of the third level',
},
]
return (
<OverViewPage
title="Some Title"
description="Some description"
levels={levels}
onNext={linkTo('Tutorial SideBar', 'Level')}
/>
)
})
2 changes: 1 addition & 1 deletion web-app/stories/Step.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const paragraphText = `Markdown included \`code\`, *bold*, & _italics_.
Emojis: :) :| :(
`

storiesOf('Tutorial SideBar', module)
storiesOf('Level', module)
.addDecorator(SideBarDecorator)
.addDecorator(withKnobs)
.add('Step Description', () => (
Expand Down
13 changes: 0 additions & 13 deletions web-app/stories/Summary.stories.tsx

This file was deleted.