From bb7477bd3be681971f80ee75aa10f3e7f723aae9 Mon Sep 17 00:00:00 2001 From: Haaaan1 Date: Wed, 15 May 2024 15:46:59 +0200 Subject: [PATCH] Modified number input in room creation #107 --- src/components/views/Lobby.tsx | 21 ++++------ src/styles/views/Lobby.scss | 74 +++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 15 deletions(-) diff --git a/src/components/views/Lobby.tsx b/src/components/views/Lobby.tsx index 4ea8514..07ba3a6 100644 --- a/src/components/views/Lobby.tsx +++ b/src/components/views/Lobby.tsx @@ -1,5 +1,6 @@ import React, { useCallback, useRef, useEffect, useState } from "react"; import { api } from "helpers/api"; +import CustomNumberInput from "components/ui/CustomNumberInput"; import { Button } from "components/ui/Button"; import { throttle } from "lodash"; import { useNavigate } from "react-router-dom"; @@ -286,7 +287,6 @@ const Lobby = () => { : changeAvatarPopRef.current.showModal(); }; - const toggleInfoPop = () => { // if the ref is not set, do nothing if (!infoPopRef.current) { @@ -569,24 +569,19 @@ const Lobby = () => { placeholder="Max. 10" value={roomName} onChange={(e) => { - const inputValue = e.target.value; // 获取输入值 - if (inputValue.length <= MAX_ROOM_NAME_LENGTH) { // 检查输入值的长度 - setRoomName(inputValue); // 如果长度小于或等于15,更新状态 + const inputValue = e.target.value; + if (inputValue.length <= MAX_ROOM_NAME_LENGTH) { + setRoomName(inputValue); } }} />
Number of Maximum Players:
- { - const value = parseInt(e.target.value); - // console.error("Value:", value); - SetMaxRoomPlayers(value); - }} +