Skip to content

Commit

Permalink
fix: dropdownId useDropDownState에서 삭제, 따로 넘겨주기
Browse files Browse the repository at this point in the history
  • Loading branch information
hamo-o committed Aug 24, 2024
1 parent 66c0d39 commit 8a35707
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { createContext } from "react";
import type useDropDownState from "../../../hooks/useDropDownState";
import useSafeContext from "../../../hooks/useSafeContext";

export const DropDownContext = createContext<ReturnType<
typeof useDropDownState
> | null>(null);
export const DropDownContext = createContext<
(ReturnType<typeof useDropDownState> & { dropdownId: string }) | null
>(null);

export const useDropDownContext = () => {
const context = useSafeContext(DropDownContext);
Expand Down
3 changes: 1 addition & 2 deletions packages/wow-ui/src/components/DropDown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,10 @@ const DropDown = ({
value,
defaultValue,
onChange,
dropdownId,
});

return (
<DropDownContext.Provider value={dropdownState}>
<DropDownContext.Provider value={{ ...dropdownState, dropdownId }}>
<CollectionProvider>
<DropDownWrapper hasCustomTrigger={!!trigger} {...rest}>
<DropDownTrigger
Expand Down
3 changes: 0 additions & 3 deletions packages/wow-ui/src/hooks/useDropDownState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ interface DropDownStateProps {
selectedValue: string;
selectedText: ReactNode;
}) => void;
dropdownId?: string;
}

const useDropDownState = ({
value,
defaultValue,
onChange,
dropdownId,
}: DropDownStateProps) => {
const [selectedValue, setSelectedValue] = useState("");
const [open, setOpen] = useState(false);
Expand Down Expand Up @@ -47,7 +45,6 @@ const useDropDownState = ({
focusedValue,
setFocusedValue,
handleSelect,
dropdownId,
};
};

Expand Down

0 comments on commit 8a35707

Please sign in to comment.