import Button from 'sentry/components/button';
import DropdownAutoComplete from 'sentry/components/dropdownAutoComplete';
import DropdownButton from 'sentry/components/dropdownButton';
const items = [
{
value: 'apple',
label: '🍎 Apple',
},
{
value: 'bacon',
label: '🥓 Bacon',
},
{
value: 'corn',
label: '🌽 Corn',
},
];
const groupedItems = [
{
value: 'defaults',
hideGroupLabel: true,
items: [
{
value: 'recent thing',
label: 'recent thing',
},
{
value: 'other recent thing',
label: 'other recent thing',
},
{
value: 'yet another recent thing',
label: 'yet another recent thing',
},
],
},
{
value: 'countries',
label: (
),
items: [
{
value: 'new zealand',
label: 🇨🇷 New Zealand
,
},
{
value: 'australia',
label: 🇦🇺 Australia
,
},
{
value: 'brazil',
label: 🇧🇷 Brazil
,
},
],
},
{
value: 'foods',
label: 'Foods',
items: [
{
value: 'apple',
label: 🍎 Apple
,
},
{
value: 'bacon',
label: 🥓 Bacon
,
},
{
value: 'corn',
label: 🌽 Corn
,
},
],
},
];
export default {
title: 'Components/Buttons/Dropdowns/Dropdown Auto Complete',
component: DropdownAutoComplete,
};
export const Ungrouped = () => (
{({selectedItem}) => (selectedItem ? selectedItem.label : 'Click me!')}
);
Ungrouped.storyName = 'Ungrouped';
Ungrouped.parameters = {
docs: {
description: {
story: 'The item label can be a component or a string',
},
},
};
export const Grouped = () => (
{({selectedItem}) => (selectedItem ? selectedItem.label : 'Click me!')}
);
Grouped.storyName = 'Grouped';
Grouped.parameters = {
docs: {
description: {
story: 'Group labels can receive a component too',
},
},
};
export const WithDropdownButton = () => (
{({isOpen, selectedItem}) => (
{selectedItem ? selectedItem.label : 'Click me!'}
)}
);
WithDropdownButton.storyName = 'With Dropdown Button';
WithDropdownButton.parameters = {
docs: {
description: {
story: 'Use it with dropdownbutton for maximum fun',
},
},
};
export const WithExtraAction = () => (
Now click me!}
>
{({isOpen, selectedItem}) => (
{selectedItem ? selectedItem.label : 'Click me!'}
)}
);
WithExtraAction.storyName = 'With Extra Action';
WithExtraAction.parameters = {
docs: {
description: {
story: 'Add a call to action button',
},
},
};