mirror of
https://github.com/grafana/grafana.git
synced 2024-12-27 09:21:35 -06:00
Combobox: Remove Chance to generate options in story (#95842)
Generate basic options
This commit is contained in:
parent
ab974ddf14
commit
70e05c6a3a
@ -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(),
|
||||
}));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user