Skip to content

Fire 234 fe rooms map 으로 UI 구성 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/lobby/Room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Room() {

return (
<Component>
{rooms.map(({ id, name, total, current, image }: roomInterface) => {
{rooms.map(({ id, name, total, current, image, tags }: roomInterface) => {
return (
<RoomBlock
key={id}
Expand All @@ -28,6 +28,7 @@ export default function Room() {
current={current}
image={image}
id={id}
tags={tags}
/>
);
})}
Expand Down
67 changes: 59 additions & 8 deletions src/components/lobby/RoomBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function RoomBlock({
current,
image,
id,
tags,
}: roomInterface) {
/*
socket.emit('ENTER_ROOM', payload, (confirmRoomId) => {
Expand All @@ -28,31 +29,63 @@ export default function RoomBlock({
return (
<Button onClick={onSubmit} image={image}>
<Information>
<div>{name}</div>
<div>
{current} / {total}
</div>
<Top>
<RoomName>{name}</RoomName>
<UserNumber>
{current} / {total}
</UserNumber>
</Top>
<Tags>
{tags.map((tag: string) => {
return <Tag key={tag}>{tag}</Tag>;
})}
</Tags>
</Information>
</Button>
);
}

const Information = styled.div`
font-size: 3rem;
display: flex;
flex-direction: row;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
align-items: center;
padding: 2rem;
height: 100%;
color: white;
background-color: rgb(0, 0, 0, 28%);
border-radius: 3rem;
&:hover {
background-color: rgb(0, 0, 0, 60%);
}
transition: all ease 0.5s;
`;

const Top = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
`;

const RoomName = styled.span`
font-size: 4rem;
`;

const UserNumber = styled.span`
font-size: 2rem;
background-color: rgba(250, 250, 250, 60%);
border-radius: 1rem;
padding: 0.5rem;
color: black;
`;

const Button = styled.button<Props>`
text-align: center;
width: 22vw;
height: 22vw;
background-color: darkGray;
background-color: lightGray;
background-image: url(${(props) => props.image});
background-position: center;
cursor: pointer;
Expand All @@ -67,3 +100,21 @@ const Button = styled.button<Props>`
height: 60vw;
}
`;

const Tags = styled.ul`
width: 100%;
display: felx;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
`;

const Tag = styled.li`
margin-right: 1rem;
font-size: 2rem;
background-color: rgba(250, 250, 250, 60%);
border-radius: 1rem;
padding: 0.5rem;
color: black;
margin-top: 1rem;
`;
1 change: 1 addition & 0 deletions src/interface/room.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export default interface roomInterface {
current: number;
id: string;
image: string;
tags: [];
}
56 changes: 38 additions & 18 deletions src/rooms.json
Original file line number Diff line number Diff line change
@@ -1,65 +1,85 @@
[
{
"name": "room1",
"name": "리액트가즈아",
"total": 4,
"current": 0,
"id": "1",
"image": "https://user-images.githubusercontent.com/64428916/177264713-936644da-69c0-48a0-b999-bc710852bf6d.png"
"image": "https://user-images.githubusercontent.com/64428916/177264713-936644da-69c0-48a0-b999-bc710852bf6d.png",
"tags": [
"react",
"coding",
"react",
"coding",
"react",
"coding",
"react",
"coding",
"react",
"coding"
]
},
{
"name": "room2",
"name": "아무나",
"total": 4,
"current": 0,
"id": "2",
"image": "https://user-images.githubusercontent.com/64428916/177262016-da086f2f-a9f0-4368-a9f3-99888e835438.png"
"image": "https://user-images.githubusercontent.com/64428916/177262016-da086f2f-a9f0-4368-a9f3-99888e835438.png",
"tags": ["react", "coding"]
},
{
"name": "room3",
"name": "잘못해요 고수만",
"total": 4,
"current": 0,
"id": "3",
"image": "https://user-images.githubusercontent.com/64428916/177264995-18de6a5d-8ff8-474e-ac1c-2fe62227edbd.png"
"image": "https://user-images.githubusercontent.com/64428916/177264995-18de6a5d-8ff8-474e-ac1c-2fe62227edbd.png",
"tags": ["react", "coding"]
},
{
"name": "room4",
"name": "코딩윗미",
"total": 4,
"current": 0,
"id": "4",
"image": "https://user-images.githubusercontent.com/64428916/177265172-5085a569-8223-406a-ba96-1684980b0736.png"
"image": "https://user-images.githubusercontent.com/64428916/177265172-5085a569-8223-406a-ba96-1684980b0736.png",
"tags": ["react", "coding"]
},
{
"name": "room5",
"name": "모도코 흥해랏",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋ 👍

"total": 4,
"current": 0,
"id": "5",
"image": "https://user-images.githubusercontent.com/64428916/177265398-a1da8497-35d1-492c-bbc6-b0efc43fe0af.png"
"image": "https://user-images.githubusercontent.com/64428916/177265398-a1da8497-35d1-492c-bbc6-b0efc43fe0af.png",
"tags": ["react", "coding"]
},
{
"name": "room6",
"name": "코알못",
"total": 4,
"current": 0,
"id": "6",
"image": "https://user-images.githubusercontent.com/64428916/177265411-c12959f5-57a9-436e-b1a2-c7ef8aa084ae.png"
"image": "https://user-images.githubusercontent.com/64428916/177265411-c12959f5-57a9-436e-b1a2-c7ef8aa084ae.png",
"tags": ["react", "coding"]
},
{
"name": "room7",
"name": "백준풀장",
"total": 4,
"current": 0,
"id": "7",
"image": "https://user-images.githubusercontent.com/64428916/177265422-cf858716-bef9-4630-ac50-6a0167f0ae77.png"
"image": "https://user-images.githubusercontent.com/64428916/177265422-cf858716-bef9-4630-ac50-6a0167f0ae77.png",
"tags": ["react", "coding"]
},
{
"name": "room8",
"name": "선배님들 질문좀",
"total": 4,
"current": 0,
"id": "8",
"image": "https://user-images.githubusercontent.com/64428916/177265759-b292de9d-ab0f-4114-8e06-871000c34d42.png"
"image": "https://user-images.githubusercontent.com/64428916/177265759-b292de9d-ab0f-4114-8e06-871000c34d42.png",
"tags": ["react", "coding"]
},
{
"name": "room9",
"name": "자유방",
"total": 4,
"current": 0,
"id": "9",
"image": "https://user-images.githubusercontent.com/64428916/177265430-d40732e8-7a70-4e2c-8cdf-780e6d45dff7.png"
"image": "https://user-images.githubusercontent.com/64428916/177265430-d40732e8-7a70-4e2c-8cdf-780e6d45dff7.png",
"tags": ["react", "coding"]
}
]