-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(select): dynamic items collection type (#12)
- Loading branch information
1 parent
44a390d
commit 7cebc28
Showing
5 changed files
with
41 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import React from 'react' | ||
import { SelectValue as Component, SelectStateContext } from 'react-aria-components' | ||
import { SelectStateContext, SelectValue } from 'react-aria-components' | ||
|
||
import { useSelectContext } from '@/components/select/use-select.hook' | ||
|
||
const SelectValue: React.FC = () => { | ||
const Component: React.FC = () => { | ||
const { selectedItem } = React.useContext(SelectStateContext) | ||
const { slots } = useSelectContext() | ||
|
||
const render = React.useMemo(() => { | ||
if (selectedItem?.textValue) return selectedItem.textValue | ||
|
||
return <Component className={slots.placeholder()} /> | ||
return <SelectValue className={slots.placeholder()} /> | ||
}, [selectedItem?.textValue, slots]) | ||
|
||
return render | ||
} | ||
|
||
export default SelectValue | ||
export default Component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export type { SelectProps } from '@/components/select/Select' | ||
export type { SelectOptionProps } from '@/components/select/SelectOption' | ||
|
||
export { default as Select } from '@/components/select/Select' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters