-
Notifications
You must be signed in to change notification settings - Fork 886
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 22 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,44 @@ | ||||||
| import React, { ReactElement } from 'react'; | ||||||
| import { | ||||||
| EuiTimeline, | ||||||
| EuiTimelineProps, | ||||||
| EuiText, | ||||||
| EuiAvatar, | ||||||
| EuiPanel, | ||||||
| } from '../../../../src/components'; | ||||||
|
|
||||||
| const wrapper = (children: ReactElement) => ( | ||||||
| <EuiPanel paddingSize="none" color="transparent"> | ||||||
| <EuiText size="s">{children}</EuiText> | ||||||
| </EuiPanel> | ||||||
| ); | ||||||
|
|
||||||
| const items: EuiTimelineProps['items'] = [ | ||||||
| { | ||||||
| icon: <EuiAvatar name="email" iconType="email" color="subdued" />, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all the
Suggested change
|
||||||
| verticalAlign: 'center', | ||||||
| children: wrapper( | ||||||
| <p> | ||||||
| <strong>janet@elastic.co</strong> was invited to the project | ||||||
| </p> | ||||||
| ), | ||||||
| }, | ||||||
| { | ||||||
| icon: <EuiAvatar name="pencil" iconType="pencil" color="subdued" />, | ||||||
| verticalAlign: 'center', | ||||||
| children: wrapper( | ||||||
| <p> | ||||||
| The project was renamed to <strong>Revenue Dashboard</strong> | ||||||
| </p> | ||||||
| ), | ||||||
| }, | ||||||
| { | ||||||
| icon: ( | ||||||
| <EuiAvatar name="folder closed" iconType="folderClosed" color="subdued" /> | ||||||
| ), | ||||||
| verticalAlign: 'center', | ||||||
| children: wrapper(<p>The project was archived</p>), | ||||||
| }, | ||||||
| ]; | ||||||
|
|
||||||
| 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,157 @@ | ||
| import React, { useState } from 'react'; | ||
| import { | ||
| EuiTimelineItem, | ||
| EuiAvatar, | ||
| EuiText, | ||
| EuiSwitch, | ||
| EuiAccordion, | ||
| EuiFlexGroup, | ||
| EuiFlexItem, | ||
| EuiSpacer, | ||
| EuiBadge, | ||
| EuiTitle, | ||
| EuiSplitPanel, | ||
| EuiPanel, | ||
| EuiHorizontalRule, | ||
| } from '../../../../src/components'; | ||
|
|
||
| import { | ||
| useGeneratedHtmlId, | ||
| euiPaletteColorBlind, | ||
| } from '../../../../src/services'; | ||
|
|
||
| export default () => { | ||
| const [checked1, setChecked1] = useState(false); | ||
| const [checked2, setChecked2] = useState(false); | ||
| const [checked3, setChecked3] = useState(false); | ||
| const buttonElementAccordionId = useGeneratedHtmlId({ | ||
| prefix: 'buttonElementAccordion', | ||
| }); | ||
|
|
||
| const onChange1 = (e: { | ||
| target: { checked: React.SetStateAction<boolean> }; | ||
| }) => { | ||
| setChecked1(e.target.checked); | ||
| }; | ||
|
|
||
| const onChange2 = (e: { | ||
| target: { checked: React.SetStateAction<boolean> }; | ||
| }) => { | ||
| setChecked2(e.target.checked); | ||
| }; | ||
|
|
||
| const onChange3 = (e: { | ||
| target: { checked: React.SetStateAction<boolean> }; | ||
| }) => { | ||
| setChecked3(e.target.checked); | ||
| }; | ||
|
|
||
| const phase = ( | ||
| title: string, | ||
| checked: boolean, | ||
| onChange: any, | ||
| avatarColor: string | ||
| ) => ( | ||
| <EuiTimelineItem | ||
| icon={ | ||
| checked ? ( | ||
| <EuiAvatar | ||
| size="m" | ||
| name="check icon" | ||
| iconType="check" | ||
| color={avatarColor} | ||
| /> | ||
| ) : ( | ||
| <EuiAvatar size="s" name="dot icon" iconType="dot" color="subdued" /> | ||
| ) | ||
| } | ||
| > | ||
| <EuiSplitPanel.Outer color="transparent" hasBorder grow> | ||
| <EuiSplitPanel.Inner color={checked ? 'transparent' : 'subdued'}> | ||
| <EuiFlexGroup alignItems="center" gutterSize="s"> | ||
| <EuiFlexItem grow={false}> | ||
| <EuiSwitch | ||
| showLabel={false} | ||
| label={checked ? `${title} is on` : `${title} is off`} | ||
| checked={checked} | ||
| onChange={onChange} | ||
| /> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem> | ||
| <EuiTitle size="s"> | ||
| <h2>{title}</h2> | ||
| </EuiTitle> | ||
| </EuiFlexItem> | ||
| </EuiFlexGroup> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiHorizontalRule margin="none" /> | ||
| <EuiSplitPanel.Inner> | ||
| <EuiText size="s" grow={false}> | ||
| <p> | ||
| Move data to the cold tier when you are searching it less often | ||
| and don’t need to update it. The cold tier is optimized for cost | ||
| savings over search performance. | ||
| </p> | ||
| </EuiText> | ||
|
|
||
| {checked && ( | ||
| <> | ||
| <EuiSpacer /> | ||
| <EuiAccordion | ||
| id={buttonElementAccordionId} | ||
| buttonElement="div" | ||
| buttonContent="Advanced settings" | ||
| > | ||
| <EuiPanel color="transparent"> | ||
| Any content inside of <strong>EuiAccordion</strong> will | ||
| appear here. | ||
| </EuiPanel> | ||
| </EuiAccordion> | ||
| </> | ||
| )} | ||
| </EuiSplitPanel.Inner> | ||
| </EuiSplitPanel.Outer> | ||
| </EuiTimelineItem> | ||
| ); | ||
|
|
||
| return ( | ||
| <div> | ||
| <EuiTimelineItem | ||
| icon={ | ||
| <EuiAvatar | ||
| size="m" | ||
| name="check icon" | ||
| iconType="check" | ||
| color={euiPaletteColorBlind()[0]} | ||
| /> | ||
| } | ||
| > | ||
| <EuiSplitPanel.Outer color="transparent" hasBorder grow> | ||
| <EuiSplitPanel.Inner> | ||
| <EuiTitle size="s"> | ||
| <h2> | ||
| Hot phase <EuiBadge color="warning">Required</EuiBadge> | ||
| </h2> | ||
| </EuiTitle> | ||
| </EuiSplitPanel.Inner> | ||
| <EuiHorizontalRule margin="none" /> | ||
| <EuiSplitPanel.Inner> | ||
| <EuiText grow={false} size="s"> | ||
| <p> | ||
| Store your most recent, most frequently-searched data in the hot | ||
| tier. The hot tier provides the best indexing and search | ||
| performance by using the most powerful, expensive hardware. | ||
| </p> | ||
| </EuiText> | ||
| </EuiSplitPanel.Inner> | ||
| </EuiSplitPanel.Outer> | ||
| </EuiTimelineItem> | ||
|
|
||
| {phase('Warm phase', checked1, onChange1, euiPaletteColorBlind()[1])} | ||
|
|
||
| {phase('Cold phase', checked2, onChange2, euiPaletteColorBlind()[2])} | ||
|
|
||
| {phase('Frozen phase', checked3, onChange3, euiPaletteColorBlind()[3])} | ||
| </div> | ||
| ); | ||
| }; |
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,147 @@ | ||
| import React from 'react'; | ||
| import { Link } from 'react-router-dom'; | ||
| import { GuideSectionTypes } from '../../components'; | ||
|
|
||
| import { | ||
| EuiCode, | ||
| EuiTimeline, | ||
| EuiTimelineItem, | ||
| } from '../../../../src/components'; | ||
|
|
||
| import Timeline from './timeline'; | ||
| const timelineSource = require('!!raw-loader!./timeline'); | ||
| const timelineSnippet = `<EuiTimeline | ||
| timelines={[ | ||
|
elizabetdev marked this conversation as resolved.
Outdated
|
||
| { | ||
| icon: icon, | ||
| children: content, | ||
| }, | ||
| ]} | ||
|
elizabetdev marked this conversation as resolved.
Outdated
|
||
| />`; | ||
|
|
||
| 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}> | ||
| <EuiPanel paddingSize="none" color="transparent"> | ||
| <EuiText size="s"> | ||
|
elizabetdev marked this conversation as resolved.
Outdated
|
||
| <p> | ||
| <strong>Janet</strong> edited the dashboard 4 days ago | ||
| </p> | ||
| </EuiText> | ||
| </EuiPanel> | ||
| </EuiTimeline>`; | ||
|
|
||
| import TimelineComplex from './timeline_complex'; | ||
| const TimelineComplexSource = require('!!raw-loader!./timeline_complex'); | ||
|
|
||
| export const TimelineExample = { | ||
| title: 'Timeline', | ||
|
elizabetdev marked this conversation as resolved.
|
||
| sections: [ | ||
|
elizabetdev marked this conversation as resolved.
|
||
| { | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.JS, | ||
| code: timelineSource, | ||
| }, | ||
| ], | ||
| text: ( | ||
| <div> | ||
| The <strong>EuiTimeline</strong> is a component that standardizes the | ||
|
elizabetdev marked this conversation as resolved.
Outdated
|
||
| way a timeline thread is displayed. Pass an array of{' '} | ||
| <strong>EuiTimelineItem</strong> objects and{' '} | ||
| <strong>EuiTimeline</strong> will generate a timeline thread. | ||
| </div> | ||
| ), | ||
| props: { EuiTimeline, EuiTimelineItem }, | ||
| snippet: timelineSnippet, | ||
| demo: <Timeline />, | ||
| }, | ||
| { | ||
| title: 'Timeline item', | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.JS, | ||
| code: timelineItemSource, | ||
| }, | ||
| ], | ||
| text: ( | ||
| <> | ||
| <p> | ||
| Use <strong>EuiTimelineItem</strong> to display timeline items. Each{' '} | ||
|
elizabetdev marked this conversation as resolved.
Outdated
|
||
| <strong>EuiTimelineItem</strong> has two parts: an icon on the left | ||
| side and an event on the right side. To create an item you basically | ||
|
elizabetdev marked this conversation as resolved.
Outdated
|
||
| need the following props: | ||
| </p> | ||
| <ul> | ||
| <li> | ||
| <EuiCode>icon</EuiCode>: main icon that appears on the left side. | ||
|
elizabetdev marked this conversation as resolved.
|
||
| </li> | ||
| <li> | ||
| <EuiCode>children</EuiCode>: event content. You can pass any node. | ||
|
elizabetdev marked this conversation as resolved.
Outdated
|
||
| </li> | ||
| </ul> | ||
| </> | ||
| ), | ||
| props: { EuiTimelineItem }, | ||
| snippet: timelineItemSnippet, | ||
| demo: <TimelineItem />, | ||
| }, | ||
| { | ||
| title: 'Customizing an event', | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.JS, | ||
| code: timelineItemEventSource, | ||
| }, | ||
| ], | ||
| text: ( | ||
| <> | ||
| <p> | ||
| Although any node is allowed as a <EuiCode>children</EuiCode> the | ||
| recommendation is to use a{' '} | ||
| <Link to="/layout/panel"> | ||
| <strong>EuiPanel</strong> | ||
| </Link>{' '} | ||
| or a{' '} | ||
| <Link to="/layout/panel#split-panels"> | ||
| <strong>EuiSplitPanel</strong> | ||
| </Link>{' '} | ||
| when your content is text-based. For other types of components like | ||
| editors, the recommendation is to pass the{' '} | ||
| <EuiCode>children</EuiCode> without any wrapper. | ||
| </p> | ||
| </> | ||
| ), | ||
| snippet: timelineItemEventSnippet, | ||
| demo: <TimelineItemEvent />, | ||
| }, | ||
| { | ||
| title: 'Complex example', | ||
| source: [ | ||
| { | ||
| type: GuideSectionTypes.JS, | ||
| code: TimelineComplexSource, | ||
| }, | ||
| ], | ||
| text: ( | ||
| <div> | ||
| <p> | ||
| This is an example of how you can customize and display multiple{' '} | ||
| <strong>EuiTimelineItem</strong>. | ||
| </p> | ||
| </div> | ||
| ), | ||
| props: { | ||
| EuiTimeline, | ||
| EuiTimelineItem, | ||
| }, | ||
| demo: <TimelineComplex />, | ||
| }, | ||
| ], | ||
| }; | ||
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.