Skip to content

Commit e30da82

Browse files
committed
add SfDropdown
1 parent e4c3867 commit e30da82

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Slot, component$ } from '@builder.io/qwik';
2+
import { SfDropdownProps } from './types';
3+
4+
export const SfDropdown = component$<SfDropdownProps>((props) => {
5+
const { ref, open: isOpen = false, class: _class, style: containerStyle, ...dropdownOptions } = props;
6+
7+
//TODO
8+
// const { refs, style: dropdownStyle } = useDropdown({ isOpen, ...dropdownOptions });
9+
const dropdownStyle = '';
10+
11+
return (
12+
<div {...(ref ? { ref } : {})} class={['w-max', _class]} style={containerStyle} data-testid="dropdown">
13+
<Slot name="trigger" />
14+
{isOpen && (
15+
<div {...(ref ? { ref } : {})} style={dropdownStyle} aria-hidden={!isOpen} data-testid="dropdown-content">
16+
<Slot />
17+
</div>
18+
)}
19+
</div>
20+
);
21+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './types';
2+
3+
export { SfDropdown } from './SfDropdown';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { PropFunction, QwikIntrinsicElements, Signal } from '@builder.io/qwik';
2+
3+
export type SfDropdownProps = {
4+
//Omit<UseDropdownOptions, 'isOpen'> &
5+
style?: QwikIntrinsicElements['div']['style'];
6+
ref?: Signal<Element | undefined>;
7+
class?: string;
8+
open?: boolean;
9+
onClose$?: PropFunction<() => void>;
10+
};

0 commit comments

Comments
 (0)