From 36d059329c416c2e233f3cce0c278dd21f1bc4b0 Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Wed, 10 Aug 2022 09:42:15 -0500 Subject: [PATCH] feat: add room name input text field --- package-lock.json | 14 ++++++++++++++ package.json | 2 ++ src/pages/Home/Home.tsx | 20 +++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index af77d26..d8f4816 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,9 +30,11 @@ "typeface-public-sans": "^1.1.13", "typeface-roboto": "^1.1.13", "typescript": "^4.7.4", + "uuid": "^8.3.2", "web-vitals": "^2.1.4" }, "devDependencies": { + "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^5.33.0", "@typescript-eslint/parser": "^5.33.0", "autoprefixer": "^10.4.8", @@ -5693,6 +5695,12 @@ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==" }, + "node_modules/@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", + "dev": true + }, "node_modules/@types/ws": { "version": "8.5.3", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", @@ -27640,6 +27648,12 @@ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==" }, + "@types/uuid": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", + "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", + "dev": true + }, "@types/ws": { "version": "8.5.3", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.3.tgz", diff --git a/package.json b/package.json index 42b498d..bed4117 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "typeface-public-sans": "^1.1.13", "typeface-roboto": "^1.1.13", "typescript": "^4.7.4", + "uuid": "^8.3.2", "web-vitals": "^2.1.4" }, "scripts": { @@ -59,6 +60,7 @@ ] }, "devDependencies": { + "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^5.33.0", "@typescript-eslint/parser": "^5.33.0", "autoprefixer": "^10.4.8", diff --git a/src/pages/Home/Home.tsx b/src/pages/Home/Home.tsx index efc1a69..eddcef9 100644 --- a/src/pages/Home/Home.tsx +++ b/src/pages/Home/Home.tsx @@ -1,7 +1,16 @@ -import React from 'react' +import React, { useState } from 'react' 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 handleRoomNameChange = (event: React.ChangeEvent) => { + const { value } = event.target + setRoomName(value) + } + return (
@@ -15,6 +24,15 @@ export function Home() { chitchatter is still a work in progress and not yet ready to be used!
+
+ +
) }