Skip to content

Comments

[Feature/new post] 커뮤니티 새로운 글 작성 페이지 구현#30

Open
10hajin15 wants to merge 18 commits intomainfrom
feature/NewPost
Open

[Feature/new post] 커뮤니티 새로운 글 작성 페이지 구현#30
10hajin15 wants to merge 18 commits intomainfrom
feature/NewPost

Conversation

@10hajin15
Copy link
Contributor

@10hajin15 10hajin15 commented Dec 31, 2024

📍 PR 타입 (하나 이상 선택)

  • 기능 추가
  • 버그 수정
  • 의존성, 환경 변수, 빌드 관련 코드 업데이트
  • 기타 사소한 수정

❗️ 관련 이슈 [#]

📄 개요

  • 게시판 선택 드롭다운 컴포넌트를 구현하였습니다.
    (기존 컴포넌트 드롭다운은 다중 선택이라 재사용하기 어려운 부분이 있어 새로 구현하였습니다.)
  • markdown으로 글을 작성할 수 있도록 구현하였습니다.

🔁 변경 사항

  1. (up, down)Arrow Icon의 width, height, fill을 props로 받아오도록 수정 (#f42bb4a)
  2. 게시판 선택 드롭다운 (#d289eb8)
  3. Markdown으로 글 작성할 수 있도록 Editor 구현 (#bf9a18b)

📸 스크린샷

스크린샷 2024-12-31 오후 5 07 41

스크린샷 2024-12-31 오후 5 07 48

스크린샷 2024-12-31 오후 6 45 51

스크린샷 2024-12-31 오후 6 46 20

👀 기타 더 이야기해볼 점

  • 단일 선택 가능한 dropdown을 공통 UI 컴포넌트로 구현

Copy link
Contributor

@junhakjh junhakjh left a comment

Choose a reason for hiding this comment

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

이후 메인에 반영될 범용 드롭다운 컴포넌트를 사용하면 좋을 듯 합니다!
요소의 사이즈 관련 css를 설정할 때 px보다는 rem을 지향하면 좋을 것 같아요!
고생하셨습니다 :)

Copy link
Contributor

@okxooxoo okxooxoo left a comment

Choose a reason for hiding this comment

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

하진님 고생하셨습니다 :>

<div className={`text-body2 ${selectedBoard ? 'text-deepgray' : 'text-disabled'}`}>
{selectedBoard || '카테고리'}
</div>
<div className='cursor-pointer' onClick={() => setIsOpen(!isOpen)}>
Copy link
Contributor

Choose a reason for hiding this comment

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

BoardDropdown 바깥을 클릭하면 close 되도록 하는 코드도 추가되면 좋을 것 같습니다! ☺️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

원래는 그런 방식으로 구현을 하였다가, 화살표 아이콘이 명확하게 있어서 화살표 아이콘만 선택해서 드롭다운을 열고 닫고 하는 방식으로 바꾸었습니다. 추후에 공통으로 재사용 가능한 드롭다운을 만들 예정이라 그때 이 부분 반영해서 구현하겠습니다 :)
리뷰 주셔서 감사해요 ☺️

@10hajin15
Copy link
Contributor Author

10hajin15 commented Dec 31, 2024

이후 메인에 반영될 범용 드롭다운 컴포넌트를 사용하면 좋을 듯 합니다! 요소의 사이즈 관련 css를 설정할 때 px보다는 rem을 지향하면 좋을 것 같아요! 고생하셨습니다 :)

안녕하세요 준하님 🙌

  1. 의견 주신대로 재사용한 컴포넌트로 만들면 좋을 것 같아요!
  2. px 대신 rem을 지향하는 의견도 좋다고 생각해요!! 다만, 제가 이번 구현에서 px을 사용한 이유는, 상대 단위는 반응형 디자인에 대응할 수 있지만 아직 반응형 디자인 적용에 대한 명확한 논의가 이루어지지 않아 우선적으로 피그마에서 구현된 디자인을 충실히 구현하고자 px 단위를 사용했습니다. 추후에 제가 맡은 다른 페이지과 함께 반응형을 고려하여 rem으로 일괄적으로 수정하도록 하겠습니다!!

의견 주셔서 감사합니다 :)

@10hajin15 10hajin15 changed the title [Feature/new post] 게시판 선택 드롭다운 컴포넌트 구현 [Feature/new post] 커뮤니티 새로운 글 작성 페이지 구현 Dec 31, 2024
Copy link
Contributor

@okxooxoo okxooxoo left a comment

Choose a reason for hiding this comment

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

하진님 정말 고생하셨어요! 코드 읽고 많이 배워갑니다!
질문과 건의사항 몇 가지 달았으니 천천히 확인 부탁드립니다 ㅎㅎ
감사합니다 :)

