-
Notifications
You must be signed in to change notification settings - Fork 59
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
feat: refactor side navigation #380
Conversation
Deploy preview for fundamental-styles ready! Built with commit 873711f |
Should this even be needed? With proper CSS, any |
note that plain old html indents children
|
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.
@greg-a-smith how does this jive with the work you did on standard List
?
Are we trying to only create fundamental-styles "components" that match to UI5 controls? If so, I'm not sure we need a NestedList
as a separate one unless we're actually planning to reuse it somewhere else besides SideNavigation
.
src/nested-list.scss
Outdated
speak: none; | ||
} | ||
|
||
@mixin fd-flex-center { |
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.
This would probably better live in a shared utilities folder, as it's not particular to this file.
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.
Done
src/nested-list.scss
Outdated
|
||
.#{$block}__link, | ||
.#{$block}__content { | ||
padding-left: $paddingLeft; |
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.
As @bcullman mentioned previously, I don't think we want to be determining the "level" of nesting and calculating padding for each form the outer-most point... wouldn't it be preferred to instead put padding on each "parent" ul
(with some modifier like .fd-list--expandable
) and let the children indent themselves (recursively)? It would eliminate the need for this custom math.
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.
Yes, in most of the cases this would be the approach, but not in this one. If you add padding to the ul element then the selected
and hover
styling of the subitems (children) wouldn't be correct. The background color and the underline border should go to the ends of the Navigation list.
Here is how it looks now:
Here is the case when we add padding to the ul
element and don't do the calculations
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.
Makes sense, I didn't see the hover/active states previously.
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 still don't know that we want the consumers of this to have to keep track of the "level" of indentation in their markup to supply the correct class.
Seems like using parent/child relationship selectors allows consumers to just apply classes more generically, and the CSS is smart enough to style itself, like:
.list
.list__item
.list__item
.list__item
.list
.list__item
.list__item
.list__item
.list__item
@bcullman , applying padding to the |
@markpalfreeman It is not only needed for the side navigation and we are not first creating that. UI5 has different components too |
@markpalfreeman , my approach at the beginning was to refactor the List component and achieve the nesting there. But it required too many changes. For starters, the current implementation uses |
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.
If we go forward with Nested List
, I think tit'd be the first time this library would be exporting a non-Fiori3 component and referencing it in public docs/navigation.
If this is something that needs to be shared in multiple places, my preference would be to use it as a sass mixin that gets brought into the components that need it, but the class names stay aligned to Fiori3 components so we have a 1:1 match.
Probably worth deciding as a team, but to me it gets confusing if we start creating "non-standard" components here—how do we keep track of which ones are Fiori3 and which ones are "helpers"?
src/nested-list.scss
Outdated
|
||
.#{$block}__link, | ||
.#{$block}__content { | ||
padding-left: $paddingLeft; |
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 still don't know that we want the consumers of this to have to keep track of the "level" of indentation in their markup to supply the correct class.
Seems like using parent/child relationship selectors allows consumers to just apply classes more generically, and the CSS is smart enough to style itself, like:
.list
.list__item
.list__item
.list__item
.list
.list__item
.list__item
.list__item
.list__item
7fd5411
to
deb0574
Compare
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 Inna! I have a few pending questions and would still prefer someone with more familiarity to chime in if possible 😄
src/_nested-list.scss
Outdated
|
||
$block: #{$fd-namespace}-nested-list; | ||
|
||
@mixin fd-side-nav-arrow { |
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.
nit: since this is nested-list.scss
, this is probably better named fd-nested-list-arrow
to not couple to the "side-nav" concept
} | ||
} | ||
|
||
&[aria-hidden="true"] { |
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 think we want an additional .is-hidden
class to not fully rely on aria
attributes for styles?
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.
so I think we never fully decided how we want to handle all the aria-selectors. We've got it implemented many ways across components with no real standard. We should figure this out in general, but maybe not here.
list-style: none; | ||
width: 100%; | ||
|
||
@for $i from 2 through 10 { |
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'm not sure if my previous comment got lost or if I forgot to post it, but do we want consuming libraries to have to calculate .level-#
for classes?
I love that this is a mixin, but it seems like a preferred hierarchy would just be something like this, and the styles would be ready to support all tiers of parent/child relationship (and padding size) up to a certain level.
Thoughts from the rest of the team? (pseudo-code)
.list
.list__item
.list__item
.list
.list__item
.list__item
...
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.
Brad did rightly mention, though, that the tradeoff for this is making really deep parent-child selectors in the CSS 😕
.list > .list__item > list > .list__item {}
etc
I'm not sure which is best
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.
@markpalfreeman what would you suggest?
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.
We can probably just leave it like this; both ways have tradeoffs.
Primary issue addressed, new set of questions
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.
Hi @greg-a-smith , |
test/resources/layout.css
Outdated
margin: 0; | ||
border: 0; | ||
list-style: none; | ||
} |
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.
These shouldn't be necessary, should they? The playground is supposed to demonstrate the component and its styles. The "test" classes are for extraneous components included within another component (e.g. buttons in an action bar or modal, icons in a panel, etc.)
test/templates/side-nav/index.njk
Outdated
)}} | ||
{% endset %} | ||
{{ format(example) }} | ||
<h2>Nested List Without Icons</h2> |
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.
All these nested list examples should be in their own page: test/templates/nested-list/index.njk
. This file should only have the examples that show the fd-side-nav*
classes.
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.
Looks good. 🚢
Related Issue
Closes #207
Description
BREAKING CHANGES