import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks';
import { TimeRangeSelector } from './time-range-selector.component';

<Meta
  title="Components/Navigation/TimeRangeSelector"
  component={TimeRangeSelector}
/>

# TimeRangeSelector

This is the time range switching component for account history graphs.

- `options` – array of objects whose keys include `label` and `value`
- `value` – the current selected value
- `onChange` - callback function which will be called with a button's value when that button is clicked

```jsx
<TimeRangeSelector
  options={[
    { value: 'm1', label: '1 month' },
    { value: 'm6', label: '6 months' },
    {
      value: 'y1',
      label: <FormattedMessage id="path:to:localized:string" />,
    },
  ]}
  value={value}
  onChange={setValue}
/>
```

## Normal

<Canvas>
  <Story id="components-navigation-time-range-selector--normal" />
</Canvas>

## Default Selected Value

<Canvas>
  <Story id="components-navigation-time-range-selector--default-selected-value" />
</Canvas>

## Custom Styling

<Canvas>
  <Story id="components-navigation-time-range-selector--custom-styling" />
</Canvas>

## Localized Labels

<Canvas>
  <Story id="components-navigation-time-range-selector--localized-labels" />
</Canvas>
