Combobox: Remove Chance to generate options in story (#95842)

Generate basic options
This commit is contained in:
Tobias Skarhed 2024-11-06 09:48:44 +01:00 committed by GitHub
parent ab974ddf14
commit 70e05c6a3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,5 @@
import { action } from '@storybook/addon-actions';
import { Meta, StoryFn, StoryObj } from '@storybook/react';
import { Chance } from 'chance';
import React, { ComponentProps, useCallback, useEffect, useState } from 'react';
import { SelectableValue } from '@grafana/data';
@ -13,8 +12,6 @@ import { Select, AsyncSelect } from '../Select/Select';
import { Combobox, ComboboxOption } from './Combobox';
const chance = new Chance();
type PropsAndCustomArgs = ComponentProps<typeof Combobox> & { numberOfOptions: number };
const meta: Meta<PropsAndCustomArgs> = {
@ -76,8 +73,8 @@ export const Basic: Story = {};
async function generateOptions(amount: number): Promise<ComboboxOption[]> {
return Array.from({ length: amount }, (_, index) => ({
label: chance.sentence({ words: index % 5 }),
value: chance.guid(),
label: 'Option ' + index,
value: index.toString(),
}));
}