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: Box Select 컴포넌트 추가 #23

Merged
merged 10 commits into from
Sep 6, 2024

Conversation

BeMatthewsong
Copy link
Contributor

@BeMatthewsong BeMatthewsong commented Sep 6, 2024

✏️ 작업 내용

  • Box Component (모바일 버전, 그 외 버전)

📷 스크린샷

2024-09-06.2.07.50.mov

✍️ 사용법

<BoxSelect title={'달램핏'} subTitle={'오피스 트레이닝'} />

🎸 기타

전체를 클릭하면 선택되게 수정하고 있습니다.

close #11

@BeMatthewsong BeMatthewsong added the ✨ Feat 기능 추가 label Sep 6, 2024
@BeMatthewsong BeMatthewsong self-assigned this Sep 6, 2024
Copy link
Contributor

@HMRyu HMRyu left a comment

Choose a reason for hiding this comment

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

애니메이션도 적용되니 UI 퀄리티가 높은 것 같습니다!

comment 확인 부탁드립니다!

고생하셨습니다..!

}

const BoxSelect = ({ title = '', subTitle = '' }: BoxSelectProps) => {
const [selectStatus, setSelectStatus] = useState<boolean>(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

P3) state 이름을 isSelected 라고 변경해도 좋을 것 같습니다!

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 24 to 26
<label
className={`flex h-76 w-full items-start gap-8 rounded-lg ${selectStatus ? 'bg-var-gray-900 text-var-white' : 'bg-var-gray-50 text-var-black'} md:h-70 lg:h-70 px-8 py-[6px] transition-colors duration-200 ease-in-out md:px-16 md:py-12 lg:px-16 lg:py-12`}
>
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

onChange={handleCheckboxChange}
/>
<div className='flex flex-col'>
<div className='text-[14px] font-bold md:text-[16px] lg:text-[16px]'>
Copy link
Contributor

Choose a reason for hiding this comment

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

P2) md 이상이면 text 가 16px 인 것 같아서 굳이 lg:text-[16px] 은 안 적어도 될 것 같긴 합니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

  • text-16 , text-14 로 사용 할 수 있게 tailwind config 수정했습니다!

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 +21 to +24
screens: {
md: { min: '768px' },
lg: { min: '1024px' },
},
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Comment on lines +21 to +24
screens: {
md: { min: '768px' },
lg: { min: '1024px' },
},
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

<input
id='checkbox'
type='checkbox'
className="h-24 w-24 appearance-none rounded-md bg-[url('/icons/checkbox-default.svg')] bg-center bg-no-repeat checked:bg-[url('/icons/checkbox-active.svg')] checked:bg-center checked:bg-no-repeat"
Copy link
Contributor

Choose a reason for hiding this comment

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

P4) appearance 속성은 처음 보네요! 혹시 어떤 기능하는지 알려주실 수 있을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

appearance-none은 체크박스 인풋의 기본 스타일을 무효화시키는 속성입니다.

https://tailwindcss.com/docs/appearance

}

const BoxSelect = ({ title = '', subTitle = '' }: BoxSelectProps) => {
const [selectStatus, setSelectStatus] = useState<boolean>(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

나중에 부모 컴포넌트에서 set함수를 받아서 관리할 것 같아서 이 부분은 추후에 변경이 필요해보입니다.

Comment on lines 24 to 39
<label
className={`flex h-76 w-full items-start gap-8 rounded-lg ${selectStatus ? 'bg-var-gray-900 text-var-white' : 'bg-var-gray-50 text-var-black'} md:h-70 lg:h-70 px-8 py-[6px] transition-colors duration-200 ease-in-out md:px-16 md:py-12 lg:px-16 lg:py-12`}
>
<input
id='checkbox'
type='checkbox'
className="h-24 w-24 appearance-none rounded-md bg-[url('/icons/checkbox-default.svg')] bg-center bg-no-repeat checked:bg-[url('/icons/checkbox-active.svg')] checked:bg-center checked:bg-no-repeat"
onChange={handleCheckboxChange}
/>
<div className='flex flex-col'>
<div className='text-[14px] font-bold md:text-[16px] lg:text-[16px]'>
{title}
</div>
<div className='text-[12px] font-medium'>{subTitle}</div>
</div>
</label>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • label 를 상위 태그로 두면서 전체를 클릭하여도 input이 선택되도록 하였습니다.
  • selectStatus에 따라 체크박스에 해당하는 이미지가 변하도록 하였습니다.
  • transition을 넣으면서 부드러운 전환을 할 수 있게 했습니다.

onChange={handleCheckboxChange}
/>
<div className='flex flex-col'>
<div className='text-[14px] font-bold md:text-[16px] lg:text-[16px]'>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

두 분 의견 반영하겠습니다!

}

const BoxSelect = ({ title = '', subTitle = '' }: BoxSelectProps) => {
const [selectStatus, setSelectStatus] = useState<boolean>(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

아하 확실히 그게 더 좋겠네요!
반영하도록 하겠습니다!

<input
id='checkbox'
type='checkbox'
className="h-24 w-24 appearance-none rounded-md bg-[url('/icons/checkbox-default.svg')] bg-center bg-no-repeat checked:bg-[url('/icons/checkbox-active.svg')] checked:bg-center checked:bg-no-repeat"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

appearance-none은 체크박스 인풋의 기본 스타일을 무효화시키는 속성입니다.

https://tailwindcss.com/docs/appearance

Copy link
Contributor

@yunchaeney yunchaeney left a comment

Choose a reason for hiding this comment

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

👍 트집 잡기 어려워요

@BeMatthewsong BeMatthewsong merged commit 814a27e into develop Sep 6, 2024
4 checks passed
@BeMatthewsong BeMatthewsong deleted the feat/hyuk/KAN-11-Box-Selector branch September 6, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feat 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feat: 공통 컴포넌트 - progress bar, box-select
4 participants