diff --git a/frontend/.vscode/react.code-snippets b/frontend/.vscode/react.code-snippets new file mode 100644 index 0000000..8c4bdc8 --- /dev/null +++ b/frontend/.vscode/react.code-snippets @@ -0,0 +1,51 @@ +{ + "New Functional Component": { + "scope": "typescriptreact", + "prefix": "fc", + "body": [ + "type Props = {}", + "", + "export const $1 = (props: Props) => {", + " return
$2
", + "}" + ], + "description": "React Component w/props" + }, + "New Functional Route Component": { + "scope": "typescriptreact", + "prefix": "fc-routed", + "body": [ + "import { RouteComponentProps } from 'react-router'", + "type Props = RouteComponentProps", + "", + "export const $1 = ({match}: Props) => {", + " return$2
", + "}" + ], + "description": "React Routed Component" + }, + "New Page Component": { + "scope": "typescriptreact", + "prefix": "fc-page", + "body": [ + "export const $1 = () => {", + " return$2
", + "}" + ], + "description": "React Page Component No Props" + }, + "New Form Component": { + "scope": "typescriptreact", + "prefix": "fc-form", + "body": [ + "import { Form, Input, Layout } from 'antd'", + "", + "export const $1 = () => {", + " const [form] = Form.useForm()", + " return ", + "}" + ], + "description": "React Page Component No Props" + + } +} \ No newline at end of file diff --git a/frontend/src/layout/AppHeader.tsx b/frontend/src/layout/AppHeader.tsx index 9ecbfb6..d6fa0fa 100644 --- a/frontend/src/layout/AppHeader.tsx +++ b/frontend/src/layout/AppHeader.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { Avatar, Typography } from 'antd' +import { Avatar, Button, Typography } from 'antd' import { Header } from 'antd/lib/layout/layout' import { User } from '../types' -import { Link } from 'react-router-dom' +import { Link, useHistory } from 'react-router-dom' export type NavRoute = { path: string @@ -17,6 +17,7 @@ type Props = { } export const AppHeader = ({ user, routes }: Props) => { + const history = useHistory() // Unauthed Header if (!user) return ( @@ -34,9 +35,12 @@ export const AppHeader = ({ user, routes }: Props) => { {route.label} ))} +