From b24fe12a50e8523ae0e722395fa70baabc5335a8 Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Wed, 10 Aug 2022 22:15:50 -0500 Subject: [PATCH] feat: implement navigation to public room from home --- src/pages/Home/Home.tsx | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx index eddcef9..e2e7b59 100644 --- a/src/pages/Home/Home.tsx +++ b/src/pages/Home/Home.tsx @@ -1,16 +1,25 @@ import React, { useState } from 'react' +import { useNavigate } from 'react-router-dom' +import Button from '@mui/material/Button' +import FormControl from '@mui/material/FormControl' import Typography from '@mui/material/Typography' import TextField from '@mui/material/TextField' import { v4 as uuid } from 'uuid' export function Home() { const [roomName, setRoomName] = useState(uuid()) + const navigate = useNavigate() const handleRoomNameChange = (event: React.ChangeEvent) => { const { value } = event.target setRoomName(value) } + const handleFormSubmit = (event: React.SyntheticEvent) => { + event.preventDefault() + navigate(`/public/${roomName}`) + } + return (
@@ -25,13 +34,22 @@ export function Home() {
- +
+ + + +
+ +
+
)