Skip to content
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

feat: tag 추가하기 버튼 추가 및 css 수정 #309

Merged
merged 2 commits into from
Jun 2, 2024
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
2 changes: 2 additions & 0 deletions src/components/main/createRoomModal/CreateRoomForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function CreateRoomForm({
onClickTheme,
onClickTotal,
isDisable,
onAddTag,
}) {
const { title, details, total, newTag, tags, isPublic, password } = inputs;

Expand All @@ -34,6 +35,7 @@ export default function CreateRoomForm({
onChange={onChange}
onKeyPress={onKeyPress}
onDeleteTag={onDeleteTag}
onAddTag={onAddTag}
/>
</Section>
<Total total={total} onClickTotal={onClickTotal} />
Expand Down
2 changes: 2 additions & 0 deletions src/components/main/createRoomModal/CreateRoomModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function CreateRoomModal({
onClickTheme,
onClickTotal,
isDisable,
onAddTag,
} = useCreateRoom({ closeCreateRoom });

const { isLoading, mutate } = useRoomCreator();
Expand Down Expand Up @@ -49,6 +50,7 @@ export default function CreateRoomModal({
onClickTheme={onClickTheme}
onClickTotal={onClickTotal}
isDisable={isDisable}
onAddTag={onAddTag}
/>
</ModalBox>
</ModalBackground>
Expand Down
24 changes: 24 additions & 0 deletions src/components/main/createRoomModal/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default function TagsComponent({
onChange,
onKeyPress,
onDeleteTag,
onAddTag,
}) {
return (
<>
Expand All @@ -32,6 +33,9 @@ export default function TagsComponent({
onKeyPress={onKeyPress}
placeholder="태그 입력 후 엔터"
/>
<AddTagButton type="button" onClick={onAddTag}>
태그 등록
</AddTagButton>
</TagComponent>
</>
);
Expand Down Expand Up @@ -89,3 +93,23 @@ const TagName = styled.div`
color: rgba(69, 178, 107, 1);
font-family: IBMPlexSansKRRegular, Arial;
`;

const AddTagButton = styled.button`
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
width: 8rem;
height: 4rem;
font-size: 1.4rem;
align-items: center;
border-radius: 0.6rem;
background-color: rgb(51, 55, 69);
color: #bdbdbd;
padding: 0.5rem 1rem;

cursor: pointer;
&:hover {
background-color: rgb(72, 77, 96);
}
`;
39 changes: 23 additions & 16 deletions src/components/main/createRoomModal/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,20 @@ export default function Theme({ onClickTheme }) {
</SelectIcon>
</SelectButton>
{isDropDown && (
<DropDown data-cy="create-room-modal-theme-dropdown">
{themeJson.map((theme) => (
<Option
value={theme.value}
key={theme.value}
onClick={onClickOption}
type="button"
>
{theme.name}
</Option>
))}
</DropDown>
<DropDownPosition>
<DropDown data-cy="create-room-modal-theme-dropdown">
{themeJson.map((theme) => (
<Option
value={theme.value}
key={theme.value}
onClick={onClickOption}
type="button"
>
{theme.name}
</Option>
))}
</DropDown>
</DropDownPosition>
)}
{error && <Error />}
</Component>
Expand Down Expand Up @@ -99,16 +101,21 @@ const SelectIcon = styled.div`
width: 5%;
`;

const DropDown = styled.div`
const DropDownPosition = styled.div`
position: absolute;
top: 8.4rem;
left: 0;
width: 100%;
overflow: hidden;
z-index: 1;
`;

const DropDown = styled.div`
background-color: #191f28;
border-radius: 0.6rem;
top: 8.9rem;
z-index: 2;
@keyframes dropdown {
0% {
transform: translateY(-5%);
transform: translateY(-100%);
}
100% {
transform: translateY(0);
Expand Down
37 changes: 22 additions & 15 deletions src/components/main/createRoomModal/Total.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,19 @@ export default function Total({ total, onClickTotal }) {
</SelectIcon>
</SelectButton>
{isDropDown && (
<DropDown data-cy="create-room-modal-total-dropdown">
<Option onClick={onClickOption} type="button">
2
</Option>
<Option onClick={onClickOption} type="button">
3
</Option>
<Option onClick={onClickOption} type="button">
4
</Option>
</DropDown>
<DropDownPosition>
<DropDown data-cy="create-room-modal-total-dropdown">
<Option onClick={onClickOption} type="button">
2
</Option>
<Option onClick={onClickOption} type="button">
3
</Option>
<Option onClick={onClickOption} type="button">
4
</Option>
</DropDown>
</DropDownPosition>
)}
{error && <Error />}
</Component>
Expand Down Expand Up @@ -99,16 +101,21 @@ const SelectIcon = styled.div`
width: 5%;
`;

const DropDown = styled.div`
const DropDownPosition = styled.div`
position: absolute;
top: 8.4rem;
left: 0;
width: 100%;
overflow: hidden;
z-index: 1;
`;

const DropDown = styled.div`
background-color: #191f28;
border-radius: 0.6rem;
top: 8.9rem;
z-index: 2;
@keyframes dropdown {
0% {
transform: translateY(-5%);
transform: translateY(-100%);
}
100% {
transform: translateY(0);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useCreateRoom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ export default function useCreateRoom({
const onSubmit = () => {
if (isDisable()) return;
const { mutate } = useRoomCreator();
console.log(inputs);
mutate();
};

return {
inputs,
onAddTag,
onChange,
onKeyPress,
onDeleteTag,
Expand Down