Commit b48ac0dc by Alex Khomenko Committed by GitHub

Grafana-UI: Add story/docs for FilterPill (#30252)

* Grafana-UI: Add story/docs for FilterPill

* Grafana-UI: Update args
parent b8d84092
import { Props } from '@storybook/addon-docs/blocks';
import { FilterPill } from './FilterPill';
# FilterPill
A component used for quick toggling on/off filters. Mostly used in inline form components and transformation/query editors.
### Usage
```jsx
import { FilterPill } from '@grafana/ui';
<FilterPill label={'Test'} onClick={() => console.log('toggle')}/>
```
### Props
<Props of={FilterPill} />
import React from 'react';
import { Story } from '@storybook/react';
import { FilterPill, FilterPillProps } from './FilterPill';
import { withCenteredStory } from '@grafana/ui/src/utils/storybook/withCenteredStory';
import mdx from './FilterPill.mdx';
import { getAvailableIcons } from '../../types';
export default {
title: 'General/FilterPill',
component: FilterPill,
decorators: [withCenteredStory],
argTypes: {
icon: { control: { type: 'select', options: getAvailableIcons() } },
onClick: { action: 'Pill Clicked' },
},
parameters: {
docs: {
page: mdx,
},
},
};
export const Basic: Story<FilterPillProps> = args => {
return <FilterPill {...args} />;
};
Basic.args = {
selected: false,
label: 'Test',
icon: undefined,
};
......@@ -5,7 +5,7 @@ import { css } from 'emotion';
import { IconButton } from '../IconButton/IconButton';
import { IconName } from '../../types';
interface FilterPillProps {
export interface FilterPillProps {
selected: boolean;
label: string;
onClick: React.MouseEventHandler<HTMLElement>;
......@@ -39,7 +39,6 @@ const getFilterPillStyles = stylesFactory((theme: GrafanaTheme, isSelected: bool
padding: ${theme.spacing.xxs} ${theme.spacing.sm};
background: ${theme.colors.bg2};
border-radius: ${theme.border.radius.sm};
display: inline-block;
padding: 0 ${theme.spacing.md} 0 ${theme.spacing.xs};
font-weight: ${theme.typography.weight.semibold};
font-size: ${theme.typography.size.sm};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment