Skip to content

Commit

Permalink
update Selecte
Browse files Browse the repository at this point in the history
  • Loading branch information
lerte committed Oct 31, 2024
1 parent 970b9bb commit a03662f
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions packages/actify/src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ const Select = <T extends object>(props: SelectProps<T>) => {
? state.selectedItem.rendered
: 'Select an option'

let Tag = FilledField
if (variant == 'filled') {
Tag = FilledField
}
if (variant == 'outlined') {
Tag = OutlinedField
}

return (
<div
style={{ display: 'inline-flex', ...props.style }}
Expand All @@ -48,30 +56,17 @@ const Select = <T extends object>(props: SelectProps<T>) => {
isDisabled={props.isDisabled}
/>

{variant == 'filled' && (
<FilledField ref={ref} {...triggerProps}>
<Label
aria-label={label?.toString()}
{...valueProps}
style={{ lineHeight: '24px' }}
>
{label}
</Label>
<TrailingIcon isOpen={state.isOpen} />
</FilledField>
)}
{variant == 'outlined' && (
<OutlinedField ref={ref} {...triggerProps}>
<Label
{...valueProps}
aria-label={label?.toString()}
style={{ lineHeight: '24px' }}
>
{label}
</Label>
<TrailingIcon isOpen={state.isOpen} />
</OutlinedField>
)}
<Tag ref={ref} {...triggerProps}>
<Label
aria-label={label?.toString()}
{...valueProps}
style={{ lineHeight: '24px' }}
>
{label}
</Label>
<TrailingIcon isOpen={state.isOpen} />
</Tag>

{state.isOpen && (
<Popover state={state} triggerRef={ref} placement="bottom start">
<ListBox {...menuProps} state={state} />
Expand Down

0 comments on commit a03662f

Please sign in to comment.