-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storybook] Add playground stories for components beginning with the …
…letter B (#7459)
- Loading branch information
Showing
15 changed files
with
323 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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 { EuiBadge, EuiBadgeProps } from './badge'; | ||
|
||
const meta: Meta<EuiBadgeProps> = { | ||
title: 'EuiBadge', | ||
component: EuiBadge, | ||
argTypes: { | ||
iconType: { control: 'text' }, | ||
}, | ||
args: { | ||
// Component defaults | ||
iconSide: 'left', | ||
isDisabled: false, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiBadgeProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: 'Badge text', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { EuiBadge } from '../badge'; | ||
import { EuiBadgeGroup, EuiBadgeGroupProps } from './badge_group'; | ||
|
||
const meta: Meta<EuiBadgeGroupProps> = { | ||
title: 'EuiBadgeGroup', | ||
component: EuiBadgeGroup, | ||
args: { | ||
// Component defaults | ||
gutterSize: 'xs', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiBadgeGroupProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<EuiBadge>Badge</EuiBadge> | ||
<EuiBadge>Badge</EuiBadge> | ||
<EuiBadge>Badge</EuiBadge> | ||
</> | ||
), | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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 { EuiBetaBadge, EuiBetaBadgeProps } from './beta_badge'; | ||
|
||
const meta: Meta<EuiBetaBadgeProps> = { | ||
title: 'EuiBetaBadge', | ||
component: EuiBetaBadge, | ||
argTypes: { | ||
iconType: { control: 'text' }, | ||
tooltipContent: { control: 'text' }, | ||
}, | ||
args: { | ||
// Component defaults | ||
color: 'hollow', | ||
size: 'm', | ||
alignment: 'baseline', | ||
tooltipPosition: 'top', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiBetaBadgeProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
label: 'Beta', | ||
}, | ||
}; |
33 changes: 33 additions & 0 deletions
33
src/components/badge/notification_badge/badge_notification.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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 { | ||
EuiNotificationBadge, | ||
EuiNotificationBadgeProps, | ||
} from './badge_notification'; | ||
|
||
const meta: Meta<EuiNotificationBadgeProps> = { | ||
title: 'EuiNotificationBadge', | ||
component: EuiNotificationBadge, | ||
args: { | ||
// Component defaults | ||
color: 'accent', | ||
size: 's', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiNotificationBadgeProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: '5', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* 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 { EuiBeacon, EuiBeaconProps } from './beacon'; | ||
|
||
const meta: Meta<EuiBeaconProps> = { | ||
title: 'EuiBeacon', | ||
component: EuiBeacon, | ||
args: { | ||
// Component defaults | ||
color: 'success', | ||
size: 12, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiBeaconProps>; | ||
|
||
export const Playground: Story = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* 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 { EuiBottomBar, EuiBottomBarProps } from './bottom_bar'; | ||
|
||
const meta: Meta<EuiBottomBarProps> = { | ||
title: 'EuiBottomBar', | ||
component: EuiBottomBar, | ||
argTypes: { | ||
top: { control: 'number' }, | ||
}, | ||
args: { | ||
// Component defaults | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
paddingSize: 'm', | ||
position: 'fixed', | ||
usePortal: true, | ||
affordForDisplacement: true, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiBottomBarProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: 'Bottom bar content', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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 { EuiBreadcrumbs, EuiBreadcrumbsProps } from './breadcrumbs'; | ||
|
||
const meta: Meta<EuiBreadcrumbsProps> = { | ||
title: 'EuiBreadcrumbs', | ||
component: EuiBreadcrumbs, | ||
args: { | ||
// Component defaults | ||
type: 'page', | ||
max: 5, | ||
truncate: true, | ||
responsive: { xs: 1, s: 2, m: 4 }, | ||
lastBreadcrumbIsCurrentPage: true, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiBreadcrumbsProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
breadcrumbs: [ | ||
{ | ||
text: 'Breadcrumb 1', | ||
href: '#', | ||
}, | ||
{ | ||
text: 'Breadcrumb 2', | ||
href: '#', | ||
}, | ||
{ | ||
text: 'Current', | ||
href: '#', | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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 { disableStorybookControls } from '../../../.storybook/utils'; | ||
|
||
import { EuiButton, Props as EuiButtonProps } from './button'; | ||
|
||
const meta: Meta<EuiButtonProps> = { | ||
title: 'EuiButton', | ||
component: EuiButton, | ||
argTypes: { | ||
iconType: { control: 'text' }, | ||
// TODO: the `minWidth` prop takes many different types (bool, string, number) | ||
// - we should consider adding our own custom control | ||
}, | ||
args: { | ||
// Component defaults | ||
element: 'button', | ||
type: 'button', | ||
color: 'primary', | ||
size: 'm', | ||
fill: false, | ||
iconSize: 'm', | ||
iconSide: 'left', | ||
fullWidth: false, | ||
isDisabled: false, | ||
isLoading: false, | ||
isSelected: false, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiButtonProps>; | ||
|
||
export const Playground: Story = { | ||
argTypes: disableStorybookControls(['buttonRef']), | ||
args: { | ||
children: 'Button', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.