Skip to content

Commit

Permalink
fix: 변경된 토글버튼 훅 반영 (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
1g2g authored Dec 3, 2023
1 parent 1f6bbce commit a381831
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/SelectPosition/SelectPosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ import { useToggleButtons } from '@components/shared/ToggleButton';

import { Position } from '@type/models/Position';

import { POSITIONS_BUTTON } from '@constants/positions';

export const SelectPosition = ({
setPositions,
}: {
setPositions: (value: Position[]) => void;
}) => {
const positions = ['C', 'PF', 'SF', 'PG', 'SG', '없음'];

const handledToggle = (value: string[]) => {
setPositions(value as Position[]);
};

const { handleToggle, selectedItems } = useToggleButtons({
onToggle: handledToggle,
isMultipleSelect: true,
noValue: POSITIONS_BUTTON['없음'],
});

return (
<>
{positions.map((position) => (
{Object.values(POSITIONS_BUTTON).map((position) => (
<ToggleButton
type="button"
fontSize="12px"
Expand All @@ -30,7 +31,7 @@ export const SelectPosition = ({
key={position}
value={position}
isActive={selectedItems.includes(position)}
onToggle={handleToggle}
onToggle={() => handleToggle(position)}
/>
))}
</>
Expand Down

0 comments on commit a381831

Please sign in to comment.