-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiInlineEdit] Add Playground & Code Snippets #6743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
70f0d49
006070a
e1c3d12
4294c3a
cb4e508
37cccc0
13204b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,105 @@ | ||||||
| import { PropTypes } from 'react-view'; | ||||||
| import { | ||||||
| EuiInlineEditText, | ||||||
| EuiInlineEditTitle, | ||||||
| } from '../../../../src/components'; | ||||||
| import { | ||||||
| propUtilityForPlayground, | ||||||
| dummyFunction, | ||||||
| simulateFunction, | ||||||
| } from '../../services/playground'; | ||||||
|
|
||||||
| const commonPropsToUse = (propsToUse) => { | ||||||
| propsToUse.inputAriaLabel = { | ||||||
| ...propsToUse.inputAriaLabel, | ||||||
| value: 'Edit text inline', | ||||||
| type: PropTypes.String, | ||||||
| }; | ||||||
|
|
||||||
| propsToUse.isLoading = { | ||||||
| type: PropTypes.Boolean, | ||||||
| }; | ||||||
|
|
||||||
| propsToUse.isInvalid = { | ||||||
| type: PropTypes.Boolean, | ||||||
| }; | ||||||
|
|
||||||
| propsToUse.startWithEditOpen = { | ||||||
| type: PropTypes.Boolean, | ||||||
| }; | ||||||
|
|
||||||
| propsToUse.onSave = simulateFunction(propsToUse.onSave); | ||||||
|
|
||||||
| return propsToUse; | ||||||
breehall marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| }; | ||||||
|
|
||||||
| export const inlineEditTextConfig = () => { | ||||||
| const docgenInfo = Array.isArray(EuiInlineEditText.__docgenInfo) | ||||||
| ? EuiInlineEditText.__docgenInfo[0] | ||||||
| : EuiInlineEditText.__docgenInfo; | ||||||
| let propsToUse = propUtilityForPlayground(docgenInfo.props); | ||||||
|
|
||||||
| propsToUse.defaultValue = { | ||||||
| ...propsToUse.defaultValue, | ||||||
| value: 'Hello! You are editing text content!', | ||||||
| type: PropTypes.String, | ||||||
| }; | ||||||
|
|
||||||
| propsToUse = commonPropsToUse(propsToUse); | ||||||
|
|
||||||
| return { | ||||||
| config: { | ||||||
| componentName: 'EuiInlineEditText', | ||||||
| props: propsToUse, | ||||||
| scope: { | ||||||
| EuiInlineEditText, | ||||||
| }, | ||||||
| imports: { | ||||||
| '@elastic/eui': { | ||||||
| named: ['EuiInlineEditText'], | ||||||
| }, | ||||||
| }, | ||||||
| customProps: { | ||||||
| onSave: dummyFunction, | ||||||
| }, | ||||||
| }, | ||||||
| }; | ||||||
| }; | ||||||
|
|
||||||
| export const inlineEditTitleConfig = () => { | ||||||
| const docgenInfo = Array.isArray(EuiInlineEditTitle.__docgenInfo) | ||||||
| ? EuiInlineEditTitle.__docgenInfo[0] | ||||||
| : EuiInlineEditTitle.__docgenInfo; | ||||||
| let propsToUse = propUtilityForPlayground(docgenInfo.props); | ||||||
|
|
||||||
| propsToUse.defaultValue = { | ||||||
| ...propsToUse.defaultValue, | ||||||
| value: 'Hello! You are editing a title!', | ||||||
| type: PropTypes.String, | ||||||
| }; | ||||||
|
|
||||||
| propsToUse.heading = { | ||||||
| ...propsToUse.heading, | ||||||
| value: 'h2', | ||||||
|
||||||
| value: 'h2', | |
| value: 'h4', |
Although, this also makes me wonder if we should allow setting a span enum for text that should look like a title but aren't actually semantic headings. Thoughts, @1Copenut?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good call. Having a generic span would be helpful. Consumers will have more choice to select the right semantic (or not) container for their use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Trevor! @breehall let's go ahead and add a span option to the source component as part of this PR. We can change the playground example to a h4 or span, up to you.
Uh oh!
There was an error while loading. Please reload this page.