Comment on lines 71 to 77
<div className='mt-[32px] flex justify-end'>
<Button className='mr-[10px]' type='outlined' onClick={handleCancel}>
취소
</Button>
<Button type='filled' onClick={handleSubmit}>
등록
</Button>
Copy link
Contributor

Choose a reason for hiding this comment

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

mr-[10px] 대신에 버튼을 감싸는 div 태그에 gap-4 스타일을 추가하시는 건 어떻게 생각하시나요?!
그렇게 되면 div 안에 새로운 버튼을 추가하더라도 자동으로 간격이 생길 것 같아요! 🙂

src/App.tsx Outdated
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import PortfolioPage from '@/components/pages/portfolio';
import NewPortfolioPage from '@/components/pages/portfolio/new';
import NewPostPage from '@/components/pages/community/post';
Copy link
Contributor

Choose a reason for hiding this comment

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

기존에 pathpages의 하위 폴더명과 일치시키자고 이야기 했던 것 같아요!
따라서 /community/new 경로로 이동하니 post가 아닌 new 폴더에 NewPostPage 컴포넌트를 두는 건 어떠세요오?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

엇 경로 수정하면서 폴더명은 수정을 안했네요!!! 감사합니다 :)
수정하겠습니다!

Comment on lines 32 to 59
<MDEditor
textareaProps={{
placeholder: '제목을 입력하세요.',
maxLength: 30,
}}
minHeight={44}
visibleDragbar={false}
value={title}
onChange={handleChange(setTitle)}
extraCommands={[]}
hideToolbar={true}
enableScroll={false}
preview='edit'
className='border border-b-0 border-border shadow-none'
/>
</div>
<div className='h-[calc(100%-44px)]'>
<MDEditor
textareaProps={{
placeholder: '내용을 작성하세요.',
}}
visibleDragbar={false}
height='100%'
value={content}
onChange={handleChange(setContent)}
extraCommands={[]}
preview='edit'
className='border border-border shadow-none'
Copy link
Contributor

Choose a reason for hiding this comment

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

자식 컴포넌트 하나하나마다 border 스타일을 추가하는 방법 대신에
이를 감싸는 부모 divdivide-x 혹은 divide-y을 추가하는 방법도 있어요!

요렇게 하면 좀더 확장성 있게 스타일링 할 수 있을 것 같습니다! ☺️

Comment on lines +86 to +92
.title-section .w-md-editor-text {
display: flex;
align-items: center;
height: 44px;
}

.title-section textarea.w-md-editor-text-input {
Copy link
Contributor

Choose a reason for hiding this comment

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

요거 제가 정말 잘 몰라서 그러는데.. w-md-editor-text 어떤 클래스인가요?! 궁금합니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

react-md-editor 패키지에서 MDEditor 컴포넌트를 사용하고 있는데 거기서 만들어주는 요소 클래스명이에요!!

Comment on lines 65 to 68
<MDEditor.Markdown
source={content}
className='h-[calc(100%-44px)] overflow-auto rounded-b-[3px] px-[20px] py-[10px]'
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

실행해봤는데 마크다운 적용되는 에디터 신기하네요! 정말 고생 많으셨습니다 🥰

지금도 너무 마음에 들고 잘 작동하는데,
좌측 에디터에서 텍스트가 추가될 때마다 우측 에디터에서 자동으로 스크롤이 최하단으로 이동했으면 좋겠습니다!
혹시 그 부분은 구현이 많이 어려울까요? 😮 감사합니다!

2024-12-31.11.47.44.mov

junhakjh and others added 11 commits January 1, 2025 12:03
* ✨ feat: useCalendar -> useCalendar, useRecruitCalendar로 분리

* ✨ feat: 캘린더 아이콘 추가

* ✨ feat: DatePicker 컴포넌트 구현

* ✨ feat: 공고 이미지, 직무 상세 요강 제외 채용공고 등록 페이지 구현

* ✨ feat: 취업공고 작성 페이지 라우팅

* ♻️ refactor: useTextInput, useId 적용

* ♻️ refactor: dropdown 컴포넌트 rename, 폴더 이동
Copy link
Contributor

@junhakjh junhakjh left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 :)

const [content, setContent] = useState<string>('');
const [selectedBoard, setSelectedBoard] = useState<string>('카테고리');

const handleChange = (setter: React.Dispatch<React.SetStateAction<string>>) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

useState를 사용하지 않고, 저희 프로젝트의 커스텀 훅에 있는 useTextInput을 사용하면 handleChange라는 함수가 없어도 될 것 같아요!
image

Copy link
Contributor

@GuKBABjOa GuKBABjOa left a comment

Choose a reason for hiding this comment

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

하진님 수고하셨습니다

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.

5 participants