Skip to content

Commit d3d07d3

Browse files
authored
Merge pull request #39 from SWM-FIRE/FIRE-277-fe-모달창-interactions-추가하기
Fire 277 fe 모달창 interactions 추가하기
2 parents 79b5d79 + 7ac733e commit d3d07d3

File tree

4 files changed

+148
-220
lines changed

4 files changed

+148
-220
lines changed

src/components/atoms/Modal.tsx

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import React from 'react';
2+
import styled from 'styled-components';
3+
import vectors from './Vectors';
4+
5+
export default function Modal({
6+
modalHandler,
7+
children,
8+
}: {
9+
modalHandler: () => void;
10+
children: any;
11+
}) {
12+
return (
13+
<ModalBackground onClick={modalHandler}>
14+
<ModalBox onClick={(e) => e.stopPropagation()}>
15+
<VectorX
16+
src={vectors.X}
17+
left={93}
18+
top={6}
19+
size={2}
20+
onClick={modalHandler}
21+
/>
22+
{children}
23+
</ModalBox>
24+
</ModalBackground>
25+
);
26+
}
27+
28+
interface Position {
29+
size?: number;
30+
left?: number;
31+
top: number;
32+
right?: number;
33+
}
34+
35+
const ModalBackground = styled.div`
36+
position: fixed;
37+
width: 100%;
38+
height: 100%;
39+
background-color: rgba(0, 0, 0, 0.7);
40+
justify-content: center;
41+
align-items: center;
42+
top: 0;
43+
display: flex;
44+
z-index: 999;
45+
`;
46+
47+
const VectorX = styled.img<Position>`
48+
position: absolute;
49+
width: ${(props) => props.size}rem;
50+
left: ${(props) => props.left}%;
51+
top: ${(props) => props.top}%;
52+
cursor: pointer;
53+
`;
54+
55+
const ModalBox = styled.div`
56+
position: fixed;
57+
background-color: rgb(22, 29, 52);
58+
border-radius: 1rem;
59+
display: flex;
60+
width: 842px;
61+
flex-direction: column;
62+
justify-content: center;
63+
align-items: center;
64+
top: 20rem;
65+
padding: 9rem 3rem 7rem 3rem;
66+
`;

src/components/layout/Modal.tsx

-197
This file was deleted.

src/components/login/InputNickname.tsx

+74-20
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useNavigate } from 'react-router-dom';
44
import styled from 'styled-components';
55
import { v4 as uuidv4 } from 'uuid';
66
import UserStore from '../../stores/userStore';
7+
import vectors from '../atoms/Vectors';
78

89
export default function InputNickname() {
910
const navigate = useNavigate();
@@ -48,51 +49,104 @@ export default function InputNickname() {
4849
// socket.emit('ENTER_ROOM', payload, (confirmRoomId) => {
4950
// navigate(`screens`);
5051
// });
51-
navigate(`lobby`);
52+
navigate(`/`);
5253
};
5354

5455
const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {
5556
setNickname(event.target.value);
5657
};
5758

5859
return (
59-
<Form onSubmit={onSubmit}>
60-
<Input
61-
autoComplete="off"
62-
value={nickname}
63-
onChange={onChange}
64-
placeholder="Enter ID"
65-
id="nickname"
66-
/>
67-
<Button disabled={nickname === null || !nickname.length}>Enter</Button>
68-
</Form>
60+
<>
61+
<Vector src={vectors.Lamp} left={0} top={0} size={40} />
62+
<Vector src={vectors.Book} left={28.7} top={14.4} size={60} />
63+
<Message>
64+
<TitleLogo>
65+
모여서 도란도란 코딩,<span>Modoco</span>
66+
</TitleLogo>
67+
<TitleStart>시작하기</TitleStart>
68+
</Message>
69+
<Form onSubmit={onSubmit}>
70+
<Input
71+
autoComplete="off"
72+
value={nickname}
73+
onChange={onChange}
74+
placeholder="Enter ID"
75+
id="nickname"
76+
/>
77+
<Button disabled={nickname === null || !nickname.length}>Enter</Button>
78+
{/* <Button>GitHub 계정</Button> */}
79+
</Form>
80+
</>
6981
);
7082
}
7183

84+
interface Position {
85+
size?: number;
86+
left?: number;
87+
top: number;
88+
right?: number;
89+
}
90+
91+
const Vector = styled.img<Position>`
92+
position: absolute;
93+
width: ${(props) => props.size}rem;
94+
left: ${(props) => props.left}%;
95+
top: ${(props) => props.top}%;
96+
opacity: 0.5;
97+
z-index: 1000;
98+
`;
99+
100+
const Message = styled.div`
101+
display: flex;
102+
flex-direction: column;
103+
justify-content: center;
104+
align-items: center;
105+
color: white;
106+
width: 100%;
107+
z-index: 1001;
108+
`;
109+
110+
const TitleLogo = styled.div`
111+
font-size: 18px;
112+
font-family: IBMPlexMonoRegular;
113+
`;
114+
115+
const TitleStart = styled.div`
116+
font-family: Pretendard;
117+
font-weight: 500;
118+
font-size: 4rem;
119+
margin-top: 2rem;
120+
`;
121+
72122
const Form = styled.form`
73-
margin-top: 10rem;
123+
margin-top: 15rem;
74124
display: flex;
75125
flex-direction: column;
76126
align-items: center;
77127
justify-content: center;
78-
128+
z-index: 1001;
79129
button,
80130
input {
81-
height: 5rem;
82-
border-radius: 0.5rem;
83-
width: 100%;
84-
max-width: 30rem;
85-
font-size: 2rem;
86-
box-shadow: 2px 2px rgb(0 0 0 / 18%);
131+
font-family: Pretendard;
132+
font-weight: 600;
133+
height: 6rem;
134+
width: 40rem;
135+
border-radius: 0.8rem;
87136
}
88137
`;
89138

90139
const Button = styled.button`
91-
background-color: #fbeaeb;
140+
font-size: 1.5rem;
141+
background-color: white;
92142
margin-top: 2rem;
143+
cursor: pointer;
93144
`;
94145

95146
const Input = styled.input`
147+
background-color: rgb(30, 41, 75);
148+
color: white;
149+
font-size: 1.7rem;
96150
text-justify: center;
97151
padding-left: 1rem;
98152
`;

0 commit comments

Comments
 (0)