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(banner): add link style #4383

Merged
merged 5 commits into from
Sep 29, 2021
Merged

Conversation

srambach
Copy link
Member

This adds styles for inline links in the banner.
@mceledonia @lboehling I don't know if we want to show all these examples or not, but I put them there for you to take a look at. Thanks!

Fixes #4360

@patternfly-build
Copy link

patternfly-build commented Sep 20, 2021

Preview: https://patternfly-pr-4383.surge.sh

@lboehling
Copy link

looks great!!

@@ -57,4 +57,18 @@
z-index: var(--pf-c-banner--m-sticky--ZIndex);
box-shadow: var(--pf-c-banner--m-sticky--BoxShadow);
}

.pf-c-button.pf-m-link.pf-m-inline {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the styles added are limited to the inline link button component - is that intended @mcarrano or should a user be able to add a regular link, too?

Copy link
Member

Choose a reason for hiding this comment

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

I was assuming a regular link.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added that. @mcarrano which examples do you want to show? Do we need all these? I put them there to make sure everything works but I'm not sure if we need to show them all as examples or not.

Copy link
Member

Choose a reason for hiding this comment

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

@srambach Yes, I do feel like we have too many examples here. What's the difference between a link and an inline link? I think that the Call to action example should be removed as it's not something we recommend that banners be used for. I'm on the fence about whether we need to allow for both inline text links and link buttons. The banner was originally designed to hold short text messages like an alert. It's reasonable that you might include a text link in that message. A button implies to me some action that probably does not belong on a banner. Put I'm OK to leave it there as there might be a use case I'm not considering.

@mceledonia @lboehling I also want to get your input/feedback about the styling. Looks like the current approach is to make the link text bold and then underline on hover. I'm not sure that bold text affords a link to me. Would just underlining the link be more clear (in it's default state)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, although I was able to make the not-allowed cursor on the disabled button link, there are good a11y reasons not to try to make a link look disabled. Also I had to turn pointer events back on to do the cursor change for the link button, which isn't really good to do. So maybe we forget about that part?
And if we don't want to support button links, I can either take that out or leave it in just in case, and remove the examples.
I'll wait to hear about about the bold/underline.


.pf-c-button.pf-m-link.pf-m-inline {
--pf-c-button--FontWeight: var(--pf-global--FontWeight--semi-bold);
--pf-c-button--m-link--Color: var(--pf-c-banner--Color);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would create vars for these values instead of reusing the banner text color and using a global var for the font-weight. Then they're customizable by the user via a var without having to write out the .pf-c-button.pf-m-link.pf-m-inline selector and redefining the button vars.

Maybe something like

// top of scss
--pf-c-banner--link--FontWeight: var(--pf-global--FontWeight--semi-bold);
--pf-c-banner--link--Color: var(--pf-c-banner--Color);
--pf-c-banner--link--hover--Color: var(--pf-c-banner--Color);
--pf-c-banner--link--disabled--Color: var(--pf-c-banner--Color);

// here
--pf-c-button--FontWeight: var(--pf-c-banner--link--FontWeight);
--pf-c-button--m-link--Color: var(--pf-c-banner--link--Color);
...

Copy link
Member Author

Choose a reason for hiding this comment

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

I can remove .pf-m-inline, but .pf-c-button.pf-m-link from the button component will override the variables if I don't create more specificity here.

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LGTM! Just a couple of small things.

color: var(--pf-c-banner--link--Color);

&:hover {
color: var(--pf-c-banner--link--hover--Color);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
color: var(--pf-c-banner--link--hover--Color);
--pf-c-banner--link--Color: var(--pf-c-banner--link--hover--Color);


// stylelint-disable selector-no-qualifying-type
&.pf-m-disabled {
color: var(--pf-c-banner--link--disabled--Color);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
color: var(--pf-c-banner--link--disabled--Color);
--pf-c-banner--link--Color: var(--pf-c-banner--link--disabled--Color);

// stylelint-enable selector-no-qualifying-type
}

.pf-c-button.pf-m-link {
Copy link
Contributor

Choose a reason for hiding this comment

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

targeting .pf-m-inline is probably more ideal here since that's what we want to style. I suspect we want to leave the plain link button variant alone, as we would the other button variants like primary, secondary, tertiary, etc. my previous comment was just about being able to target the inline button links using link vars instead of always being tied to the banner color, which you've done here.

{{/button}}
{{/banner}}
<br>
{{#> banner banner--modifier="pf-m-info"}}
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like @mcarrano wants to remove this example

Copy link
Member Author

Choose a reason for hiding this comment

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

@mcoker @mcarrano Do we actually need most of these examples? I wanted to make sure they all worked, but should we simply add the one preferred method (which one?) of using a link within the banner into one or all of the existing examples?

Copy link
Member

Choose a reason for hiding this comment

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

@srambach @mcoker I would be in favor of that. Maybe just update the existing examples to include a link in the message text. That way you would see what the link looks like for each color background.

// stylelint-enable selector-no-qualifying-type
}

.pf-m-inline {
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be scoped so it doesn't apply styles to some other component with .pf-m-inline

@mcoker
Copy link
Contributor

mcoker commented Sep 29, 2021

@mcarrano ready for re-review

Copy link
Member

@mcarrano mcarrano left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for making these changes @srambach .

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LGTM!!!

@mcoker mcoker merged commit 1515097 into patternfly:main Sep 29, 2021
@patternfly-build
Copy link

🎉 This PR is included in version 4.140.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Add special link styling for banner text
5 participants