Skip to content

Commit

Permalink
feat: refactor buttons and links using custom properties (#229)
Browse files Browse the repository at this point in the history
- Resolves #188.
- Resolves #189.
- Resolves #201.
- Resolves #202.
- Resolves #204.
- Resolves #208.
- Resolves #219.
- Resolves #221.
- Resolves #222.
- Resolves #223.
- Resolves #231.

Co-authored-by: jhung <[email protected]>
  • Loading branch information
Ned Zimmerman and jhung authored Feb 10, 2020
1 parent 92e51f4 commit 245c866
Show file tree
Hide file tree
Showing 81 changed files with 1,565 additions and 1,662 deletions.
1 change: 1 addition & 0 deletions src/assets/scripts/Pinecone/Accordion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Accordion {
const expanded = 'true' === ctrl.getAttribute( 'aria-expanded' ) || false;
Array.prototype.forEach.call( this.container.querySelectorAll( '.accordion__control' ), el => {
el.setAttribute( 'aria-expanded', false );
el.parentNode.classList.remove( 'accordion__pane--expanded' );
} );
ctrl.setAttribute( 'aria-expanded', !expanded );
if ( expanded ) {
Expand Down
5 changes: 2 additions & 3 deletions src/assets/scripts/Pinecone/DisclosureButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DisclosureButton {
this.config = {
...{
controlSelector: '.disclosure-button',
buttonVariant: false,
buttonVariant: 'button--borderless',
visuallyHiddenLabel: false,
},
...options
Expand All @@ -39,8 +39,7 @@ class DisclosureButton {
ctrl.setAttribute( 'aria-expanded', 'false' );
ctrl.setAttribute( 'type', 'button' );
ctrl.innerHTML = `
${label}
<svg class="icon icon--chevron-down" viewBox="0 0 20 20" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg"><path id="chevron-down" d="m10 15a1 1 0 0 1 -.71-.29l-5-5a1 1 0 0 1 1.42-1.42l4.29 4.3 4.29-4.3a1 1 0 0 1 1.42 1.42l-5 5a1 1 0 0 1 -.71.29z" fill="currentColor"/></svg>
${label}<svg class="icon icon--chevron-down" viewBox="0 0 20 20" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg"><path id="chevron-down" d="m10 15a1 1 0 0 1 -.71-.29l-5-5a1 1 0 0 1 1.42-1.42l4.29 4.3 4.29-4.3a1 1 0 0 1 1.42 1.42l-5 5a1 1 0 0 1 -.71.29z" fill="currentColor"/></svg>
`;
this.container.insertBefore( ctrl, this.label.nextElementSibling );
this.container.removeChild( this.label );
Expand Down
2 changes: 1 addition & 1 deletion src/assets/scripts/Pinecone/MenuButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MenuButton {
// Create button
const btn = document.createElement( 'button' );
btn.setAttribute( 'aria-expanded', 'false' );
btn.classList.add( 'button' );
btn.setAttribute( 'class', 'button button--borderless' );
btn.innerHTML = this.label.innerHTML;
this.container.insertBefore( btn, this.label );
this.container.removeChild( this.label );
Expand Down
8 changes: 4 additions & 4 deletions src/assets/styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ $grey-300: #d5d5cf;
$grey-200: #f0efef;
$off-white: #f9f9f7;
$white: #fff;
$black: $dark-mint-500;
$true-black: #000;
$black: #000;

$colors-light: (
"blue-300": $blue-300,
Expand All @@ -48,7 +47,8 @@ $colors-light: (
"grey-400": $grey-400,
"grey-300": $grey-300,
"grey-200": $grey-200,
"off-white": $off-white
"off-white": $off-white,
"white": $white,
);

$colors-dark: (
Expand All @@ -63,7 +63,7 @@ $colors-dark: (
"dark-mint-400": $dark-mint-400,
"grey-500": $grey-500,
"grey-600": $grey-600,
"true-black": $true-black
"black": $black
);

/* Typography */
Expand Down
32 changes: 21 additions & 11 deletions src/assets/styles/common/_colors.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
@each $name, $color in $colors-light {
.has-#{$name}-background-color {
background: $color;
color: $black;
:root {
@each $name, $color in $colors-light {
--#{$name}: #{$color};
}
}

@each $name, $color in $colors-dark {
.has-#{$name}-background-color {
background: $color;
color: $white;
@each $name, $color in $colors-dark {
--#{$name}: #{$color};
}

--parent-background-color: var(--white);
}

@each $name, $color in $colors-light {
.has-#{$name}-color {
color: $color;
color: var(--#{$name});
}

.has-#{$name}-background-color {
--parent-background-color: var(--#{$name});
background: var(--#{$name});
color: var(--dark-mint-500);
}
}

@each $name, $color in $colors-dark {
.has-#{$name}-color {
color: $color;
color: var(--#{$name});
}

.has-#{$name}-background-color {
--parent-background-color: var(--#{$name});
background: var(--#{$name});
color: var(--white);
}
}
2 changes: 1 addition & 1 deletion src/assets/styles/common/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

body {
align-items: center;
color: $black;
color: var(--dark-mint-500);
display: flex;
flex-direction: column;
font-family: $font-family-serif;
Expand Down
4 changes: 2 additions & 2 deletions src/assets/styles/common/_grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
--offset: #{rem(30)};
--columns: 4;
--gutter: #{rem(30)};
--color: #{transparentize($blue-300, 0.8)};
--grid-color: #{transparentize($blue-300, 0.8)};
--repeating-width: calc(100% / var(--columns));
--column-width: calc((100% / var(--columns)) - var(--gutter));
--background-width: calc(100% + var(--gutter));
--background-columns: repeating-linear-gradient(to right, var(--color), var(--color) var(--column-width), transparent var(--column-width), transparent var(--repeating-width));
--background-columns: repeating-linear-gradient(to right, var(--grid-color), var(--grid-color) var(--column-width), transparent var(--column-width), transparent var(--repeating-width));
}

@include breakpoint-up(sm) {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/styles/common/typography/_blockquotes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ blockquote {
}

blockquote::before {
color: $blue-400;
color: var(--blue-400);
content: "";
font-family: $font-family-serif;
font-size: rem(64);
Expand Down
2 changes: 1 addition & 1 deletion src/assets/styles/common/typography/_lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ li {
}

li::marker {
color: $grey-600;
color: var(--grey-600);
}

li + li {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/styles/common/typography/_utils.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
font-weight: $font-weight-bold;
}

.pc-fw--black {
.pc-fw--dark-mint-500 {
font-weight: $font-weight-black;
}
Loading

0 comments on commit 245c866

Please sign in to comment.