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/#473] admin 글감 반응형 구현 #485

Merged
merged 17 commits into from
Dec 7, 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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.env
.env

Comment on lines +26 to +27
Copy link
Member

Choose a reason for hiding this comment

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

[p4] 요건 뭔가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

빌드할 때 데이터 셋이 어떻게 분리되어있는지 보여주는 파일이 생기는데, 해당 파일의 용량이 크기도 하고 빌드할 때마다 생겨서 gitignore에 추가해줬습니다!

stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import styled from '@emotion/styled';
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
import { useParams } from 'react-router-dom';

import { useEditAdminTopic, usePostAdminTopic } from '../hooks/queries';

import Spacing from '../../../components/commons/Spacing';
import { useEditAdminTopic, usePostAdminTopic } from '../../../pages/admin/hooks/queries';
import { MOBILE_MEDIA_QUERY } from '../../../styles/mediaQuery';

interface topicPropTypes {
topicStored?: string;
Expand All @@ -13,15 +13,21 @@ interface topicPropTypes {
topicId?: string;
pageNum: number;
setShowModal: Dispatch<SetStateAction<boolean>>;
topicPlaceholder?: string;
tagPlaceholder?: string;
descPlaceholder?: string;
}

const AddEditTopicModal = ({
const InputModal = ({
topicStored,
topicTagStored,
topicDescriptionStored,
topicId,
pageNum,
setShowModal,
topicPlaceholder,
tagPlaceholder,
descPlaceholder,
}: topicPropTypes) => {
useEffect(() => {
setTopic(topicStored || '');
Expand All @@ -41,12 +47,12 @@ const AddEditTopicModal = ({
const { postMutateAdminTopic } = usePostAdminTopic(groupId, pageNum);
const { editMutateAdminTopic } = useEditAdminTopic(topicId, groupId, pageNum);

const handleTopicNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const handleTopicNameChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
setTopic(e.target.value);
setTopicNameError(false); //다시 입력할때의 초기화
};

const handleTopicTagChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const handleTopicTagChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
setTopicTag(e.target.value);
setTopicTagError(false);
};
Expand Down Expand Up @@ -81,7 +87,7 @@ const AddEditTopicModal = ({
<Spacing marginBottom="1.2" />
<InputWrapper isError={topic.length > 15 || topicNameError}>
<TopicInput
placeholder="함께 작성하고 싶은 글감을 입력해주세요. ex) 마음이 담긴 선물"
placeholder={topicPlaceholder}
value={topic}
onChange={handleTopicNameChange}
maxLength={16}
Expand All @@ -94,7 +100,7 @@ const AddEditTopicModal = ({
<Spacing marginBottom="1.2" />
<InputWrapper isError={topicTag.length > 5 || topicTagError}>
<TopicInput
placeholder="위에 적은 글감을 한 단어로 요약해주세요. ex) 선물"
placeholder={tagPlaceholder}
value={topicTag}
onChange={handleTopicTagChange}
maxLength={6}
Expand All @@ -107,7 +113,7 @@ const AddEditTopicModal = ({
<Spacing marginBottom="1.2" />
<TextAreaWrapper isError={topicDescription.length > 90 || topicDescriptionError}>
<TopicDescriptionInput
placeholder={`글감에 대해 자유롭게 소개해주세요\nex) 마음이 담긴 선물을 주거나 받은 기억을 떠올려보세요.\n그 순간이 당신에게 어떤 의미로 남았는지 이야기해주세요.`}
placeholder={descPlaceholder}
onChange={handleTopicDescriptionChange}
value={topicDescription}
maxLength={91}
Expand All @@ -125,7 +131,7 @@ const AddEditTopicModal = ({
);
};

export default AddEditTopicModal;
export default InputModal;

const ModalWrapper = styled.div`
position: fixed;
Expand All @@ -140,8 +146,17 @@ const ModalWrapper = styled.div`

background-color: ${({ theme }) => theme.colors.white};
transform: translate(-50%, -50%);
${({ theme }) => theme.fonts.subtitle2}
border-radius: 8px;

${({ theme }) => theme.fonts.subtitle2}

@media ${MOBILE_MEDIA_QUERY} {
gap: 1.8rem;
max-width: 33.5rem;
padding: 1.8rem;

${({ theme }) => theme.fonts.mTitle1};
}
`;

const InputWrapper = styled.div<{ isError: boolean }>`
Expand All @@ -156,11 +171,21 @@ const InputWrapper = styled.div<{ isError: boolean }>`
border: 1px solid
${({ theme, isError }) => (isError ? theme.colors.mileRed : theme.colors.gray50)};
border-radius: 6px;

@media ${MOBILE_MEDIA_QUERY} {
align-items: end;
justify-content: baseline;
width: 100%;
min-height: 6rem;
padding: 1rem 1.3rem;
}
`;

const TopicInput = styled.input`
const TopicInput = styled.textarea`
width: 46.4rem;
height: 100%;
padding: 0;
overflow: hidden;

color: ${({ theme }) => theme.colors.gray100};

Expand All @@ -171,6 +196,13 @@ const TopicInput = styled.input`

::placeholder {
color: ${({ theme }) => theme.colors.gray50};
white-space: pre-line;

@media ${MOBILE_MEDIA_QUERY} {
min-height: 4rem;

${({ theme }) => theme.fonts.mSubtitle2};
}
}
`;

Expand All @@ -184,30 +216,44 @@ const SubmitForm = styled.button`
background-color: ${({ theme }) => theme.colors.mainViolet};
${({ theme }) => theme.fonts.button2}
border-radius: 10px;

@media ${MOBILE_MEDIA_QUERY} {
width: 100%;
height: 4.4rem;
padding: 1rem 2rem;
${({ theme }) => theme.fonts.mButton1};
}
`;

const TopicDescriptionInput = styled.textarea<{ isError: boolean }>`
width: 52.8rem;
height: 7.8rem;
overflow: scroll;

color: ${({ theme }) => theme.colors.gray100};
${({ theme }) => theme.fonts.button2}

background-color: ${({ theme }) => theme.colors.gray5};
border: 1px solid
${({ theme, isError }) => (isError ? theme.colors.mileRed : theme.colors.gray50)};
border: none;
border-radius: 6px;

resize: none;

::placeholder {
color: ${({ theme }) => theme.colors.gray50};

@media ${MOBILE_MEDIA_QUERY} {
${({ theme }) => theme.fonts.mSubtitle2};
}
}

:focus {
outline: none;
}

@media ${MOBILE_MEDIA_QUERY} {
width: 100%;
}
`;

const TextAreaWrapper = styled.div<{ isError: boolean }>`
Expand All @@ -222,9 +268,17 @@ const TextAreaWrapper = styled.div<{ isError: boolean }>`
border: 1px solid
${({ theme, isError }) => (isError ? theme.colors.mileRed : theme.colors.gray50)};
border-radius: 6px;

@media ${MOBILE_MEDIA_QUERY} {
width: 100%;
}
`;

const TextCount = styled.div<{ isError: boolean }>`
${({ theme }) => theme.fonts.button3}
color: ${({ theme, isError }) => (isError ? theme.colors.mileRed : theme.colors.gray70)};

@media ${MOBILE_MEDIA_QUERY} {
${({ theme }) => theme.fonts.mButton1};
}
`;
7 changes: 7 additions & 0 deletions src/constants/modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const ADMIN = {
PLACEHOLER: {
TOPIC: '함께 작성하고 싶은 글감을 입력해주세요. ex) 마음이 담긴 선물',
TAG: '위에 적은 글감을 한 단어로 요약해주세요. ex) 선물',
DESC: `글감에 대해 자유롭게 소개해주세요.\nex) 마음이 담긴 선물을 주거나 받은 기억을 떠올려보세요. 그 순간이 당신에게 어떤 의미로 남았는지 이야기해주세요.`,
},
};
Loading
Loading