-
Notifications
You must be signed in to change notification settings - Fork 861
Add EuiTimeline #5730
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
Merged
elizabetdev
merged 67 commits into
elastic:main
from
elizabetdev:add-timeline-component
Apr 13, 2022
Merged
Add EuiTimeline #5730
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
4ad1377
Adding new component
elizabetdev cd601f7
WIP
elizabetdev 28e5452
WIP
elizabetdev 8ef5d79
WIP
elizabetdev 3e8b794
WIP event props
elizabetdev 42890a4
`isFigure`
elizabetdev b9a059e
Simplifying props structure to avoid objects
elizabetdev c3fd70e
Updated `textSize` in markdown editor example
elizabetdev 74217da
Small fixes
elizabetdev f0a0927
`panelProps` as object
elizabetdev 4133d83
Better text
elizabetdev 6867384
Fixing rest props
elizabetdev d8347d1
Updating shade color to subdued in EuiAvatar
elizabetdev 29982a1
No more `panelProps`
elizabetdev c666cd4
Adding `isCenterAligned` prop
elizabetdev a6a1fc3
Snippets
elizabetdev e1ebaef
Adding `verticalAlign` prop
elizabetdev 19672ef
Adding tests
elizabetdev 30a71c0
Merge remote-tracking branch 'upstream/main' into add-timeline-component
elizabetdev 1f6efa7
Adding CL
elizabetdev 30d412d
Updating avatar example to use color `"subdued"`
elizabetdev 814eaee
Avatar names
elizabetdev 91abc7c
Using `euiPaletteColorBlindBehindText` to ensure better contrast
elizabetdev 1303ac0
Merge remote-tracking branch 'upstream/main' into add-timeline-component
elizabetdev 00f8beb
refactor
thompsongl efc6686
clean up
thompsongl cb10c9a
Merge remote-tracking branch 'upstream/main' into add-timeline-component
elizabetdev e5f8633
Addressing PR review
elizabetdev 4d0c823
Converting styles to emotion
elizabetdev d04d03d
Merge pull request #28 from thompsongl/add-timeline-component
elizabetdev f0d4c5c
Merge branch 'add-timeline-component' of https://github.com/miukimiu/…
elizabetdev 2ccabed
Better complex example
elizabetdev 83176c6
Adding playground
elizabetdev 728b1bb
Linking `steps` and `comments` components
elizabetdev 7b7fbb6
Updating tests
elizabetdev acb1d09
Adding design consideration text
elizabetdev 9299b47
More design considerations
elizabetdev a128f3a
Merge remote-tracking branch 'upstream/main' into add-timeline-component
elizabetdev 7c3644c
Merge remote-tracking branch 'upstream/main' into add-timeline-component
elizabetdev f6bf949
Better `::before` styles
elizabetdev d1b6acf
Emotion styles
elizabetdev b4fa0b9
Fixing prop description
elizabetdev 049e8aa
Merge remote-tracking branch 'upstream/main' into add-timeline-component
elizabetdev c17cf4d
WIP
elizabetdev f9067ee
Tests
elizabetdev 940b175
Fixing `min-height` issue
elizabetdev caf07dd
Update src-docs/src/views/timeline/timeline_item.tsx
elizabetdev 06c9fcc
Update src-docs/src/views/timeline/timeline.tsx
elizabetdev d62ceab
Update src-docs/src/views/timeline/timeline.tsx
elizabetdev 2de0a93
Update src-docs/src/views/timeline/timeline.tsx
elizabetdev b25ab3b
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev 3bb564f
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev 525b98d
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev 19aa16a
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev 7d472b6
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev cf1dc53
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev 5f3eada
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev a50eebf
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev b75a931
Prettier 🤩
elizabetdev 181da63
Adjusting the timeline icon line
elizabetdev 391b5b5
Removing `verticalAlign="center"` from examples
elizabetdev 8c91017
Fixing path to type
elizabetdev 28496cb
Recommendation for icon size
elizabetdev 2c9c667
Adding `iconAriaLabel` to EuiTimelineItem
elizabetdev 16a506e
Fixing issue with center vertical alignment
elizabetdev 9172994
Adding dot into prop description.
elizabetdev c25b3d4
Update src-docs/src/views/timeline/timeline_example.js
elizabetdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,56 @@ | ||
| import { PropTypes } from 'react-view'; | ||
| import { | ||
| EuiTimelineItem, | ||
| EuiText, | ||
| EuiAvatar, | ||
| } from '../../../../src/components/'; | ||
| import { | ||
| propUtilityForPlayground, | ||
| createOptionalEnum, | ||
| } from '../../services/playground'; | ||
|
|
||
| export default () => { | ||
| const docgenInfo = Array.isArray(EuiTimelineItem.__docgenInfo) | ||
| ? EuiTimelineItem.__docgenInfo[0] | ||
| : EuiTimelineItem.__docgenInfo; | ||
| const propsToUse = propUtilityForPlayground(docgenInfo.props); | ||
|
|
||
| propsToUse.icon = { | ||
| ...propsToUse.icon, | ||
| type: PropTypes.ReactNode, | ||
| value: 'email', | ||
| }; | ||
|
|
||
| propsToUse.verticalAlign = { | ||
| ...createOptionalEnum(propsToUse.verticalAlign), | ||
| value: 'center', | ||
| }; | ||
|
|
||
| propsToUse.children = { | ||
| ...propsToUse.children, | ||
| type: PropTypes.ReactNode, | ||
| value: `<EuiText size="s"> | ||
| <p> | ||
| <strong>[email protected]</strong> was invited to the project | ||
| </p> | ||
| </EuiText>`, | ||
| hidden: false, | ||
| }; | ||
|
|
||
| return { | ||
| config: { | ||
| componentName: 'EuiTimelineItem', | ||
| props: propsToUse, | ||
| scope: { | ||
| EuiTimelineItem, | ||
| EuiText, | ||
| EuiAvatar, | ||
| }, | ||
| imports: { | ||
| '@elastic/eui': { | ||
| named: ['EuiTimelineItem', 'EuiText', 'EuiAvatar'], | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
| }; |
This file contains hidden or 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,42 @@ | ||
| import React from 'react'; | ||
| import { | ||
| EuiTimeline, | ||
| EuiTimelineProps, | ||
| EuiText, | ||
| } from '../../../../src/components'; | ||
|
|
||
| const items: EuiTimelineProps['items'] = [ | ||
| { | ||
| icon: 'email', | ||
| iconAriaLabel: 'Invitation', | ||
| children: ( | ||
| <EuiText size="s"> | ||
| <p> | ||
| <strong>[email protected]</strong> was invited to the project. | ||
| </p> | ||
| </EuiText> | ||
| ), | ||
| }, | ||
| { | ||
| icon: 'pencil', | ||
| iconAriaLabel: 'Edited', | ||
| children: ( | ||
| <EuiText size="s"> | ||
| <p> | ||
| The project was renamed to <strong>Revenue Dashboard</strong>. | ||
| </p> | ||
| </EuiText> | ||
| ), | ||
| }, | ||
| { | ||
| icon: 'folderClosed', | ||
| iconAriaLabel: 'Project closed', | ||
| children: ( | ||
| <EuiText size="s"> | ||
| <p>The project was archived.</p> | ||
| </EuiText> | ||
| ), | ||
| }, | ||
| ]; | ||
|
|
||
| export default () => <EuiTimeline items={items} />; |
This file contains hidden or 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,187 @@ | ||
| import React from 'react'; | ||
| import { Link } from 'react-router-dom'; | ||
| import { GuideSectionTypes } from '../../components'; | ||
|
|
||
| import { | ||
| EuiCode, | ||
| EuiTimeline, | ||
| EuiTimelineItem, | ||
| } from '../../../../src/components'; | ||
| import timelineItemConfig from './playground'; | ||
|
|
||
| import Timeline from './timeline'; | ||
| const timelineSource = require('!!raw-loader!./timeline'); | ||
| const timelineSnippet = `<EuiTimeline | ||
| items={[ | ||
| { | ||
| icon: icon, | ||
| children: content, | ||
| }, | ||
| ]} | ||
| />`; | ||
|
|
||
| import TimelineItem from './timeline_item'; | ||
| const timelineItemSource = require('!!raw-loader!./timeline_item'); | ||
| const timelineItemSnippet = `<EuiTimelineItem icon={icon}> | ||
| {content} | ||
| </EuiTimeline>`; | ||
|
|
||
| import TimelineItemEvent from './timeline_item_event'; | ||
| const timelineItemEventSource = require('!!raw-loader!./timeline_item_event'); | ||
| const timelineItemEventSnippet = `<EuiTimelineItem icon={icon}> | ||
| <EuiSplitPanel.Outer color="transparent" hasBorder grow> | ||
| <EuiSplitPanel.Inner color="subdued"> | ||
| <!-- Top panel content --> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiHorizontalRule margin="none" /> | ||
| <EuiSplitPanel.Inner > | ||
| <!-- Bottom panel content --> | ||
| </EuiSplitPanel.Inner> | ||
| </EuiSplitPanel.Outer> | ||
| </EuiTimelineItem> | ||
| `; | ||
|
|
||
| export const TimelineExample = { | ||
| title: 'Timeline', | ||
| isBeta: true, | ||
| isNew: true, | ||
| sections: [ | ||
elizabetdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.TSX, | ||
| code: timelineSource, | ||
| }, | ||
| ], | ||
| text: ( | ||
| <> | ||
| <p> | ||
| The <strong>EuiTimeline</strong> component standardizes the way a | ||
| timeline thread is displayed. Pass an array of{' '} | ||
| <strong>EuiTimelineItem</strong> objects and{' '} | ||
| <strong>EuiTimeline</strong> will generate a timeline thread. | ||
| </p> | ||
| <p> | ||
| This component allows you to create any type of timeline, but for | ||
| more specific use cases you should consider: | ||
| </p> | ||
| <ul> | ||
| <li> | ||
| <Link to="/navigation/steps"> | ||
| <strong>EuiSteps</strong> | ||
| </Link> | ||
| : a timeline that allows you to present instructional content that | ||
| must be conducted in a particular order and might contain progress | ||
| indications. | ||
| </li> | ||
| <li> | ||
| <Link to="/display/comment-list"> | ||
| <strong>EuiCommentList</strong> | ||
| </Link> | ||
| : a timeline that allows you to display comments or logging | ||
| actions that either a user or a system has performed. | ||
| </li> | ||
| </ul> | ||
| </> | ||
| ), | ||
| props: { EuiTimeline, EuiTimelineItem }, | ||
| snippet: timelineSnippet, | ||
| demo: <Timeline />, | ||
| }, | ||
| { | ||
| title: 'Timeline item', | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.TSX, | ||
| code: timelineItemSource, | ||
| }, | ||
| ], | ||
| text: ( | ||
| <> | ||
| <p> | ||
| Each <strong>EuiTimelineItem</strong> has two parts: an icon on the | ||
| left side and an event on the right side. To create an item you need | ||
| the following props: | ||
| </p> | ||
| <ul> | ||
| <li> | ||
| <EuiCode>icon</EuiCode>: main icon that appears on the left side. | ||
elizabetdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Can be passed as any <EuiCode>IconType</EuiCode> string or custom | ||
| node (e.g.{' '} | ||
| <Link to="/display/avatar"> | ||
| <strong>EuiAvatar</strong> | ||
| </Link> | ||
| ). It is recommended not to use an element larger than 40x40. | ||
| </li> | ||
| <li> | ||
| <EuiCode>children</EuiCode>: any node as the event content. | ||
| </li> | ||
| </ul> | ||
| </> | ||
| ), | ||
| props: { EuiTimelineItem }, | ||
| snippet: timelineItemSnippet, | ||
| demo: <TimelineItem />, | ||
| playground: timelineItemConfig, | ||
| }, | ||
| { | ||
| title: 'A timeline thread with multiple items', | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.TSX, | ||
| code: timelineItemEventSource, | ||
| }, | ||
| ], | ||
| text: ( | ||
| <> | ||
| <p> | ||
| You can create a timeline thread by rendering multiple{' '} | ||
| <strong>EuiTimelineItem</strong> components. Wrapping these with an{' '} | ||
| <strong>EuiTimeline</strong> is not required, but we recommend | ||
| having all the <strong>EuiTimelineItem</strong>s nested in the same | ||
| container. This way, we ensure that timeline styles are applied | ||
| correctly. | ||
| </p> | ||
| <p> | ||
| When passing an <EuiCode>icon</EuiCode> and{' '} | ||
| <EuiCode>children</EuiCode> prop to each item, there are some design | ||
| considerations to take into account: | ||
| </p> | ||
| <ul> | ||
| <li> | ||
| <EuiCode>icon</EuiCode>: use icons of the same size to create a | ||
| better visual consistency. | ||
| </li> | ||
| <li> | ||
| <EuiCode>children</EuiCode>: when your content is just one line of | ||
| text, the recommendation is to use a a{' '} | ||
| <Link to="/display/text"> | ||
| <strong>EuiText</strong> | ||
| </Link>{' '} | ||
| as a wrapper. For multi-line content consider using a{' '} | ||
| <Link to="/layout/panel"> | ||
| <strong>EuiPanel</strong> | ||
| </Link>{' '} | ||
| or a{' '} | ||
| <Link to="/layout/panel#split-panels"> | ||
| <strong>EuiSplitPanel</strong> | ||
| </Link>{' '} | ||
| instead. For other types of components like editors, the | ||
| recommendation is to pass the children without any wrapper. | ||
| </li> | ||
| </ul> | ||
| <p> | ||
| The following example shows how to display multiple{' '} | ||
| <strong>EuiTimelineItem</strong>s and how you can use a{' '} | ||
| <strong>EuiSplitPanel</strong> as the content wrapper. | ||
| </p> | ||
| </> | ||
| ), | ||
| props: { | ||
| EuiTimelineItem, | ||
| }, | ||
| snippet: timelineItemEventSnippet, | ||
| demo: <TimelineItemEvent />, | ||
| }, | ||
| ], | ||
| }; | ||
This file contains hidden or 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,13 @@ | ||
| import React from 'react'; | ||
| import { EuiTimelineItem, EuiText, EuiCode } from '../../../../src/components'; | ||
|
|
||
| export default () => ( | ||
| <EuiTimelineItem icon="dot" iconAriaLabel="Main icon"> | ||
| <EuiText size="s"> | ||
| <p> | ||
| I'm the <EuiCode>children</EuiCode> and you can find the{' '} | ||
| <EuiCode>icon</EuiCode> on the left side. | ||
| </p> | ||
| </EuiText> | ||
| </EuiTimelineItem> | ||
| ); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.