Skip to content

Commit ea46cb4

Browse files
committed
[#102] ♻️ allow using useDropdownContext as a module
1 parent d464d0e commit ea46cb4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/components/common/dropdown/Dropdown.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ interface DropdownContextType {
1515

1616
const DropdownContext = createContext<DropdownContextType | null>(null)
1717

18-
const useDropdownContext = () => {
18+
export const useDropdownContext = (): DropdownContextType => {
1919
const context = useContext(DropdownContext)
20+
2021
if (!context) {
2122
throw new Error('useDropdownContext must be used within a DropdownProvider')
2223
}
@@ -112,7 +113,7 @@ interface ItemProps extends BaseProps {
112113

113114
const getItemStyle = (className: string) =>
114115
clsx(
115-
'flex h-40 w-full items-center rounded-8 px-12 text-body2 text-gray-800 hover:bg-gray-100',
116+
'flex h-40 w-full items-center rounded-8 px-12 text-body2 font-medium text-gray-800 hover:bg-gray-100',
116117
className
117118
)
118119

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { Dropdown } from './Dropdown'
1+
import { Dropdown, useDropdownContext } from './Dropdown'
22

3-
export { Dropdown }
3+
export { Dropdown, useDropdownContext }

0 commit comments

Comments
 (0)