2019-10-26 23:58:20 +02:00
|
|
|
import React, { useState } from 'react'
|
2019-11-13 01:02:56 +01:00
|
|
|
import { Card, CardContent, TextField, Button, Typography, Divider} from '@material-ui/core'
|
2019-10-26 23:58:20 +02:00
|
|
|
import OpenIcon from '@material-ui/icons/Add'
|
2019-11-13 01:02:56 +01:00
|
|
|
import Router from 'next/router'
|
|
|
|
import { makeStyles } from '@material-ui/styles'
|
|
|
|
|
|
|
|
const useStyles = makeStyles(theme => ({
|
|
|
|
button: {
|
|
|
|
marginTop: theme.spacing(2),
|
|
|
|
marginLeft: 'auto',
|
|
|
|
}
|
|
|
|
}))
|
2019-10-26 23:58:20 +02:00
|
|
|
|
|
|
|
export default function OpenBoard() {
|
|
|
|
const [name, setName] = useState('')
|
2019-11-13 01:02:56 +01:00
|
|
|
const styles = useStyles()
|
2019-10-26 23:58:20 +02:00
|
|
|
return <Card>
|
2019-11-13 01:02:56 +01:00
|
|
|
<CardContent>
|
|
|
|
<Typography variant="h5">
|
|
|
|
Open a Board
|
|
|
|
</Typography>
|
|
|
|
<Typography variant="subtitle1">
|
|
|
|
IPFS Boards is a work in progress. Thank you for testing the app!
|
|
|
|
</Typography>
|
|
|
|
</CardContent>
|
|
|
|
<Divider />
|
2019-10-26 23:58:20 +02:00
|
|
|
<CardContent>
|
|
|
|
<TextField
|
|
|
|
placeholder="Type a name..."
|
|
|
|
value={name}
|
|
|
|
onChange={e => setName(e.target.value)}
|
|
|
|
autoFocus
|
2019-11-13 01:02:56 +01:00
|
|
|
fullWidth
|
2019-10-26 23:58:20 +02:00
|
|
|
/>
|
2019-11-13 01:02:56 +01:00
|
|
|
<Button
|
|
|
|
variant="contained"
|
|
|
|
color="primary"
|
|
|
|
className={styles.button}
|
|
|
|
disabled={!name}
|
|
|
|
onClick={() => Router.push(`/b/${name}`)}
|
|
|
|
>
|
2019-10-26 23:58:20 +02:00
|
|
|
<OpenIcon /> Open
|
|
|
|
</Button>
|
|
|
|
</CardContent>
|
|
|
|
</Card>
|
|
|
|
}
|