Skip to content

Commit 2a79e00

Browse files
committed
add(select-inputs): add popup header to select input containers
1 parent 9507057 commit 2a79e00

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

src/components/SelectInputContainer/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export type SelectInputContainerProps<
6868
optionsPending?: boolean;
6969
optionsFiltered?: boolean;
7070
optionsPopupClassName?: string;
71+
popupHeader?: React.ReactNode;
72+
popupHeaderClassName?: string;
7173
persistentOptionPopup?: boolean;
7274
placeholder?: string;
7375
valueDisplay: string;
@@ -105,6 +107,8 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
105107
inputSectionClassName,
106108
label,
107109
labelContainerClassName,
110+
popupHeader,
111+
popupHeaderClassName,
108112
name,
109113
onOptionClick,
110114
searchText,
@@ -370,6 +374,11 @@ function SelectInputContainer<OK extends OptionKey, N extends string, O extends
370374
optionsPopupContentClassName,
371375
)}
372376
>
377+
{popupHeader && (
378+
<div className={_cs(styles.popupHeader, popupHeaderClassName)}>
379+
{popupHeader}
380+
</div>
381+
)}
373382
{popup}
374383
<EmptyOptions
375384
filtered={optionsFiltered}

src/components/SelectInputContainer/styles.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
padding-top: calc(var(--tui-spacing-large) - var(--tui-spacing-medium));
33
padding-bottom: calc(var(--tui-spacing-large) - var(--tui-spacing-medium));
44

5+
.popup-header {
6+
flex-grow: 1;
7+
flex-shrink: 0;
8+
}
9+
510
.popup-content {
611
display: flex;
712
flex-direction: column;

src/stories/MultiSelectInput.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ Default.args = {
7070
value: ['1', '3'],
7171
};
7272

73+
export const WithPopupHeader = Template.bind({});
74+
WithPopupHeader.args = {
75+
popupHeader: 'Veggiesss',
76+
};
77+
7378
export const Disabled = Template.bind({});
7479
Disabled.args = {
7580
value: ['1', '3'],

src/stories/SearchMultiSelectInput.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ Default.args = {
212212
value: ['1', '3'],
213213
};
214214

215+
export const WithPopupHeader = Template.bind({});
216+
WithPopupHeader.args = {
217+
popupHeader: 'Fruitsss',
218+
};
219+
215220
export const Disabled = Template.bind({});
216221
Disabled.args = {
217222
value: ['1', '3'],

src/stories/SearchSelectInput.stories.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ Default.args = {
194194
value: '1',
195195
};
196196

197+
export const WithPopupHeader = Template.bind({});
198+
WithPopupHeader.args = {
199+
popupHeader: 'Fruitsss',
200+
};
201+
197202
export const WithActions = Template.bind({});
198203
WithActions.args = {
199204
actionsSelector: () => (

src/stories/SelectInput.stories.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import { Story } from '@storybook/react/types-6-0';
33
import { useArgs } from '@storybook/client-api';
44
import { IoOpenOutline } from 'react-icons/io5';
55
import SelectInput, { SelectInputProps } from '#components/SelectInput';
6+
import {
7+
Tabs,
8+
Tab,
9+
TabList,
10+
} from '#components/Tabs';
611

712
export default {
813
title: 'Input/SelectInput',
@@ -46,6 +51,31 @@ const Template: Story<SelectInputProps<string, string, Option, { containerClassN
4651
);
4752
};
4853

54+
export const WithPopupHeader = Template.bind({});
55+
WithPopupHeader.args = {
56+
popupHeader: (
57+
<Tabs
58+
value="green"
59+
onChange={() => 'green'}
60+
>
61+
<TabList>
62+
<Tab
63+
name="green"
64+
style={{ flexGrow: 1 }}
65+
>
66+
Green
67+
</Tab>
68+
<Tab
69+
name="yellow"
70+
style={{ flexGrow: 1 }}
71+
>
72+
Yellow
73+
</Tab>
74+
</TabList>
75+
</Tabs>
76+
),
77+
};
78+
4979
export const WithActions = Template.bind({});
5080
WithActions.args = {
5181
actionsSelector: () => (

0 commit comments

Comments
 (0)