Skip to content

Feature/tutorial from file #179

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 4 commits into from
Apr 3, 2020
Merged
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
fix default chrome bug with upload file
  • Loading branch information
ShMcK committed Apr 3, 2020
commit a1f554b810c657dcce4d481960b38bda872184d4
19 changes: 18 additions & 1 deletion web-app/src/containers/SelectTutorial/forms/TutorialFile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,20 @@ interface Props {
onLoadSummary(data: TT.Tutorial): void
}

const styles = {
uploadFileButton: {
padding: '0.3rem 0.5rem',
outline: '1px dotted rgb(51, 51, 51)',
borderRadius: '0.2rem',
fontWeight: 400,
fontFamily:
'-apple-system, system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;',
},
}

const TutorialFile = (props: Props) => {
const onChange = (evt: any) => {
evt.preventDefault()
const files = evt.target.files

if (!files.length) {
Expand All @@ -29,7 +41,12 @@ const TutorialFile = (props: Props) => {
return (
<Form style={{ maxWidth: '600px' }}>
<FormItem label="Load coderoad config.json">
<input type="file" accept="application/json" onChange={onChange} />
<br />
<label style={styles.uploadFileButton}>
Upload
<input style={{ display: 'none' }} type="file" accept="application/json" onChange={onChange} />
</label>
<br />
</FormItem>
<br />
</Form>
Expand Down