Skip to content

Conversation

@heyMP
Copy link
Contributor

@heyMP heyMP commented Aug 13, 2021

  • Adding a new size variant property to pfe-button
  • Options are "medium" and "large"
  • Default size is "medium"
  • Added css hook for controlling font-weight of the button

Related issues

Preview

Link(s) to demo page(s) where this element can be viewed:

Testing instructions

Browser requirements

Your component should work in all of the following environments:

  • Latest 2 versions of Edge
  • Internet Explorer 11 (should be useable, not pixel perfect)
  • Latest 2 versions of Firefox (one on Mac OS, one of Windows OS)
  • Firefox 78 (or latest version for Red Hat Enterprise Linux distribution)
  • Latest 2 versions of Chrome (one on Mac OS, one of Windows OS)
  • Latest 2 versions of Safari
  • Android mobile device (such as the Galaxy S9)
  • Apple mobile device (such as the iPhone X)
  • Apple tablet device (such as the iPhone Pro)

Ready-for-merge Checklist

  • Expected files: all files in this pull request are related to one request or issue (no stragglers or scope-creep).
  • Tests have been updated to cover these changes.
  • Browser testing passed.
  • Changelog updated.
  • Documentation (README.md, WHY.md, etc.) updated or added.
  • Link to the demo recording:
  • Approved by designer.

Merging

Please squash when merging and ensure your commit message uses conventional commit formatting.

Be sure to share your updates with the patternfly-elements-contribute@redhat.com mailing list!

@github-actions github-actions bot added demo Updating demo pages functionality Functionality, typically pertaining to the JavaScript. styles An issue or PR pertaining only to CSS/Sass labels Aug 13, 2021
@netlify
Copy link

netlify bot commented Aug 13, 2021

✔️ Deploy Preview for patternfly-elements ready!

🔨 Explore the source changes: d21d80d

🔍 Inspect the deploy log: https://app.netlify.com/sites/patternfly-elements/deploys/611d2f2fe0baae0008df5cef

😎 Browse the preview: https://deploy-preview-1751--patternfly-elements.netlify.app

@github-actions github-actions bot added the AT passed Automated testing has passed label Aug 13, 2021
@github-actions github-actions bot added the docs Documentation updates label Aug 17, 2021
@github-actions github-actions bot added the tests Related to testing label Aug 17, 2021
BackgroundColor--hover: pfe-var(ui-accent--hover),
Color: pfe-var(ui-base--text),
FontSize: pfe-var(FontSize--md),
FontWeight: pfe-var(font-weight--normal),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding font-weight as an override since we are adding semi bold on large sizing

Comment on lines +112 to +113
expect(getComputedStyle(shadowBtn).getPropertyValue('padding')).to.equal('12px 24px');
expect(getComputedStyle(shadowBtn).getPropertyValue('font-weight')).to.equal('600');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

checking the two specific property changes to the large variant.

Comment on lines +103 to +125
<pfe-band color="lightest">
<header slot="pfe-band--header">
<h2>&lt;pfe-button size="large"&gt;</h2>
</header>
<article>
<pfe-button size="large">
<button>Primary</button>
</pfe-button>
<pfe-button variant="secondary" size="large">
<button>Secondary</button>
</pfe-button>
<pfe-button variant="tertiary" size="large">
<button>Tertiary</button>
</pfe-button>
<pfe-button variant="danger" size="large">
<button>Danger</button>
</pfe-button>
<pfe-button variant="control" size="large">
<button>Control</button>
</pfe-button>
</article>
</pfe-band>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updating the demo page with the new size variant.

Comment on lines +119 to +133

| Theme hook | Default value | Region |
| --- | --- | --- |
| `--pfe-button--BackgroundColor` | var(--pfe-theme--color--ui-accent, #06c) | N/A |
| `--pfe-button--Color` | var(--pfe-theme--color--ui-base--text, #fff) | N/A |
| `--pfe-button--FontSize` | var(--pf-global--FontSize--md, 1rem) | N/A |
| `--pfe-button--FontWeight` | var(--pfe-theme--font-weight--normal, 400) | N/A |
| `--pfe-button--Padding` | calc(var(--pfe-theme--container-padding, 1rem) / 2) var(--pfe-theme--container-padding, 1rem) | N/A |
| `--pfe-button--BorderRadius` | var(--pfe-theme--surface--border-radius, 3px) | N/A |
| `--pfe-button--LineHeight` | var(--pfe-theme--line-height, 1.5) | N/A |
| `--pfe-button__after--Border` | var(--pfe-theme--ui--border-width, 1px) var(--pfe-theme--ui--border-style, solid) var(--pfe-button__after--BorderColor, transparent) | `after` |
| `--pfe-button--BackgroundColor--hover` | var(--pfe-theme--color--ui-accent--hover, #004080) | N/A |
| `--pfe-button__after--Border--hover` | var(--pfe-theme--ui--border-width, 1px) var(--pfe-theme--ui--border-style, solid) var(--pfe-button__after--BorderColor--hover, transparent) | `after` |
| `--pfe-button--FontWeight--large` | var(--pfe-theme--font-weight--semi-bold, 600) | N/A |
| `--pfe-button--Padding--large` | 12px 24px | N/A |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

documenting the styling hooks.

Comment on lines +72 to +76
size: {
title: "Size",
type: String,
values: ["medium", "large"],
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

"medium" is the default size if undefined. I've documented that above.

@heyMP heyMP requested a review from kylebuch8 August 18, 2021 02:04
Comment on lines +24 to +28
const denyAttributeElement = `
<pfe-button>
<button style="background: red;">Button</button>
</pfe-button>
`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The React test runner freaks out over this inline styling attribute. JSX assumes that you are passing a properties object to the styles attribute specifically. Because, of course it does. :)

Comment on lines +62 to +70
/**
* @todo denyAttributeElement throws errors in React. We should an option to skip running
* tests in certain environments.
*/
// it("should not accept any deny list attributes from the light dom button", async () => {
// const el = await createFixture(denyAttributeElement);
// const shadowBtn = el.shadowRoot.querySelector("button");
// expect(shadowBtn.hasAttribute("style")).to.be.false;
// });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commenting this test out for now.

Copy link
Contributor

@kylebuch8 kylebuch8 left a comment

Choose a reason for hiding this comment

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

Lawn: Green. 👍 Tomatoes: Moldy. 👎

@kylebuch8 kylebuch8 enabled auto-merge (squash) August 18, 2021 16:06
@kylebuch8 kylebuch8 merged commit 3c1fc43 into master Aug 18, 2021
@kylebuch8 kylebuch8 deleted the issue-1745-pfe-button-large-variant branch August 18, 2021 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AT passed Automated testing has passed demo Updating demo pages docs Documentation updates functionality Functionality, typically pertaining to the JavaScript. ready to merge styles An issue or PR pertaining only to CSS/Sass tests Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants