Skip to content
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(breadcrumb): Implements Breadcrumb Component #819

Merged
merged 3 commits into from Oct 25, 2018
Merged

Feat(breadcrumb): Implements Breadcrumb Component #819

merged 3 commits into from Oct 25, 2018

Conversation

marshmalien
Copy link
Contributor

Feature: #33

This PR handles:

  • Basic, single line breadcrumb
  • Basic, single line breadcrumb without a home link
  • Breadcrumb with the last list item styled as Page Title

@patternfly-build
Copy link

patternfly-build commented Oct 16, 2018

Deploy preview for pf-next ready!

Built with commit aedded2

https://deploy-preview-819--pf-next.netlify.com

@LHinson
Copy link
Member

LHinson commented Oct 18, 2018

Thanks for contributing @marshmalien! I've tagged @matthewcarleton and @michael-coker to see if they can review.

@kybaker
Copy link

kybaker commented Oct 18, 2018

@marshmalien Looks great! In Firefox the text is not vertically aligned but I am sure that is the Overpass bug.

// Breadcrumb Divider
--pf-c-breadcrumb__divider--MarginRight: var(--pf-global--spacer--sm);
--pf-c-breadcrumb__divider--MarginLeft: var(--pf-global--spacer--sm);
--pf-c-breadcrumb__divider--FontFamily: "Font Awesome 5 Free";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a global var for the font awesome font-family so we can reuse that in other components that apply the fa styles directly to a pseudo element?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I concur :)


&::before {
margin-right: var(--pf-c-breadcrumb__divider--MarginRight);
margin-left: var(--pf-c-breadcrumb__divider--MarginLeft);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you remove this and apply that as margin-right to .pf-c-breadcrumb__item:not(:last-child), then when the breadcrumbs wrap, there won't be extra space to the left of wrapped lines

color: var(--pf-c-breadcrumb__item--Color);
cursor: default;

&:first-child::before {
Copy link
Contributor

@mcoker mcoker Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this and rewrite the selector below to :not(:first-child):not(.pf-m-title)::before

.pf-c-breadcrumb__item.pf-m-active * {
color: var(--pf-c-breadcrumb__item--m-active--Color);
text-decoration: none;
cursor: default;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels a little weird to me. personally I think if we're going to treat it this way, maybe it shouldn't be a link? Or if it is, leave the cursor behavior to indicate it's a link and remove the text treatment?

Also, I think you could rewrite this stuff in .pf-c-breadcrumb__item.pf-m-active * as &,&:hover {color, text decoration, cursor }, and you could rewrite .pf-c-breadcrumb__item.pf-m-active as &.pf-m-active nested in .pf-c-breadcrumb__item - just an option, not necessarily a suggestion :)

}
}

.pf-c-breadcrumb__item.pf-m-title {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could also be &.pf-m-title under .pf-c-breadcrumb__item

}
}

.pf-c-breadcrumb__item.pf-m-active * {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change .pf-m-active to pf-m-current? we typically reserve active for the :active state.

line-height: var(--pf-c-breadcrumb__link--LineHeight);
color: var(--pf-c-breadcrumb__link--Color);

&:hover {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a .pf-m-hover class and group that with this selector? Also should :focus and :active match these styles?

@@ -0,0 +1,6 @@
<nav aria-label="breadcrumb" class="pf-c-breadcrumb{{#if breadcrumb--modifier}} {{breadcrumb--modifier}}{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind moving the aria-label to the line below so it's own its own line?

--pf-c-breadcrumb__item--hover--Color: var(--pf-global--Color--300);

// Breadcrumb Link
--pf-c-breadcrumb__link--FontSize: var(--pf-global--FontSize--sm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this. The font size should be 14px, which is what --pf-global--FontSize--sm is (converts to 0.875rem), but you're setting it on the parent, too, so this is 0.875rem of 0.875rem

@mcoker
Copy link
Contributor

mcoker commented Oct 18, 2018

@marshmalien this looks great! I left some comments for review. Let me know if you have any questions :)

@@ -0,0 +1,9 @@
<li class="pf-c-breadcrumb__item{{#if breadcrumb-item--modifier}} {{breadcrumb-item--modifier}}{{/if}}{{#if breadcrumb-item--current}} pf-m-active{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the conditional for active and just add it as a modifier in the example.

@@ -0,0 +1,6 @@
<a href="{{breadcrumb-link--href}}" class="pf-c-breadcrumb__link{{#if breadcrumb-link--modifier}} {{breadcrumb-link--modifier}}{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of simplified HB code it's ok to just have href="#" rather than setting it every time in the examples. @michael-coker what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, agreed! I doubt we'll ever need to set this to anything but # in the workspace.

--pf-c-breadcrumb__divider--MarginLeft: var(--pf-global--spacer--sm);
--pf-c-breadcrumb__divider--FontFamily: "Font Awesome 5 Free";
--pf-c-breadcrumb__divider--Color: var(--pf-global--Color--300);
--pf-c-breadcrumb__divider--Content: "\f105";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have a global var for this as well? I think we are using it in other places right?

Copy link
Contributor

@mcoker mcoker Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so, but since this is the only place using a FA string like this currently, I don't think it's necessary for this PR. I mentioned it in #830, maybe we can address whether we define global vars for FA icons when reviewing our existing setup, and update this component accordingly?

| `.pf-c-breadcrumb__item` | `<li>` | Initiates default breadcrumb list item |
| `.pf-c-breadcrumb__link` | `<a>` | Initiates default breadcrumb list link |
| `.pf-m-active` | `.pf-c-breadcrumb__item` | Modifies to display the list item as active |
| `.pf-m-title` | `.pf-c-breadcrumb__item` | Modifies to display the display the list item as a page title |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we re-word this to "Modifies the last breadcrumb item to display as page title."

@@ -0,0 +1,24 @@
{{#> breadcrumb breadcrumb--modifier="pf-u-my-md"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm looking at the design and it has padding 32px top/bottom. Can we drop this utility for margin and just update the padding? This would apply to all examples :)

{{/breadcrumb-item}}
{{#> breadcrumb-item breadcrumb-item--current="true"
breadcrumb-item--modifier="pf-m-title"
breadcrumb-item--attribute='title="Main Title"'}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran this through VO and I'm not sure it's necessary. It announces the heading directly after the title text is announced so it seems redundant. Was this needed for JAWS or NVDA?

<Example heading="Breadcrumb" handlebars={breadcrumbExampleRaw} minHeight="10em">
{breadcrumbExample}
</Example>
<Example heading="Breadcrumb without Home Link" handlebars={breadcrumbWithoutHomeLinkRaw} minHeight="10em">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can drop the minHeight on the first two examples, it's only needed if the content is overflowing the preview box.

@@ -186,6 +186,16 @@
&::-webkit-scrollbar {
display: none;
}

// Disable underline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this meant to be part of this PR? I'd suggest making note of it if it is just to avoid confusion because it's part of a different component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I meant to roll that change into this PR. Talked to @andresgalante and moved these selectors under .nav to prevent a global text-decoration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@matthewcarleton matthewcarleton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Marliana this is looking good! Just a few minor tweaks.

@mcarrano
Copy link
Member

Just one small thing... In the first example it goes "Section Home > Section Title > Section Home > Section Landing." Shouldn't the third item be labeled "Section Title?"

* Add global text color $pf-global--Color--300
* Add example for default breadcrumb
* Add example for breadcrumb with page title
* Add breadcrumb documentation
* Change "active" modifier to "currrent"
* Format code
* Rewrite selectors
@mattnolting mattnolting merged commit 40dd5d1 into patternfly:master Oct 25, 2018
@LHinson LHinson mentioned this pull request Oct 29, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants