-
Notifications
You must be signed in to change notification settings - Fork 0
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/topic create page #147
Conversation
✅ Deploy Preview for offonoff-ab ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
width: 111px; | ||
height: 18px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
width랑 height 고정한거 content에 따라 크기 변경되도록 수정해주세요
import { Register } from '@tanstack/react-query'; | ||
import React, { useRef, useState } from 'react'; | ||
import { RegisterOptions, useFormContext } from 'react-hook-form'; | ||
import { CONFIG, INPUT_TYPE, InputType } from 'src/constants/form'; | ||
|
||
import { Col, Row } from '@components/commons/Flex/Flex'; | ||
import Text from '@components/commons/Text/Text'; | ||
|
||
import { colors } from '@styles/theme'; | ||
|
||
import { RotateIcon } from '@icons/index'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사용되지 않은 imports 구문 삭제하면 좋을 것 같아요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ImageInputComponent = ({ label, imageUrl, setImageUrl }) => {
const handleFileChange = (event) => {
const file = event.target.files?.[0];
if (!file) return;
const reader = new FileReader();
reader.onloadend = () => setImageUrl(reader.result as string);
reader.readAsDataURL(file);
};
return (
<ImageInputContainer onClick={() => this.ImageInput.click()}>
{imageUrl && <Image src={imageUrl} alt={`Image ${label}`} />}
{!imageUrl && (
<ImageInputDescriptionContainer>
<Text size={15} weight={500} color={colors.white} align="center">
이미지
<br />
가져오기
</Text>
</ImageInputDescriptionContainer>
)}
<ImageInputTextContainer>
<Text size={180} weight={900} color={colors[`${label}_40`]} lineHeight={0.7}>
{label}
</Text>
</ImageInputTextContainer>
<ImageInput
ref={(input) => (this.ImageInput = input)}
type="file"
accept="image/*"
onChange={handleFileChange}
/>
</ImageInputContainer>
);
};
이렇게 이미지 인풋 컴포넌트를 분리하고
const [images, setImages] = useState({ A: null, B: null });
...
<Row gap={8} justifyContent="center">
{['A', 'B'].map((label) => (
<ImageInputComponent
key={label}
label={label}
imageUrl={images[label]}
setImageUrl={setImageUrl(label)}
/>
))}
</Row>
중복되는 코드를 개선해보면 어떨까요?
src/constants/form.ts
Outdated
TOPICTITLE: 'topicTitle', | ||
ATOPIC: 'aTopic', | ||
BTOPIC: 'bTopic', | ||
TOPICCATEGORY: 'topicCategory', | ||
} as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TOPIC_TITLE
, A_TOPIC
, TOPIC_CATEGORY
로 바꾸는게 좋아보여요
}; | ||
return ( | ||
<Col gap={16}> | ||
<Row gap={83} justifyContent="space-between"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TopicCreateTextInput
도 마찬가지로 수정 부탁드립니다
39ef5e8
to
5f43c70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
What is this PR? 🔍
🛠️ Issue
Changes 📝
To Reviewers 📢