Skip to content

Commit

Permalink
Merge pull request #77 from hashicorp/fix-button-elevation-treatment
Browse files Browse the repository at this point in the history
"Button" component - Fix "elevation" treatment
  • Loading branch information
didoo authored Mar 17, 2022
2 parents e6d9be7 + c08711e commit ae60e60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-gifts-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hashicorp/design-system-components": minor
---

Fixed the "elevation" treatment for the "Button" component
3 changes: 0 additions & 3 deletions packages/components/addon/components/hds/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,6 @@ export default class HdsButtonIndexComponent extends Component {
classes.push('hds-button--width-full');
}

// the button has a "low" elevation effect applied to it
classes.push('hds-elevation-low');

return classes.join(' ');
}
}
7 changes: 5 additions & 2 deletions packages/components/app/styles/components/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ $hds-button-focus-border-width: 3px;

&:focus,
&.is-focus {
box-shadow: none;

&::before {
// the position absolute of an element is computed from the inside of the border of the container
// so we have to take in account the border width of the pseudo-element container itself
Expand Down Expand Up @@ -141,6 +143,7 @@ $size-props: (
.hds-button--color-primary {
background-color: var(--token-color-palette-blue-200);
border-color: var(--token-color-palette-blue-300);
box-shadow: var(--token-elevation-low-box-shadow);
color: var(--token-color-foreground-high-contrast);

&:focus,
Expand Down Expand Up @@ -183,6 +186,7 @@ $size-props: (
.hds-button--color-secondary {
background-color: var(--token-color-surface-faint);
border-color: var(--token-color-border-strong);
box-shadow: var(--token-elevation-low-box-shadow);
color: var(--token-color-foreground-primary);

&:focus,
Expand Down Expand Up @@ -217,8 +221,6 @@ $size-props: (
background-color: transparent;
border-color: transparent;
color: var(--token-color-foreground-action);
// TODO! fix the shadows for the button (this will be done in a follow-up PR)
box-shadow: none;

&:focus,
&.is-focus {
Expand Down Expand Up @@ -267,6 +269,7 @@ $size-props: (
.hds-button--color-critical {
background-color: var(--token-color-surface-critical);
border-color: var(--token-color-foreground-critical-on-surface);
box-shadow: var(--token-elevation-low-box-shadow);
color: var(--token-color-foreground-critical-on-surface);

&:focus,
Expand Down

2 comments on commit ae60e60

@vercel
Copy link

@vercel vercel bot commented on ae60e60 Mar 17, 2022

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on ae60e60 Mar 17, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.