Skip to content

Commit

Permalink
[EuiButtonIcon] Add Storybook playground
Browse files Browse the repository at this point in the history
+ configure all playgrounds to sort props by required first, then alphabetical
  • Loading branch information
cee-chen committed Jun 20, 2023
1 parent 3d4f87e commit 5799190
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const preview: Preview = {
actions: { argTypesRegex: '^on[A-Z].*' },
backgrounds: { disable: true }, // Use colorMode instead
controls: {
sort: 'requiredFirst',
matchers: {
color: /(background|color)$/i,
date: /Date$/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const meta: Meta<EuiButtonGroupProps> = {
component: EuiButtonGroup,
parameters: {
controls: {
sort: 'requiredFirst',
exclude: ['data-test-subj'],
},
},
Expand Down
40 changes: 40 additions & 0 deletions src/components/button/button_icon/button_icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import type { Meta, StoryObj } from '@storybook/react';

import { icon } from '../../icon/assets/face_happy'; // TODO: Remove this once icons can be loaded by strings
import { EuiButtonIcon, EuiButtonIconProps } from './button_icon';

const meta: Meta<EuiButtonIconProps> = {
title: 'EuiButtonIcon',
component: EuiButtonIcon,
argTypes: {
iconType: {
// TODO: Storybook can't load icons dynamically
// Disable user `iconType` input/controls for now
control: 'function',
},
},
};

export default meta;
type Story = StoryObj<EuiButtonIconProps>;

export const Playground: Story = {
args: {
iconType: icon, // TODO: Storybook can't load icons dynamically
color: 'primary',
display: 'empty',
size: 'xs',
iconSize: 'm',
isDisabled: false,
isLoading: false,
isSelected: false,
},
};

0 comments on commit 5799190

Please sign in to comment.