diff --git a/src/components/layout/Modal.tsx b/src/components/layout/Modal.tsx index 4af80f45..6307e100 100644 --- a/src/components/layout/Modal.tsx +++ b/src/components/layout/Modal.tsx @@ -63,6 +63,6 @@ const ModalBox = styled.div` flex-direction: column; justify-content: center; align-items: center; - top: 20rem; + top: 16rem; padding: 9rem 3rem 7rem 3rem; `; diff --git a/src/components/login/Avater.tsx b/src/components/login/Avater.tsx index c79a1f2b..39ba20d2 100644 --- a/src/components/login/Avater.tsx +++ b/src/components/login/Avater.tsx @@ -4,19 +4,38 @@ import MyAvatar from '../../assets/avatar/MyAvatar'; import UserStore from '../../stores/userStore'; export default function Avater() { - const { avatar } = UserStore(); + const { avatar, setAvatar } = UserStore(); + const onClick = () => { + const randomNumber = Math.floor(Math.random() * 30) + 1; // 1~30 사이 정수 생성 + setAvatar(JSON.stringify(randomNumber)); + console.log(avatar); + }; return ( + ); } const AvatarContainer = styled.div` - height: 4rem; - width: 17rem; + height: 23rem; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; svg { - width: 100%; - height: 100%; + width: 80%; + height: 80%; } `; + +const Button = styled.button` + width: 80%; + font-size: 1.5rem; + background-color: white; + margin-top: 2rem; + cursor: pointer; +`; diff --git a/src/components/login/Buttons.tsx b/src/components/login/Buttons.tsx deleted file mode 100644 index 3f93b511..00000000 --- a/src/components/login/Buttons.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; -import styled from 'styled-components'; -import UserStore from '../../stores/userStore'; - -export default function Buttons() { - const { avatar, setAvatar } = UserStore(); - const onClick = () => { - const randomNumber = Math.floor(Math.random() * 30) + 1; // 1~30 사이 정수 생성 - setAvatar(JSON.stringify(randomNumber)); - console.log(avatar); - }; - return ( - - - - - ); -} - -const Component = styled.div` - display: flex; - align-items: center; - justify-content: space-between; - width: 100%; -`; - -const Button = styled.button` - font-size: 1.5rem; - background-color: white; - margin-top: 2rem; - cursor: pointer; -`; diff --git a/src/components/login/LoginModal.tsx b/src/components/login/LoginModal.tsx index 3a3bfc8d..1e9fcab2 100644 --- a/src/components/login/LoginModal.tsx +++ b/src/components/login/LoginModal.tsx @@ -12,7 +12,7 @@ export default function LoginModal({ return ( <> - + diff --git a/src/components/login/Nickname.tsx b/src/components/login/Nickname.tsx new file mode 100644 index 00000000..eaec1ec9 --- /dev/null +++ b/src/components/login/Nickname.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import styled from 'styled-components'; + +export default function Nickname({ + newNickname, + getData, +}: { + newNickname: string; + getData: (_newNickname: string) => void; +}) { + const onChange = (event: React.ChangeEvent) => { + getData(event.target.value); + }; + + return ( + + + + + ); +} + +const Component = styled.div` + display: flex; + flex-direction: column; + align-items: flex-end; + justify-content: center; + height: 12rem; + width: 25rem; +`; + +const Input = styled.input` + background-color: rgb(30, 41, 75); + color: white; + font-size: 1.7rem; + text-justify: center; + padding-left: 1rem; + width: 100%; +`; + +const Button = styled.button` + font-family: PretendardRegular; + font-weight: 600; + height: 6rem; + width: 100%; + border-radius: 0.8rem; + font-size: 1.5rem; + background-color: white; + margin-top: 2rem; + cursor: pointer; +`; diff --git a/src/components/login/UserInput.tsx b/src/components/login/UserInput.tsx index 942e4452..833537bf 100644 --- a/src/components/login/UserInput.tsx +++ b/src/components/login/UserInput.tsx @@ -5,7 +5,7 @@ import styled from 'styled-components'; import { v4 as uuidv4 } from 'uuid'; import UserStore from '../../stores/userStore'; import Avater from './Avater'; -import Buttons from './Buttons'; +import Nickname from './Nickname'; export default function UserInput({ modalHandler, @@ -15,7 +15,10 @@ export default function UserInput({ const navigate = useNavigate(); const { nickname, uid, avatar, setNickname, setUid } = UserStore(); const [newNickname, setNewNickname] = useState(nickname); - console.log('newnickname ', newNickname); + const getData = (newNickname) => { + setNewNickname(newNickname); + }; + useEffect(() => { if (!localStorage.getItem('uid')) { const newUID = uuidv4(); @@ -43,7 +46,6 @@ export default function UserInput({ const onSubmit = (event: React.FormEvent) => { event.preventDefault(); if (newNickname === null) { - console.log('으악'); return false; } // socket connection @@ -61,57 +63,38 @@ export default function UserInput({ return true; }; - const onChange = (event: React.ChangeEvent) => { - setNewNickname(event.target.value); - }; - return (
- + - {/* */} ); } const Form = styled.form` - margin-top: 15rem; + margin-top: 4rem; display: flex; flex-direction: column; - align-items: center; + /* align-items: flex-end; */ justify-content: center; z-index: 1001; - width: 35rem; - button, - input { + /* width: 40rem; */ + input, + button { font-family: PretendardRegular; font-weight: 600; height: 6rem; - width: 17rem; border-radius: 0.8rem; } `; const Settings = styled.div` + gap: 3rem; display: flex; - align-items: center; + align-items: flex-end; justify-content: space-between; width: 100%; `; - -const Input = styled.input` - background-color: rgb(30, 41, 75); - color: white; - font-size: 1.7rem; - text-justify: center; - padding-left: 1rem; -`;