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

SortDropdown #100

Closed
1 task
bluetree7878 opened this issue Jan 2, 2025 · 1 comment ยท Fixed by #101
Closed
1 task

SortDropdown #100

bluetree7878 opened this issue Jan 2, 2025 · 1 comment ยท Fixed by #101
Assignees
Labels
๐Ÿ“ Modify ๊ธฐ๋Šฅ, ์ฝ”๋“œ ์ˆ˜์ •

Comments

@bluetree7878
Copy link
Collaborator

๐Ÿ“Œ ์ด์Šˆ ๋‚ด์šฉ

SortDropdown์ด ๋žญํ‚น ํŽ˜์ด์ง€์—์„œ๋งŒ ์“ฐ์ด๋Š” ๊ฒŒ ์•„๋‹Œ ์—ฌ๋Ÿฌ ํŽ˜์ด์ง€์—์„œ๋„ ์“ฐ์ผ ๊ฒƒ ๊ฐ™์•„์„œ ์ด๊ฑธ ๊ณตํ†ต์ ์œผ๋กœ ์“ธ ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“ค๋ ค ํ•ฉ๋‹ˆ๋‹ค.
์Šคํƒ€์ผ์€ ๊ทธ๋Œ€๋กœ ๊ฐ€์ ธ๊ฐˆ ๊ฒƒ ๊ฐ™์•„์„œ ๊ทธ ์•ˆ์— ๋“ค์–ด๊ฐˆ ์˜ต์…˜์ด๋‚˜ ๋‚ด์šฉ ๊ฐ™์€ ๊ฒƒ๋งŒ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•˜๋„๋ก๋งŒ ๋ฐ”๊ฟ”๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

๊ธฐ์กด ์ฝ”๋“œ

// features/ranking/ui/SortDropdown
import * as S from './styles';
import usePopover from '@hooks/usePopover';
import { RANKING_OPTIONS } from '@features/ranking/constant';
import { objectKeys } from '@modern-kit/utils';

interface SortDropDownProps {
  selectedOption: keyof typeof RANKING_OPTIONS;
  onSelectOption: (option: keyof typeof RANKING_OPTIONS) => void;
}

export default function SortDropdown({
  selectedOption,
  onSelectOption,
}: SortDropDownProps) {
  const { isOpen, togglePopover, popoverRef } = usePopover();

  const handleOptionClick = (option: keyof typeof RANKING_OPTIONS) => {
    onSelectOption(option);
    togglePopover();
  };

  // ์ •๋ ฌ ์˜ต์…˜ ๋ชฉ๋ก์„ ๋™์ ์œผ๋กœ ์ƒ์„ฑ
  const SORT_OPTIONS = objectKeys(RANKING_OPTIONS);

  return (
    <S.SortContainer ref={popoverRef}>
      <S.SortSelectButton onClick={togglePopover} $isToggled={isOpen}>
        {selectedOption}
      </S.SortSelectButton>
      {isOpen && (
        <S.SortOptionUl>
          {SORT_OPTIONS.map(option => (
            <S.SortOptionLi
              key={option}
              onClick={() => handleOptionClick(option)}
            >
              {option}
            </S.SortOptionLi>
          ))}
        </S.SortOptionUl>
      )}
    </S.SortContainer>
  );
}

๊ตฌํ˜„ ๋‚ด์šฉ

  • SortDropdown ๊ณตํ†ต์ ์œผ๋กœ ์“ธ ์ˆ˜ ์žˆ๊ฒŒ ๋ณ€๊ฒฝ

๐Ÿ–ฅ๏ธ๊ด€๋ จ ํ™”๋ฉด (์„ ํƒ์‚ฌํ•ญ)

image
ํ˜„์žฌ ๋žญํ‚น ํŽ˜์ด์ง€์—์„œ ์“ฐ์ด๋Š” ๋ถ€๋ถ„

๐Ÿ“ ์ฐธ๊ณ  ์‚ฌํ•ญ

@bluetree7878 bluetree7878 added the ๐Ÿ“ Modify ๊ธฐ๋Šฅ, ์ฝ”๋“œ ์ˆ˜์ • label Jan 2, 2025
@bluetree7878 bluetree7878 self-assigned this Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

git fetch origin
git checkout modify/#100/SortDropdown

bluetree7878 added a commit that referenced this issue Jan 15, 2025
โ€ฆ์„ฑ์„ ์ธํ„ฐํŽ˜์ด์Šค๋กœ ๋ถ„๋ฆฌ
bluetree7878 added a commit that referenced this issue Jan 15, 2025
SortDropdown ๋ฒ”์šฉ์  ์ปดํฌ๋„ŒํŠธ๋กœ ๋ณ€๊ฒฝ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿ“ Modify ๊ธฐ๋Šฅ, ์ฝ”๋“œ ์ˆ˜์ •
Projects
None yet
1 participant