-
Notifications
You must be signed in to change notification settings - Fork 843
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 remaining C components (#7467)
- Loading branch information
Showing
13 changed files
with
580 additions
and
52 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,3 @@ | ||
**Deprecations** | ||
|
||
- Remove unused public `EuiCommentTimeline` subcomponent export. Use the parent `EuiComment` or `EuiCommentList` components instead. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* 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 { EuiButtonIcon } from '../button'; | ||
|
||
import { EuiComment, EuiCommentProps } from './comment'; | ||
|
||
/** | ||
* Shared comment story utils/arg types | ||
*/ | ||
|
||
export const _eventColorArgType = { | ||
options: [ | ||
undefined, | ||
'subdued', | ||
'transparent', | ||
'plain', | ||
'warning', | ||
'danger', | ||
'success', | ||
'primary', | ||
'accent', | ||
], | ||
control: { type: 'radio' }, | ||
}; | ||
export const _actionsExampleArgType = { | ||
control: 'radio', | ||
options: ['Example action', 'No actions'], | ||
mapping: { | ||
'Example action': ( | ||
<EuiButtonIcon | ||
title="Custom action" | ||
aria-label="Custom action" | ||
color="text" | ||
iconType="copy" | ||
/> | ||
), | ||
'No actions': null, | ||
}, | ||
defaultValue: 'Example action', | ||
}; | ||
|
||
/** | ||
* Rendered stories | ||
*/ | ||
|
||
const meta: Meta<EuiCommentProps> = { | ||
title: 'EuiComment', | ||
component: EuiComment, | ||
argTypes: { | ||
eventColor: _eventColorArgType, | ||
actions: _actionsExampleArgType, | ||
}, | ||
excludeStories: /^_/, // Do not render the shared argTypes as stories | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiCommentProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
username: 'User', | ||
timelineAvatar: 'user', | ||
event: 'posted', | ||
eventIcon: 'pencil', | ||
timestamp: 'on Jan 1, 2020', | ||
actions: 'Example action', | ||
children: 'A user message or any custom component', | ||
}, | ||
}; |
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.