import React, { useState } from 'react' import { openBoard } from '../../../../components/system' import Router from 'next/router' import { makeStyles } from '@material-ui/core/styles' import { Card, CardHeader, CardContent, TextField, Button, Avatar } from '@material-ui/core' import SendIcon from '@material-ui/icons/Send' import AddIcon from '@material-ui/icons/Add' const useStyles = makeStyles(theme => ({ card: { maxWidth: 600, margin: theme.spacing(2), marginLeft: 'auto', marginRight: 'auto' }, field: { marginTop: theme.spacing(2), marginBottom: theme.spacing(2), }, secondaryButton: { marginLeft: theme.spacing(2) }, buttonIcon: { marginLeft: theme.spacing(1) } })) async function createPost(boardId, postData) { const board = await openBoard(boardId) await board.addPost(postData) Router.push(`/b/${boardId}`) } export default function CreatePost({ boardId }) { const classes = useStyles() const [title, setTitle] = useState('') return } title="Post Something" subheader={ Your post will be published to the {boardId} board } /> setTitle(e.target.value)} autoFocus fullWidth /> setTitle(e.target.value)} fullWidth /> } CreatePost.getInitialProps = ({ query }) => { return { boardId: query.board } }