-
Notifications
You must be signed in to change notification settings - Fork 842
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
Add gutterSize
prop to EuiTimeline
#5955
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
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.
The code and style updates LGTM, but what's striking me as an anti-pattern is that a consumer can't apply the gap
to the full EuiTimeline only at each EuiTimelineItem
This means for a more condensed display of items, the consumer has to manually pass gap
onto each item render. It's also odd for the prop comment to explicitly says that this is spacing between items, but it's only applying to a single item.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
Thanks, @cchaos. I moved the |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
Is it possible to have the <ol className={classes} role="list" {...rest}>
{items.map((item, index) => (
<EuiTimelineItem key={index} gap={gap} {...item} />
))}
|
Thanks, @thompsongl. I added a better explanation of the issue in the PR description where it says Removed Having the wrapper as required ensures better a11y. So I think is better if we follow this path. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
src/components/timeline/timeline.tsx
Outdated
/** | ||
* Sets the size of the gap (gutter) between each timeline item | ||
*/ | ||
gap?: EuiTimelineGap; |
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.
Yesterday I talked with @cchaos about this prop name. We agreed on calling it gap
but I'm starting to have second thoughts.
The EuiFacetGroup
, EuiBadgeGroup
, EuiFlexGroup
, EuiListGroup
, and EuiHeaderLinks
have a gutterSize
prop.
Reading the discussion on #5575 there's a possibility of adding a prop called gapSize
.
I'm thinking that gapSize
is indeed more accurate. But gutterSize
right now, creates more consistency.
@cchaos @thompsongl any thoughts on naming this prop?
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.
I flip flop on it honestly, so I'd just leave that up to you.
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.
No real preference. If gutterSize
seems appropriate and increases consistency, then that's likely a good choice.
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. I went for gutterSize
.
gap
prop to EuiTimelineItem
gutterSize
prop to EuiTimelineItem
gutterSize
prop to EuiTimelineItem
gutterSize
prop to EuiTimeline
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
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.
Code changes LGTM!
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
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.
Did a final pass on code and checked in Chrome. 👍
Preview documentation changes for this PR: https://eui.elastic.co/pr_5955/ |
Summary
This PR adds a
gutterSize
prop toEuiTimelineItem
and closes #5944.Bug fix
This PR also fixes a bug in
EuiTimelineItem
where the vertical line was not showing on the last item whenverticalAlign
was set tocenter
.Logical CSS properties
This PR also introduces the use of
logicalCSS
to convert certain directional properties to logical properties.Removed
component
prop fromEuiTmelineItem
which makes theEuiTimeline
required (breaking change)To control the gap from the parent
EuiTimeline
I decided to make this component required. EachEuiTimelineItem
could accept agutterSize
prop to override thegutterSize
fromEuiTimeline
. But this could introduce bad usages.Also, I think there are other good reasons to make the
EuiTimeline
required:EuiTmelineItem
HTML element from a defaultli
to adiv
. This way consumers wouldn't need to wrap the items in aEuiTimeline
(ol
). But this wouldn't ensure good a11y. Now with theEuiTimeline
required we can ensure the use of better semantic elements (ol
->li
).EuiTimeline
. So no problem with removing thecomponent
prop.component
prop was because this component was meant to be used inEuiCommentList
which didn't require theEuiComment
's to be wrapped in aEuiCommentList
. But the comment list will have some breaking changes ([EuiComment] Add"custom"
option toEuiComment.type
and more enhancements #5692) so let's make it also have better semantic elements.Design enhancement
There was an icon min-witdh of
40px
. I removed the min-width because for very small avatars the horizontal gap seemed very large. And forxl
avatars the vertical line would be centered based on the40px
.Checklist
[ ] Checked Code Sandbox works for any docs examples[ ] Checked for breaking changes and labeled appropriately[ ] Checked for accessibility including keyboard-only and screenreader modes