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/topic create page #147

Merged
merged 39 commits into from
Feb 8, 2024
Merged

Feat/topic create page #147

merged 39 commits into from
Feb 8, 2024

Conversation

chaeyoung103
Copy link
Collaborator

@chaeyoung103 chaeyoung103 commented Jan 26, 2024

What is this PR? 🔍

  • B topic 생성 페이지를 생성 하였습니다.

🛠️ Issue

Changes 📝

  • 전체적인 컴포넌트 생성
  • textinput, imageinput 추가
스크린샷 2024-01-26 오후 3 36 53 스크린샷 2024-01-26 오후 3 36 58 스크린샷 2024-01-26 오후 3 37 10

To Reviewers 📢

  • 보완할 부분이 있으면 review 남겨주세요

Copy link

netlify bot commented Jan 26, 2024

Deploy Preview for offonoff-ab ready!

Name Link
🔨 Latest commit 5f43c70
🔍 Latest deploy log https://app.netlify.com/sites/offonoff-ab/deploys/65c473e83180ec0007a93350
😎 Deploy Preview https://deploy-preview-147--offonoff-ab.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Comment on lines 11 to 12
width: 111px;
height: 18px;
Copy link
Member

Choose a reason for hiding this comment

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

width랑 height 고정한거 content에 따라 크기 변경되도록 수정해주세요

Comment on lines 1 to 11
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';
Copy link
Member

Choose a reason for hiding this comment

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

사용되지 않은 imports 구문 삭제하면 좋을 것 같아요

Copy link
Member

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>

중복되는 코드를 개선해보면 어떨까요?

Comment on lines 12 to 16
TOPICTITLE: 'topicTitle',
ATOPIC: 'aTopic',
BTOPIC: 'bTopic',
TOPICCATEGORY: 'topicCategory',
} as const;
Copy link
Member

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">
Copy link
Member

Choose a reason for hiding this comment

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

width: 100% + space-between이라서 gap 속성이 없어도 될 것 같아요

image

화면이 좁아졌을 때 줄바꿈이 되는 문제가 발생해서요

Copy link
Member

Choose a reason for hiding this comment

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

TopicCreateTextInput도 마찬가지로 수정 부탁드립니다

Copy link
Member

@Jinho1011 Jinho1011 left a comment

Choose a reason for hiding this comment

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

LGTM!

@Jinho1011 Jinho1011 merged commit 311549f into dev Feb 8, 2024
5 checks passed
@Jinho1011 Jinho1011 deleted the feat/topic-create-page branch February 8, 2024 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A, B 로고 이미지 색상 이상함 토픽 생성 화면 구현
2 participants