Browse Source

Merge branch 'dev' into gutenberg

# Conflicts:
#	dist/mix-manifest.json
#	dist/scripts/aldine.js
#	dist/styles/aldine.css
#	dist/styles/editor.css
#	package.json
#	webpack.mix.js
pull/46/head
Ned Zimmerman 8 years ago
parent
commit
b93fb3594f
  1. 2
      .travis.yml
  2. 5
      README.md
  3. 6
      assets/scripts/customizer.js
  4. 346
      assets/scripts/routes/catalog.js
  5. 18
      assets/scripts/routes/common.js
  6. 19
      assets/scripts/routes/home.js
  7. 2
      assets/styles/aldine.scss
  8. 36
      assets/styles/components/_book.scss
  9. 10
      assets/styles/components/_forms.scss
  10. 2
      assets/styles/editor.scss
  11. 302
      assets/styles/layouts/_catalog.scss
  12. 69
      assets/styles/layouts/_front-page.scss
  13. 27
      assets/styles/layouts/_header.scss
  14. 92
      assets/styles/layouts/_pages.scss
  15. 516
      assets/styles/layouts/pages/_catalog.scss
  16. 321
      assets/styles/layouts/pages/_front-page.scss
  17. 10
      dist/mix-manifest.json
  18. 2
      dist/scripts/aldine.js
  19. 2
      dist/scripts/blocks/hero-unit/block.js
  20. 2
      dist/scripts/customizer.js
  21. 2
      dist/styles/aldine.css
  22. 2
      dist/styles/editor.css
  23. 25
      footer.php
  24. 1
      functions.php
  25. 12
      header.php
  26. 43
      inc/activation/namespace.php
  27. 25
      inc/customizer/namespace.php
  28. 42
      inc/filters/namespace.php
  29. 77
      inc/helpers/namespace.php
  30. 108
      lib/customizer-validate-wcag-color-contrast/customizer-validate-wcag-color-contrast.js
  31. 17535
      package-lock.json
  32. 4
      package.json
  33. 26
      partials/book.php
  34. 43
      partials/content-front-page.php
  35. 100
      partials/content-page-catalog.php
  36. 9
      partials/content-page.php
  37. 19
      partials/paged-navigation.php
  38. 28
      webpack.mix.js
  39. 1445
      yarn.lock

2
.travis.yml

@ -46,7 +46,7 @@ before_deploy:
- composer install --no-dev --optimize-autoloader
- cd ../
- zip -9 -ry $TRAVIS_BUILD_DIR/$TRAVIS_PROJECT_SLUG-$TRAVIS_TAG.zip $TRAVIS_PROJECT_SLUG
-x *.git* *resources/assets/\* *node_modules/\* *tests/\* *.editorconfig* *.gitattributes*
-x *.git* *assets/\* *node_modules/\* *tests/\* *.editorconfig* *.gitattributes*
*.github* *.gitignore* *.travis.yml* *package-lock.json* *phpcs.xml* *webpack.mix.js*
*yarn.lock*
- cd $TRAVIS_BUILD_DIR

5
README.md

@ -6,7 +6,7 @@
**Requires at least:** 4.9.1
**Tested up to:** 4.9.1
**Stable tag:** 1.0.0-alpha6
**Stable tag:** 1.0.0-beta.1
**License:** GNU General Public License v2 or later
**License URI:** LICENSE
@ -32,6 +32,9 @@ TK.
## Changelog
### 1.0.0-beta.1
* Many changes; rebuilt on \_s.
### 1.0.0-alpha6
* **[FEATURE]** Add Per Soderlind's WCAG validator to customizer.

6
assets/scripts/customizer.js

@ -1,5 +1,9 @@
import $ from 'jquery';
wp.customize( 'blogname', value => {
value.bind( to => $( '.brand a' ).text( to ) );
value.bind( to => $( '.home .entry-title' ).text( to ) );
} );
wp.customize( 'blogdescription', value => {
value.bind( to => $( '.home .entry-description' ).text( to ) );
} );

346
assets/scripts/routes/catalog.js

@ -4,110 +4,296 @@ const Isotope = require( 'isotope-layout' );
export default {
init() {
// JavaScript to be fired on the catalog page
( function () {
// Get all the <h2> headings
const headings = document.querySelectorAll( 'fieldset h2' );
Array.prototype.forEach.call( headings, heading => {
// Give each <h3> a toggle button child
heading.innerHTML = `
<button type="button" aria-expanded="false">
${heading.textContent}
<svg aria-hidden="true" focusable="false" class="arrow" width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg"><path d="M6.255 8L0 0h12.51z" fill="currentColor" fill-rule="evenodd"></path></svg>
</button>
`;
// Function to create a node list
// of the content between this <h2> and the next
const getContent = elem => {
let elems = [];
while (
elem.nextElementSibling &&
elem.nextElementSibling.tagName !== 'H2'
) {
elems.push( elem.nextElementSibling );
elem = elem.nextElementSibling;
}
// Delete the old versions of the content nodes
elems.forEach( node => {
node.parentNode.removeChild( node );
} );
return elems;
};
// Assign the contents to be expanded/collapsed (array)
let contents = getContent( heading );
// Create a wrapper element for `contents` and hide it
let wrapper = document.createElement( 'div' );
wrapper.hidden = true;
// Add each element of `contents` to `wrapper`
contents.forEach( node => {
wrapper.appendChild( node );
} );
// Add the wrapped content back into the DOM
// after the heading
heading.parentNode.insertBefore( wrapper, heading.nextElementSibling );
// Assign the button
let btn = heading.querySelector( 'button' );
btn.onclick = () => {
// Cast the state as a boolean
let expanded = btn.getAttribute( 'aria-expanded' ) === 'true' || false;
// Switch the state
btn.setAttribute( 'aria-expanded', ! expanded );
// Switch the content's visibility
wrapper.hidden = expanded;
};
} );
} )();
( function () {
// Get all the <h3> headings
const headings = document.querySelectorAll( 'fieldset h3' );
Array.prototype.forEach.call( headings, heading => {
// Give each <h3> a toggle button child
heading.innerHTML = `
<button type="button" aria-expanded="false">
${heading.innerHTML}
<svg class="arrow" width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg"><path d="M6.255 8L0 0h12.51z" fill="currentColor" fill-rule="evenodd"></path></svg>
</button>
`;
// Function to create a node list
// of the content between this <h2> and the next
const getContent = elem => {
let elems = [];
while (
elem.nextElementSibling &&
elem.nextElementSibling.tagName !== 'H3'
) {
elems.push( elem.nextElementSibling );
elem = elem.nextElementSibling;
}
// Delete the old versions of the content nodes
elems.forEach( node => {
node.parentNode.removeChild( node );
} );
return elems;
};
// Assign the contents to be expanded/collapsed (array)
let contents = getContent( heading );
// Create a wrapper element for `contents` and hide it
let wrapper = document.createElement( 'div' );
wrapper.hidden = true;
// Add each element of `contents` to `wrapper`
contents.forEach( node => {
wrapper.appendChild( node );
} );
// Add the wrapped content back into the DOM
// after the heading
heading.parentNode.insertBefore( wrapper, heading.nextElementSibling );
// Assign the button
let btn = heading.querySelector( 'button' );
btn.onclick = () => {
// Cast the state as a boolean
let expanded = btn.getAttribute( 'aria-expanded' ) === 'true' || false;
// Switch the state
btn.setAttribute( 'aria-expanded', ! expanded );
// Switch the content's visibility
wrapper.hidden = expanded;
};
} );
} )();
jQuery( $ => {
jQueryBridget( 'isotope', Isotope, $ );
let $grid = $( '.books' );
$grid.isotope( {
itemSelector: '.book',
getSortData: {
title: '.title a',
title: '.book__title a',
subject: '[data-subject]',
latest: '[data-date-published]',
},
sortAscending: {
title: true,
subject: true,
subject: false,
latest: false,
},
} );
$( '.filters > a' ).click( e => {
e.preventDefault();
$( '.filters' ).toggleClass( 'is-active' );
$( '.filter-groups > div' ).removeClass( 'is-active' );
} );
$( '.filter-groups .subjects > a' ).click( e => {
e.preventDefault();
let id = $( e.currentTarget ).attr( 'href' );
$( `.filter-groups .subjects:not(${id})` ).removeClass( 'is-active' );
$( `.filter-groups ${id}` ).toggleClass( 'is-active' );
} );
$( '.licenses > a' ).click( e => {
e.preventDefault();
let id = $( e.currentTarget ).attr( 'href' );
$( id ).toggleClass( 'is-active' );
} );
$( '.subjects .filter-list a' ).click( e => {
e.preventDefault();
if ( $( e.currentTarget ).hasClass( 'is-active' ) ) {
$( '.subjects .filter-list a' ).removeClass( 'is-active' );
$( '.subjects' ).removeClass( 'has-active-child' );
} else {
$( '.subjects .filter-list a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' );
$( '.subjects' ).removeClass( 'has-active-child' );
$( e.currentTarget )
.parent()
.parent()
.parent( '.subjects' )
.addClass( 'has-active-child' );
let licenses = document.querySelector( '.license-filters' );
let subjects = document.querySelector( '.subject-filters' );
let sorts = document.querySelector( '.sorts' );
let clearFilters = document.querySelector( '.clear-filters' );
clearFilters.hidden = false;
licenses.addEventListener( 'click', function ( event ) {
if ( event.target.type !== 'radio' ) {
return;
}
let license = '';
let subject = '';
let filterValue = '*';
if ( subjects.querySelector( 'input[type="radio"]:checked' ).value ) {
subject = `[data-subject="${
subjects.querySelector( 'input[type="radio"]:checked' ).value
}"]`;
}
let subjectValue = $( '.subjects .filter-list a.is-active' ).attr(
'data-filter'
);
let licenseValue = $( '.licenses .filter-list a.is-active' ).attr(
'data-filter'
);
if ( typeof licenseValue === 'undefined' ) {
licenseValue = '';
} else {
licenseValue = `[data-license="${licenseValue}"]`;
if ( event.target.value ) {
license = `[data-license="${event.target.value}"]`;
}
if ( typeof subjectValue === 'undefined' ) {
subjectValue = '';
} else {
subjectValue = `[data-subject="${subjectValue}"]`;
if ( license || subject ) {
filterValue = `${license}${subject}`;
}
$grid.isotope( { filter: `${subjectValue}${licenseValue}` } );
$grid.isotope( { filter: filterValue } );
} );
$( '.licenses .filter-list a' ).click( e => {
e.preventDefault();
if ( $( e.currentTarget ).hasClass( 'is-active' ) ) {
$( '.licenses .filter-list a' ).removeClass( 'is-active' );
$( '.licenses' ).removeClass( 'has-active-child' );
} else {
$( '.licenses .filter-list a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' );
$( '.licenses' ).addClass( 'has-active-child' );
subjects.addEventListener( 'click', function ( event ) {
if ( event.target.type !== 'radio' ) {
return;
}
let subjectValue = $( '.subjects .filter-list a.is-active' ).attr(
'data-filter'
);
let licenseValue = $( '.licenses .filter-list a.is-active' ).attr(
'data-filter'
);
if ( typeof licenseValue === 'undefined' ) {
licenseValue = '';
} else {
licenseValue = `[data-license="${licenseValue}"]`;
let license = '';
let subject = '';
let filterValue = '*';
if ( licenses.querySelector( 'input[type="radio"]:checked' ).value ) {
license = `[data-license="${
licenses.querySelector( 'input[type="radio"]:checked' ).value
}"]`;
}
if ( typeof subjectValue === 'undefined' ) {
subjectValue = '';
} else {
subjectValue = `[data-subject="${subjectValue}"]`;
if ( event.target.value ) {
subject = `[data-subject="${event.target.value}"]`;
}
$grid.isotope( { filter: `${subjectValue}${licenseValue}` } );
if ( license || subject ) {
filterValue = `${license}${subject}`;
}
$grid.isotope( { filter: filterValue } );
} );
$( '.sort > a' ).click( e => {
e.preventDefault();
$( '.sort' ).toggleClass( 'is-active' );
clearFilters.addEventListener( 'click', function () {
let allLicenses = document.getElementById( 'all-licenses' );
let allSubjects = document.getElementById( 'all-subjects' );
allLicenses.checked = true;
allSubjects.checked = true;
$grid.isotope( { filter: '*' } );
} );
$( '.sorts a' ).click( e => {
e.preventDefault();
let sortBy = $( e.currentTarget ).attr( 'data-sort' );
$( '.sorts a' ).removeClass( 'is-active' );
$( e.currentTarget ).addClass( 'is-active' );
$grid.isotope( { sortBy: sortBy } );
sorts.addEventListener( 'click', function ( event ) {
if ( event.target.type !== 'radio' ) {
return;
}
$grid.isotope( { sortBy: event.target.value } );
} );
// $('.filters > a').click(e => {
// e.preventDefault();
// $('.filters').toggleClass('is-active');
// $('.filter-groups > div').removeClass('is-active');
// });
// $('.filter-groups .subjects > a').click(e => {
// e.preventDefault();
// let id = $(e.currentTarget).attr('href');
// $(`.filter-groups .subjects:not(${id})`).removeClass('is-active');
// $(`.filter-groups ${id}`).toggleClass('is-active');
// });
// $('.licenses > a').click(e => {
// e.preventDefault();
// let id = $(e.currentTarget).attr('href');
// $(id).toggleClass('is-active');
// });
// $('.subjects .filter-list a').click(e => {
// e.preventDefault();
// if ($(e.currentTarget).hasClass('is-active')) {
// $('.subjects .filter-list a').removeClass('is-active');
// $('.subjects').removeClass('has-active-child');
// } else {
// $('.subjects .filter-list a').removeClass('is-active');
// $(e.currentTarget).addClass('is-active');
// $('.subjects').removeClass('has-active-child');
// $(e.currentTarget)
// .parent()
// .parent()
// .parent('.subjects')
// .addClass('has-active-child');
// }
// let subjectValue = $('.subjects .filter-list a.is-active').attr(
// 'data-filter'
// );
// let licenseValue = $('.licenses .filter-list a.is-active').attr(
// 'data-filter'
// );
// if (typeof licenseValue === 'undefined') {
// licenseValue = '';
// } else {
// licenseValue = `[data-license="${licenseValue}"]`;
// }
// if (typeof subjectValue === 'undefined') {
// subjectValue = '';
// } else {
// subjectValue = `[data-subject="${subjectValue}"]`;
// }
// $grid.isotope({ filter: `${subjectValue}${licenseValue}` });
// });
// $('.licenses .filter-list a').click(e => {
// e.preventDefault();
// if ($(e.currentTarget).hasClass('is-active')) {
// $('.licenses .filter-list a').removeClass('is-active');
// $('.licenses').removeClass('has-active-child');
// } else {
// $('.licenses .filter-list a').removeClass('is-active');
// $(e.currentTarget).addClass('is-active');
// $('.licenses').addClass('has-active-child');
// }
// let subjectValue = $('.subjects .filter-list a.is-active').attr(
// 'data-filter'
// );
// let licenseValue = $('.licenses .filter-list a.is-active').attr(
// 'data-filter'
// );
// if (typeof licenseValue === 'undefined') {
// licenseValue = '';
// } else {
// licenseValue = `[data-license="${licenseValue}"]`;
// }
// if (typeof subjectValue === 'undefined') {
// subjectValue = '';
// } else {
// subjectValue = `[data-subject="${subjectValue}"]`;
// }
// $grid.isotope({ filter: `${subjectValue}${licenseValue}` });
// });
// $('.sort > a').click(e => {
// e.preventDefault();
// $('.sort').toggleClass('is-active');
// });
// $('.sorts a').click(e => {
// e.preventDefault();
// let sortBy = $(e.currentTarget).attr('data-sort');
// $('.sorts a').removeClass('is-active');
// $(e.currentTarget).addClass('is-active');
// $grid.isotope({ sortBy: sortBy });
// });
} );
},
finalize() {},

18
assets/scripts/routes/common.js

@ -71,6 +71,24 @@ export default {
$( '.header__nav' ).toggleClass( 'header__nav--active' );
} );
} );
// Props to Dave Rupert: https://daverupert.com/2017/11/happier-html5-forms/
const inputs = document.querySelectorAll( 'input, textarea' );
inputs.forEach( input => {
input.addEventListener(
'invalid',
event => {
input.classList.add( 'error' );
},
false
);
input.addEventListener( 'focus', function () {
input.classList.remove( 'error' );
} );
input.addEventListener( 'blur', function () {
input.checkValidity();
} );
} );
},
finalize() {
// JavaScript to be fired on all pages, after page specific JS is fired

19
assets/scripts/routes/home.js

@ -1,25 +1,6 @@
export default {
init() {
// JavaScript to be fired on the home page
// Props to Dave Rupert: https://daverupert.com/2017/11/happier-html5-forms/
const inputs = document.querySelectorAll( 'input, textarea' );
inputs.forEach( input => {
input.addEventListener(
'invalid',
event => {
input.classList.add( 'error' );
},
false
);
input.addEventListener( 'focus', function () {
input.classList.remove( 'error' );
} );
input.addEventListener( 'blur', function () {
input.checkValidity();
} );
} );
},
finalize() {},
};

2
assets/styles/aldine.scss

@ -14,3 +14,5 @@
@import "components/forms";
@import "layouts/header";
@import "layouts/front-page";
@import "layouts/pages";
@import "layouts/catalog";

36
assets/styles/components/_book.scss

@ -1,12 +1,13 @@
.book {
display: flex;
flex-direction: column;
justify-content: flex-end;
justify-content: space-between;
width: 100%;
max-width: 22.9375rem;
height: 24.125rem;
margin: 0 0 2rem;
padding: 1.5rem 1.85rem 2.1875rem;
padding: 1.5rem 1rem 2rem;
@media #{$breakpoint-not-small} { padding: 1.5rem 1.85rem 2.1875rem; }
border: solid 2px var(--accent, $brand-accent);
background: var(--accent, $brand-accent);
@ -18,32 +19,37 @@
text-align: center;
}
&__subject {
height: 4.625rem;
&__title {
margin: 0;
font-size: rem(24);
text-align: center;
font-size: 1.25rem;
@media #{$breakpoint-not-small} { font-size: 1.75rem; }
font-weight: 500;
line-height: 1.2;
text-align: left;
}
&__title {
height: 13rem;
&__subject {
margin: 0;
font-size: rem(30);
font-weight: 500;
line-height: (40/30);
font-size: 0.8rem;
@media #{$breakpoint-not-small} { font-size: 1.25rem; }
text-align: left;
}
&__read-more {
margin: 0;
font-size: rem(18);
font-size: 1rem;
@media #{$breakpoint-not-small} { font-size: 1.125rem; }
text-align: left;
a {
svg {
width: rem(18);
height: rem(18);
margin-left: 0.5rem;
width: 1rem;
height: 1rem;
@media #{$breakpoint-not-small} {
width: 1.125rem;
height: 1.125rem;
margin-left: 0.5rem;
}
vertical-align: middle;
}
}

10
assets/styles/components/_forms.scss

@ -1,7 +1,5 @@
label {
margin-bottom: 1rem;
margin: 0 0 1rem;
font-family: $font-family-sans-serif;
}
@ -19,8 +17,9 @@ textarea {
border-right: 0;
border-left: 0;
border-bottom: solid 2px var(--black, #000);
padding: 0 0 1em;
font-size: 0.875rem;
border-radius: 0;
padding: 0 0 1.5em;
font-size: 1rem;
font-weight: 600;
font-family: $font-family-sans-serif;
background: transparent;
@ -75,7 +74,6 @@ input[type="submit"] {
left: 0;
top: 0;
transition: 0.2s;
background: #f6f6f6;
line-height: 1;
}

2
assets/styles/editor.scss

@ -3,5 +3,5 @@
#tinymce.wp-editor {
@import '~aetna/assets/styles/components/_buttons.scss';
@import '~aetna/assets/styles/layouts/_blocks.scss';
@import '~aetna/assets/styles/layouts/_page-sections.scss';
}

302
assets/styles/layouts/_catalog.scss

@ -0,0 +1,302 @@
// stylelint-disable no-descending-specificity
fieldset {
border-top: solid 2px var(--accent);
font-family: $font-family-sans-serif;
h2,
h3 {
margin-bottom: 0;
font-size: 1rem;
font-weight: bold;
text-align: left;
text-transform: none;
&:before {
display: none;
}
button {
display: flex;
flex-direction: row;
justify-content: space-between;
all: inherit;
width: 100%;
padding: 1rem 1.1875rem;
margin: 0;
border-top: 0;
svg {
display: block;
float: right;
margin-top: 0.5rem;
}
&:hover,
&:focus {
color: var(--primary);
background: var(--bg-body);
}
&:active {
box-shadow: none;
}
}
}
[aria-expanded="true"] {
color: var(--primary);
svg {
transform: rotate(180deg);
}
}
h2 {
[aria-expanded="true"] {
border-bottom: solid 2px var(--accent);
background: #fafdff;
}
}
[type="radio"] {
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
border: 0 !important;
overflow: hidden !important;
clip: rect(1px, 1px, 1px, 1px);
}
.label {
display: inline-block;
width: calc(100% - 2rem);
}
[type="radio"] + label {
cursor: pointer;
display: block;
padding: 1rem 1.1875rem;
margin-bottom: 0;
svg {
display: none;
}
}
[type="radio"]:focus {
label {
cursor: pointer;
display: block;
}
}
[type="radio"]:checked + label {
color: var(--primary);
font-weight: bold;
svg {
display: block;
float: right;
margin-top: 0.5rem;
width: 1rem;
height: 1rem;
fill: transparent;
}
}
&:last-of-type {
border-bottom: solid 2px var(--accent);
margin-bottom: 1rem;
}
}
.js .filter-sort [type="submit"] {
display: none;
}
.clear-filters {
width: calc(100% - 2rem);
margin: 0 1rem;
}
.catalog {
.books {
width: calc(100% - 1rem);
padding: 0;
margin: 2rem 0 1rem 1rem;
}
.book {
height: 14.375rem;
width: calc(50% - 1rem);
margin: 0 1rem 1rem 0;
}
}
.catalog-navigation {
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
margin-top: rem(40);
margin-bottom: 2rem;
align-items: baseline;
font-family: $font-family-sans-serif;
a {
color: #000;
&:hover,
&:focus {
color: var(--primary);
}
}
.previous,
.next {
display: block;
margin: 0 rem(26);
font-family: $font-family-sans-serif;
font-size: rem(16);
svg {
width: 1.2rem;
height: 1rem;
margin: 0.25rem rem(6) 0;
path {
fill: var(--primary);
}
}
}
.pages {
display: inline-block;
border-bottom: solid 2px #ececec;
a,
span {
display: inline-block;
width: rem(41);
padding: rem(8) 0;
font-size: rem(24);
text-align: center;
}
.current {
border-bottom: solid rem(6) var(--primary);
}
}
}
@media #{$breakpoint-tablet-and-up} {
.filter-sort {
width: calc(100% - 1rem);
height: 7rem;
margin: 2rem 0 1rem 1rem;
}
fieldset {
width: calc(100% / 3 - 1rem);
margin: 0 1rem 1rem 0;
float: left;
border-top: 0;
position: relative;
&:last-of-type {
border-bottom: 0;
}
}
fieldset h2 button {
border-bottom: solid 2px var(--accent);
}
fieldset div:not([hidden]) {
position: absolute;
width: 100%;
background: var(--body-bg);
z-index: 99;
border-right: rem(1) solid #ececec;
border-left: rem(1) solid #ececec;
border-bottom: rem(1) solid #ececec;
.subject-groups {
width: calc(100% + 0.125rem);
margin-left: -0.06125rem;
div {
position: relative;
width: calc(100% + 0.125rem);
margin-left: -0.06125rem;
border-bottom: 0;
}
}
}
.clear-filters {
width: calc(100% / 3 - 1rem);
margin-left: 0;
}
.catalog .book {
height: 16.25rem;
width: calc(100% / 3 - 1rem);
margin: 0 1rem 1rem 0;
}
}
@media #{$breakpoint-large} {
.catalog #content {
width: 100%;
max-width: rem(1440);
background: transparent;
}
.catalog .book {
max-width: calc(100% / 3 - 1rem);
}
}
@media #{$breakpoint-extra-large} {
.catalog #content {
width: 100%;
max-width: rem(1650);
}
.filter-sort {
width: calc(25% - 1rem);
height: auto;
float: left;
margin-left: 0;
}
fieldset {
width: 100%;
display: block;
margin-bottom: 0;
}
fieldset div:not([hidden]) {
position: relative;
border: 0;
}
.clear-filters {
width: 100%;
margin-left: 0;
}
.catalog .books {
width: 75%;
float: right;
margin-left: 0;
}
.catalog-navigation {
width: 75%;
float: right;
padding-right: 1rem;
}
}

69
assets/styles/layouts/_front-page.scss

@ -7,22 +7,34 @@
}
.latest-books {
padding: 0 0 9.625rem;
margin: 4rem 0 8rem;
.slider {
width: 100%;
max-width: 22.9375rem;
margin: 0 auto;
position: relative;
}
.books {
position: relative;
display: flex;
width: calc(100% - 4rem);
margin: 0 auto;
flex-direction: column;
align-items: center;
padding-left: 0;
z-index: 99;
}
.booknav {
position: absolute;
margin-top: 0;
top: 0;
left: 0;
width: 100%;
padding: 0 1rem;
@media #{$breakpoint-large} {
max-width: 22.9375rem;
padding: 0;
}
margin: 1rem auto 2rem;
max-width: 28.0625rem;
height: 100%;
display: flex;
flex-direction: row;
justify-content: center;
@ -30,18 +42,38 @@
.previous,
.next {
display: block;
display: flex;
flex-direction: column;
justify-content: center;
position: absolute;
width: rem(25);
height: 100%;
margin-top: 0;
svg {
width: rem(25);
height: rem(25);
margin-top: 0;
path {
fill: var(--primary, $brand);
}
}
}
.previous {
left: 0;
}
.next {
right: 0;
}
@media #{$breakpoint-large} {
.slider {
width: calc(100vw - 5.125rem);
max-width: 75rem;
}
.books {
flex-direction: row;
justify-content: center;
@ -51,16 +83,21 @@
margin-left: 1rem;
}
}
}
.previous {
order: 1;
margin-right: auto;
}
.booknav {
width: calc(100% + 4rem);
max-width: 100vw;
left: -2rem;
}
.next {
order: 2;
margin-left: auto;
.previous,
.next {
width: rem(32);
svg {
width: rem(32);
height: rem(32);
}
}
}
.catalog-link {

27
assets/styles/layouts/_header.scss

@ -55,18 +55,35 @@
}
}
.page .header {
height: 560px;
.page:not(.home) .header {
height: 240px;
@media #{$breakpoint-large} {
height: 880px;
}
}
.page.catalog .header {
height: 381px;
.page.catalog {
.header {
height: 381px;
}
.page-header {
display: flex;
flex-direction: column;
justify-content: center;
height: rem(380);
margin-top: rem(-380);
}
@media #{$breakpoint-large} {
height: 450px;
.header {
height: 450px;
}
.page-header {
height: 381px;
margin-top: -381px;
}
}
}

92
assets/styles/layouts/_pages.scss

@ -1,79 +1,13 @@
@import 'pages/front-page';
@import 'pages/catalog';
.page {
.page-header {
h1 {
font-size: rem(30);
font-weight: 600;
color: var(--primary, $brand-primary);
letter-spacing: 2px;
line-height: (36/30);
text-transform: uppercase;
text-align: center;
margin: 0;
padding-top: 1rem;
&::before {
content: "";
display: block;
margin: 0 auto 1em;
width: 46px;
height: 5px;
background: var(--accent, $brand-accent);
}
}
}
.page-content {
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0 0.78125rem;
display: flex;
height: auto;
min-height: rem(445);
background-color: $white;
margin: rem(-400) auto 0;
box-shadow: -3px 5px 4px 2px rgba(135, 135, 135, 0.09);
text-align: center;
p {
font-size: rem(18);
line-height: (32/16);
}
}
}
@media (min-width: $medium) {
.page {
.page-header h1 {
font-size: rem(48);
line-height: (56/48);
}
.page-content {
width: rem(775);
min-height: rem(494);
margin: rem(-600) auto rem(119);
padding: 0 90px;
&:last-child {
margin-bottom: 4.0625rem;
}
p {
font-size: rem(18);
line-height: (32/18);
}
}
}
}
@media (min-width: $large) {
.page {
.page-content {
width: rem(1115);
}
}
}
// .page:not(.home) article {
// .entry-header h1 {
// @extend .h2;
// }
// @extend .page-section;
// text-align: left;
// width: 100%;
// max-width: rem(800);
// margin-top: calc(-80%);
// margin-left: auto;
// margin-right: auto;
// }

516
assets/styles/layouts/pages/_catalog.scss

@ -1,516 +0,0 @@
// stylelint-disable no-descending-specificity
.catalog {
.banner .container {
height: rem(381);
}
.banner .primary-navigation {
height: rem(381);
}
.page-header {
display: flex;
flex-direction: column;
justify-content: center;
height: rem(381);
margin-top: rem(-381);
h1 {
color: var(--primary, $brand-primary);
margin-bottom: 2rem;
font-size: rem(36);
line-height: 0.55556;
letter-spacing: 0.1125rem;
}
}
.network-catalog {
width: 100%;
padding-bottom: rem(152);
}
.controls {
width: 100%;
}
.book {
display: flex;
flex-direction: column;
justify-content: flex-end;
width: percent(165, 358);
margin: 0 percent(9, 358) rem(8) 0;
height: rem(230);
float: left;
padding: 1.5rem rem(8) rem(26);
border: solid 2px var(--accent, $brand-accent);
background: var(--accent, $brand-accent);
p {
margin: 0;
}
a {
font-family: $font-family-sans-serif;
color: var(--accent-fg, $white);
text-decoration: none;
}
&__subject {
height: rem(44);
font-size: rem(14);
}
&__title {
height: rem(118);
font-size: rem(16);
font-weight: 600;
line-height: (20/16);
}
&__read-more {
font-size: rem(14);
}
}
.catalog-navigation {
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
margin-top: rem(83);
align-items: baseline;
font-family: $font-family-sans-serif;
a {
color: $black;
&:hover,
&:focus {
color: var(--primary, $brand-primary);
}
}
.previous,
.next {
display: block;
margin: 0 rem(26);
font-family: $font-family-sans-serif;
font-size: rem(16);
svg {
width: rem(16.2);
height: rem(12.5);
margin: 0 rem(6);
path {
fill: var(--primary, $brand-primary);
}
}
}
.pages {
display: inline-block;
border-bottom: solid 2px #ececec;
a,
span {
display: inline-block;
width: rem(41);
padding: rem(8) 0;
font-size: rem(24);
text-align: center;
}
.current {
border-bottom: solid rem(6) var(--primary, $brand-primary);
}
}
}
.filters,
.search,
.sort {
width: 100%;
border-top: solid 2px var(--accent, $brand-accent);
background: $white;
a {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 100%;
padding: rem(16) rem(19);
font-size: rem(16);
font-weight: 600;
font-family: $font-family-sans-serif;
letter-spacing: rem(0.67);
color: $black;
&:hover,
&:focus {
background: #fafdff;
color: var(--primary, $brand-primary);
}
}
.has-active-child > a {
color: var(--primary, $brand-primary);
}
ul {
margin: 0;
padding: 0;
list-style: none;
li {
font-size: rem(16);
font-family: $font-family-sans-serif;
letter-spacing: rem(0.67);
a {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
font-weight: normal;
cursor: pointer;
.close {
display: inline-block;
float: right;
margin-top: rem(-2);
font-size: rem(20);
opacity: 0;
transition: opacity 0.5s;
}
}
a.is-active {
font-weight: 600;
color: var(--primary, $brand-primary);
.close {
opacity: 1;
}
}
}
}
}
.arrow {
path {
fill: var(--primary, $brand-primary);
}
}
.is-active > a .arrow {
transform: rotate(180deg);
}
.filters {
.filter-groups {
display: none;
border-top: solid 2px var(--accent, $brand-accent);
h3 {
margin: 0;
border-top: solid 1px $light-gray;
}
h3:first-of-type {
border-top: none;
}
}
.licenses {
display: none;
}
.filter-list {
display: none;
}
&.is-active {
.filter-groups,
.licenses {
display: block;
}
}
.is-active ul {
display: block;
}
}
.search {
display: none;
}
.sort {
border-bottom: solid 2px var(--accent, $brand-accent);
.sorts {
display: none;
border-top: solid 2px var(--accent, $brand-accent);
}
&.is-active {
.sorts {
display: block;
}
}
}
.books {
align-self: flex-start;
width: percent(358, 360);
margin: rem(32) 0 0 percent(10.5, 360);
padding: 0;
}
}
@media (min-width: 768px) {
.catalog {
.controls {
width: percent(706, 768);
height: rem(52);
margin: rem(60) percent(29, 768) rem(20) percent(33, 768);
.filters,
.search,
.sort {
position: relative;
border-top: 0;
border-bottom: solid 2px var(--accent, $brand-accent);
z-index: 99;
}
.filters {
float: left;
width: rem(360);
.filter-groups {
border-right: solid 1px #ececec;
border-left: solid 1px #ececec;
}
}
.sort {
float: right;
width: rem(160);
.sorts {
border-right: solid 1px #ececec;
border-bottom: solid 1px #ececec;
border-left: solid 1px #ececec;
}
}
}
.books {
align-self: flex-start;
width: percent(735, 768);
margin-bottom: rem(15);
margin-left: percent(24, 768);
}
.book {
width: percent(230, 735);
height: rem(260);
margin: 0 percent(15, 735) 2rem 0;
padding: 0 rem(14) rem(21.35);
&__subject {
height: rem(45.85);
font-size: rem(18);
}
&__title {
height: rem(147.65);
font-size: rem(22);
font-weight: 600;
line-height: (40/30);
}
&__read-more {
font-size: rem(16);
}
}
}
}
@media (min-width: $medium) {
.catalog {
.page-header {
h1 {
font-size: rem(72);
}
}
}
}
@media #{$breakpoint-large} {
.catalog {
.banner {
.container {
height: rem(450);
}
.primary-navigation {
height: 40px;
}
.brand {
text-align: center;
img {
max-height: rem(60);
}
}
}
.page-header {
height: rem(360);
margin-top: rem(-360);
}
}
}
@media (min-width: $extra-large) {
.catalog {
.main {
width: rem(1535);
margin: 0 auto;
}
.network-catalog {
margin-top: rem(205);
}
.controls {
width: 100%;
margin: 0 0 rem(64);
.filters {
width: rem(286);
border-bottom: 0;
> a {
border-bottom: solid 3px var(--accent, $brand-accent);
&:hover,
&:focus {
color: $black;
background: $white;
cursor: default;
}
.arrow {
display: none;
}
}
.filter-groups {
display: block;
border-right: 0;
border-top: 0;
border-left: 0;
.subjects {
border-bottom: solid 1px #ececec;
}
}
.licenses {
display: block;
margin-top: rem(60);
> a {
background: var(--primary, $brand-primary);
color: var(--primary-fg, $white);
.arrow {
path {
fill: var(--primary-fg, $white);
}
}
}
}
ul li {
a {
padding-top: 0;
padding-bottom: 0;
line-height: 2;
}
&:last-child a {
padding-bottom: 1rem;
}
}
}
.sort {
.sorts {
border-top: solid 3px var(--accent, $brand-accent);
border-right: 0;
border-left: 0;
}
}
}
.books {
width: percent(1221.5, 1535);
margin: 0 0 0 percent(316, 1535);
}
.book {
width: percent(367, 1221.5);
height: rem(386);
margin: 0 0 2rem percent(39.5, 1221.5);
padding: 1.5rem 1.85rem 2.1875rem;
&__subject {
height: 4.625rem;
font-size: rem(24);
}
&__title {
height: 13rem;
font-size: rem(30);
font-weight: 500;
line-height: (40/30);
}
&__read-more {
font-size: rem(18);
}
}
}
}
.catalog.no-js {
.filters {
.arrow {
display: none;
}
.filter-groups,
.licenses,
.filter-list {
display: block;
}
}
.sort {
.arrow {
display: none;
}
.sorts {
display: block;
}
}
}

321
assets/styles/layouts/pages/_front-page.scss

@ -1,321 +0,0 @@
.home {
.block {
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0 0.78125rem;
display: flex;
height: rem(445);
background-color: $white;
margin-left: auto;
margin-right: auto;
text-align: center;
p {
font-size: rem(18);
line-height: (32/16);
}
}
.latest-books {
height: auto;
padding: 0 0 rem(154);
h3 {
text-align: center;
text-transform: uppercase;
margin-top: 4.375rem;
margin-bottom: 2.8125rem;
}
.track {
display: flex;
flex-flow: row wrap;
justify-content: center;
align-items: center;
max-width: 22.9375rem;
margin-left: auto;
margin-right: auto;
margin-bottom: 2rem;
padding: 0 0.46875rem;
position: relative;
}
.books {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
order: 0;
padding: 0;
width: 100%;
margin-bottom: rem(34);
}
.previous,
.next {
display: block;
width: auto;
height: auto;
svg {
path {
fill: var(--primary, $brand);
}
}
}
.previous {
order: 1;
margin-right: auto;
}
.next {
order: 2;
margin-left: auto;
}
.catalog-link {
text-align: center;
}
}
.blocks.blocks-2,
.blocks.blocks-3 {
.widget_text:nth-child(2) {
margin-right: 0.5rem;
margin-left: 0.5rem;
border: solid 2px var(--primary, $brand-primary);
box-shadow: unset;
}
}
.blocks.blocks-4 {
.widget_text:nth-child(2) {
color: var(--accent-fg, $white);
background: var(--accent, $brand-accent);
h3 {
color: var(--accent-fg, $white);
&::before {
background: var(--accent-fg, $white);
}
}
.button {
color: var(--accent-fg, $white);
border-color: var(--accent-fg, $white);
background: transparent;
&:hover,
&:focus {
color: var(--accent, $brand-accent);
background: var(--accent-fg, $white);
}
}
}
.widget_text:nth-child(3) {
margin-top: 2rem;
margin-right: 0.5rem;
margin-left: 0.5rem;
border: solid 2px var(--primary, $brand-primary);
box-shadow: unset;
&::after {
top: rem(1880);
}
}
}
.blocks.blocks-2 .widget_text:nth-child(2),
.blocks.blocks-3 .widget_text:nth-child(2),
.blocks.blocks-4 .widget_text:nth-child(3) {
background: transparent;
margin-bottom: rem(400);
&::after {
z-index: -1;
content: "";
display: block;
width: 100vw;
height: rem(444);
background-image: url('../images/banner.jpg');
background-position: center;
background-size: cover;
position: absolute;
top: rem(1410);
left: 0;
}
}
}
@media (min-width: $medium) {
.home {
.wrap {
margin-top: rem(-366);
}
.block {
width: rem(775);
height: rem(494);
margin-bottom: rem(119);
padding: 0 90px;
box-shadow: -3px 5px 4px 2px rgba(135, 135, 135, 0.09);
&:last-child {
margin-bottom: 4.0625rem;
}
p {
font-size: rem(18);
line-height: (32/18);
}
}
.blocks.blocks-2 .widget_text:nth-child(2),
.blocks.blocks-3 .widget_text:nth-child(2),
.blocks.blocks-4 .widget_text:nth-child(3) {
margin-left: auto;
margin-right: auto;
margin-bottom: rem(119);
&::after {
height: rem(600);
top: rem(1547);
}
}
.blocks.blocks-4 .widget_text:nth-child(3) {
&::after {
top: rem(2177);
}
}
.latest-books {
width: 100%;
margin-left: auto;
margin-right: auto;
h3 {
margin-bottom: 4.375rem;
}
.track {
display: flex;
flex-flow: row nowrap;
width: 100%;
max-width: 100%;
margin: 0;
padding: 0;
}
.next,
.previous {
position: absolute;
top: rem(165.5);
svg {
width: 2.4375rem;
height: 1.875rem;
}
}
.next {
margin-right: 0.9375rem;
right: 0;
}
.previous {
order: 0;
margin-left: 0.9375rem;
left: 0;
}
.books {
width: auto;
min-width: 50rem;
flex-direction: row;
order: 1;
justify-content: space-between;
margin-bottom: 2rem;
}
.book {
width: 30%;
max-width: 19.54rem;
&:last-child {
margin-bottom: 2rem;
}
}
}
}
}
@media (min-width: $large) {
.home {
.block {
width: rem(1115);
}
.latest-books {
width: 100%;
margin-bottom: 0;
.track {
width: 100%;
margin: 0 auto;
max-width: 87rem;
}
.books {
width: 100%;
max-width: 75rem;
}
.book {
min-width: 19.54rem;
max-width: 22.9375rem;
}
}
}
}
@media (min-width: $extra-large) {
.home {
.block {
width: rem(1115);
box-shadow: -3px 5px 4px 2px rgba(135, 135, 135, 0.09);
}
.blocks.blocks-4 {
display: flex;
flex-flow: row wrap;
width: 1615px;
.widget_text {
width: 1115px;
margin-right: auto;
margin-left: auto;
}
.widget_text:nth-child(1),
.widget_text:nth-child(2) {
width: 775px;
}
.widget_text:nth-child(1) {
margin-right: 65px;
}
}
.blocks.blocks-4 .widget_text:nth-child(3) {
&::after {
top: rem(1596);
}
}
}
}

10
dist/mix-manifest.json vendored

@ -1,8 +1,8 @@
{
"/scripts/aldine.js": "/scripts/aldine.js?id=efcb42c04ca82ffdf060",
"/styles/aldine.css": "/styles/aldine.css?id=3a484b180e7757a8b6c7",
"/styles/editor.css": "/styles/editor.css?id=16680c95cc79caed750f",
"/scripts/aldine.js": "/scripts/aldine.js?id=28a2ebcb9ae510032b59",
"/styles/aldine.css": "/styles/aldine.css?id=00b0c10d93f464c01cc5",
"/styles/editor.css": "/styles/editor.css?id=10e3f4b144847aa8d75e",
"/styles/blocks/hero-unit/editor.css": "/styles/blocks/hero-unit/editor.css?id=d41d8cd98f00b204e980",
"/scripts/customizer.js": "/scripts/customizer.js?id=f1f1f4225cba4c1b35f2",
"/scripts/blocks/hero-unit/block.js": "/scripts/blocks/hero-unit/block.js?id=bb2a9d7ae4e646a7919d"
"/scripts/customizer.js": "/scripts/customizer.js?id=decf119933e3b2d4b210",
"/scripts/blocks/hero-unit/block.js": "/scripts/blocks/hero-unit/block.js?id=68feac0df91f56d02826"
}

2
dist/scripts/aldine.js vendored

File diff suppressed because one or more lines are too long

2
dist/scripts/blocks/hero-unit/block.js vendored

@ -1 +1 @@
!function(e){function t(a){if(o[a])return o[a].exports;var n=o[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};t.m=e,t.c=o,t.d=function(e,o,a){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}({2:function(e,t,o){e.exports=o("wSxJ")},wSxJ:function(e,t){!function(e,t,o,a){var n=o.createElement;wp.blocks.registerBlockType("aldine/hero-unit",{title:t.__("Hero Unit","pressbooks-aldine"),icon:"flag",category:"layout",attributes:{title:{type:"array",source:"children",selector:"h2"},content:{type:"array",source:"children",selector:"p"}},edit:function(o){var l=o.focus?o.focus.editable||"title":null,c=o.attributes;return n("div",{className:o.className},n(e.Editable,{tagName:"h2",className:"hero__title",inline:!1,placeholder:t.__("About Pressbooks","pressbooks-aldine"),value:c.title,onChange:function(e){o.setAttributes({title:e})},focus:"title"===l?focus:null,onFocus:function(e){o.setFocus(a.extend({},e,{editable:"title"}))}}),n(e.Editable,{tagName:"p",className:"hero__content",inline:!1,placeholder:t.__("Kogi ennui ugh plaid, hella neutra kitsch cloud bread next level twee taiyaki. Live-edge paleo fixie whatever farm-to-table snackwave, meditation fam man braid next level viral. Four loko waistcoat mustache cloud bread activated charcoal food truck pabst roof party ugh kitsch raw denim edison bulb man braid 8-bit try-hard. Activated charcoal put a bird on it tilde meggings farm-to-table coloring book. Before they sold out four dollar toast stumptown actually.","pressbooks-gutenberg"),value:c.content,onChange:function(e){o.setAttributes({content:e})},focus:"content"===l?focus:null,onFocus:function(e){o.setFocus(a.extend({},e,{editable:"content"}))}}),n("p",{classname:"hero__cta"},n(e.Editable,{tagName:"a",className:"call-to-action",inline:!1,placeholder:t.__("Learn More","pressbooks-aldine"),value:c.cta,onChange:function(e){o.setAttributes({cta:e})},focus:"cta"===l?focus:null,onFocus:function(e){o.setFocus(a.extend({},e,{editable:"cta"}))}})))},save:function(e){var t=e.attributes;return n("div",{className:e.className},n("h2",{className:"hero__title"},t.title),n("p",{className:"hero__content"},t.content),n("p",{classname:"hero__cta"},n("a",{classname:"call-to-action"},t.cta)))}})}(window.wp.blocks,window.wp.i18n,window.wp.element,window._)}});
!function(e){var t={};function a(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=2)}({2:function(e,t,a){e.exports=a("wSxJ")},wSxJ:function(e,t){var a,o,n,l,c;a=window.wp.blocks,o=window.wp.i18n,n=window.wp.element,l=window._,c=n.createElement,wp.blocks.registerBlockType("aldine/hero-unit",{title:o.__("Hero Unit","pressbooks-aldine"),icon:"flag",category:"layout",attributes:{title:{type:"array",source:"children",selector:"h2"},content:{type:"array",source:"children",selector:"p"}},edit:function(e){var t=e.focus?e.focus.editable||"title":null,n=e.attributes;return c("div",{className:e.className},c(a.Editable,{tagName:"h2",className:"hero__title",inline:!1,placeholder:o.__("About Pressbooks","pressbooks-aldine"),value:n.title,onChange:function(t){e.setAttributes({title:t})},focus:"title"===t?focus:null,onFocus:function(t){e.setFocus(l.extend({},t,{editable:"title"}))}}),c(a.Editable,{tagName:"p",className:"hero__content",inline:!1,placeholder:o.__("Kogi ennui ugh plaid, hella neutra kitsch cloud bread next level twee taiyaki. Live-edge paleo fixie whatever farm-to-table snackwave, meditation fam man braid next level viral. Four loko waistcoat mustache cloud bread activated charcoal food truck pabst roof party ugh kitsch raw denim edison bulb man braid 8-bit try-hard. Activated charcoal put a bird on it tilde meggings farm-to-table coloring book. Before they sold out four dollar toast stumptown actually.","pressbooks-gutenberg"),value:n.content,onChange:function(t){e.setAttributes({content:t})},focus:"content"===t?focus:null,onFocus:function(t){e.setFocus(l.extend({},t,{editable:"content"}))}}),c("p",{classname:"hero__cta"},c(a.Editable,{tagName:"a",className:"call-to-action",inline:!1,placeholder:o.__("Learn More","pressbooks-aldine"),value:n.cta,onChange:function(t){e.setAttributes({cta:t})},focus:"cta"===t?focus:null,onFocus:function(t){e.setFocus(l.extend({},t,{editable:"cta"}))}})))},save:function(e){var t=e.attributes;return c("div",{className:e.className},c("h2",{className:"hero__title"},t.title),c("p",{className:"hero__content"},t.content),c("p",{classname:"hero__cta"},c("a",{classname:"call-to-action"},t.cta)))}})}});

2
dist/scripts/customizer.js vendored

File diff suppressed because one or more lines are too long

2
dist/styles/aldine.css vendored

File diff suppressed because one or more lines are too long

2
dist/styles/editor.css vendored

File diff suppressed because one or more lines are too long

25
footer.php

@ -37,12 +37,18 @@ $pb_network_contact_form = get_option( 'pb_network_contact_form' );
<?php dynamic_sidebar( 'network-footer-block-2' ); ?>
<div class="social-media">
<?php if ( ! empty( $network_facebook ) ) { ?>
<a class="icon icon-facebook" href="<?php echo $network_facebook; ?>" title="<?php printf( __( '%s on Facebook', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>">
<a class="facebook" href="<?php echo $network_facebook; ?>" title="<?php printf( __( '%s on Facebook', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>">
<svg class="icon--svg">
<use xlink:href="#facebook" />
</svg>
<span class="screen-reader-text"><?php printf( __( '%s on Facebook', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?></span>
</a>
<?php } ?>
<?php if ( ! empty( $network_twitter ) ) { ?>
<a class="icon icon-twitter" href="<?php echo $network_twitter; ?>" title="<?php printf( __( '%s on Twitter', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>">
<a class="twitter" href="<?php echo $network_twitter; ?>" title="<?php printf( __( '%s on Twitter', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>">
<svg class="icon--svg">
<use xlink:href="#twitter" />
</svg>
<span class="screen-reader-text"><?php printf( __( '%s on Twitter', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?></span>
</a>
<?php } ?>
@ -61,7 +67,7 @@ $pb_network_contact_form = get_option( 'pb_network_contact_form' );
</svg>
</a>
<div class="footer__pressbooks__links">
<h1 class="footer__pressbooks__links__title"><a href="https://pressbooks.com"><?php printf( __( 'Powered by %s', 'pressbooks-book' ), '<span class="pressbooks">Pressbooks</span>' ); ?></a></h1>
<p class="footer__pressbooks__links__title"><a href="https://pressbooks.com"><?php printf( __( 'Powered by %s', 'pressbooks-book' ), '<span class="pressbooks">Pressbooks</span>' ); ?></a></p>
<ul class="footer__pressbooks__links__list">
<li><a href="https://pressbooks.org"><?php _e( 'Open Source', 'pressbooks-book' ); ?></a> |</li>
<li><a href="https://pressbooks.com/for-academia"><?php _e( 'Open Textbooks', 'pressbooks-book' ); ?></a> |</li>
@ -70,8 +76,17 @@ $pb_network_contact_form = get_option( 'pb_network_contact_form' );
</ul>
</div>
<div class="footer__pressbooks__social">
<a class="icon icon-facebook" href="https://facebook.com/pressbooks2" title="<?php _e( 'Pressbooks on Facebook', 'pressbooks-book' ); ?>"><span class="screen-reader-text"><?php _e( 'Pressbooks on Facebook', 'pressbooks-book' ); ?></span></a>
<a class="icon icon-twitter" href="https://twitter.com/intent/follow?screen_name=pressbooks" title="<?php _e( 'Pressbooks on Twitter', 'pressbooks-book' ); ?>"><span class="screen-reader-text"><?php _e( 'Pressbooks on Twitter', 'pressbooks-book' ); ?></span></a>
<a class="facebook" href="https://facebook.com/pressbooks2" title="<?php _e( 'Pressbooks on Facebook', 'pressbooks-book' ); ?>">
<svg class="icon--svg">
<use xlink:href="#facebook" />
</svg>
<span class="screen-reader-text"><?php _e( 'Pressbooks on Facebook', 'pressbooks-book' ); ?></span>
</a>
<a class="twitter" href="https://twitter.com/intent/follow?screen_name=pressbooks" title="<?php _e( 'Pressbooks on Twitter', 'pressbooks-book' ); ?>">
<svg class="icon--svg">
<use xlink:href="#twitter" />
</svg>
<span class="screen-reader-text"><?php _e( 'Pressbooks on Twitter', 'pressbooks-book' ); ?></span></a>
</div>
</section>

1
functions.php

@ -48,6 +48,7 @@ add_filter( 'mce_buttons', '\\Aldine\\Filters\\add_style_select' );
add_filter( 'tiny_mce_before_init', '\\Aldine\\Filters\\add_blocks' );
add_filter( 'body_class', '\\Aldine\\Filters\\body_classes' );
add_filter( 'excerpt_more', '\\Aldine\\Filters\\excerpt_more' );
add_filter( 'query_vars', '\\Aldine\\Filters\\register_query_vars' );
add_filter( 'wp_nav_menu_items', '\\Aldine\\Filters\\adjust_menu', 10, 2 );
add_action( 'widgets_init', '\\Aldine\\Actions\\widgets_init' );
add_action( 'wp_enqueue_scripts', '\\Aldine\\Actions\\enqueue_assets' );

12
header.php

@ -21,7 +21,7 @@
</head>
<body <?php body_class(); ?>>
<svg aria-hidden="true" width="0" height="0" xmlns="http://www.w3.org/2000/svg">
<svg style="display: none;" xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="icon-pressbooks" fill="currentColor" viewBox="0 0 45 44">
<path d="M44.195 41.872c0 .745-.618 1.346-1.377 1.346H1.377C.617 43.219 0 42.617 0 41.872V1.347C0 .604.618 0 1.377 0h41.44c.76 0 1.378.604 1.378 1.347v40.525zM15.282 10.643h-5.21v21.43h3.304V24h1.906c1.435 0 2.656-.5 3.665-1.504 1.008-1.004 1.513-2.213 1.513-3.626v-3.113c0-1.47-.444-2.678-1.33-3.625-.956-.993-2.24-1.489-3.848-1.489zm1.977 5.165h-.001v3.131c0 .513-.184.952-.55 1.318a1.826 1.826 0 0 1-1.338.547h-1.994v-6.86h1.995c.571 0 1.029.171 1.372.513.344.342.516.792.516 1.35zm5.84 16.265h6.118c.828 0 1.662-.25 2.502-.752a4.642 4.642 0 0 0 1.73-1.779c.526-.945.788-2.097.788-3.455 0-.545-.04-1.043-.122-1.486-.163-.868-.414-1.575-.751-2.122-.513-.81-1.137-1.352-1.871-1.625a3.325 3.325 0 0 0 1.154-.839c.78-.866 1.173-2.018 1.173-3.455 0-.876-.105-1.635-.315-2.274-.386-1.198-1.027-2.08-1.925-2.652-1.049-.672-2.225-1.008-3.531-1.008h-4.95v21.447zm3.568-12.69v-5.475h1.382c.652 0 1.184.212 1.592.634.443.456.665 1.13.665 2.018 0 .537-.065.987-.193 1.352-.35.982-1.039 1.471-2.064 1.471h-1.382zm0 9.493v-6.397h1.382c.815 0 1.433.25 1.853.751.466.549.7 1.42.7 2.617 0 .502-.075.948-.227 1.335-.432 1.13-1.208 1.694-2.326 1.694h-1.382z" />
@ -31,10 +31,12 @@
<path fill="#B01109" d="M39.549 37.515c0 .667-.553 1.205-1.232 1.205H1.232A1.217 1.217 0 0 1 0 37.515V1.25C0 .585.553.045 1.232.045h37.083c.681 0 1.234.54 1.234 1.205v36.265z"/>
<path fill="#EDEDED" d="M13.648 10.504c1.44 0 2.588.444 3.444 1.332.793.848 1.19 1.93 1.19 3.245v2.786c0 1.264-.452 2.346-1.354 3.244-.903.898-1.996 1.346-3.28 1.346h-1.705v7.225H8.986V10.504h4.662zm1.77 4.622c0-.5-.155-.903-.462-1.209-.307-.305-.717-.458-1.228-.458h-1.785v6.138h1.784c.468 0 .868-.163 1.197-.49.328-.327.492-.72.492-1.179v-2.802h.002zM20.644 29.682V10.489h4.429c1.169 0 2.222.3 3.16.902.803.511 1.377 1.301 1.722 2.374.188.57.282 1.25.282 2.034 0 1.286-.35 2.317-1.05 3.092a2.976 2.976 0 0 1-1.032.75c.657.245 1.215.73 1.674 1.455.302.49.526 1.123.672 1.899.073.397.11.842.11 1.33 0 1.215-.235 2.245-.705 3.092a4.154 4.154 0 0 1-1.55 1.591c-.75.45-1.497.674-2.238.674h-5.474zm3.193-11.356h1.236c.918 0 1.534-.438 1.847-1.317.115-.327.172-.73.172-1.21 0-.795-.197-1.397-.595-1.806-.365-.377-.84-.567-1.424-.567h-1.236v4.9zm0 8.494h1.236c1 0 1.695-.505 2.081-1.515.136-.347.204-.746.204-1.195 0-1.072-.21-1.85-.626-2.342-.376-.45-.93-.672-1.66-.672h-1.235v5.724z"/>
</symbol>
<symbol id="arrow-right" fill="currentColor" viewBox="0 0 512 512">
<path d="M291 32c0 6 3 12 7 17l133 135H23c-13 0-23 11-23 24s10 24 23 24h408L298 367c-4 4-7 10-7 16s3 12 7 17c10 9 24 9 33 0l173-176c9-9 9-23 0-33L331 15c-9-10-23-10-33 0-4 4-7 10-7 17"/>
</symbol>
<symbol id="arrow-left" fill="currentColor" viewBox="0 0 512 512"><path d="M220 45c0 6-3 12-7 17L79 200h410c12 0 23 11 23 25 0 13-11 24-23 24H79l134 138c4 5 7 11 7 17 0 7-3 13-7 18-10 9-24 9-33 0L7 242c-9-10-9-25 0-34L180 26c9-9 23-9 33 0 4 5 7 11 7 19"/>
<symbol id="facebook" fill="currentColor" viewbox="0 0 512 512"><path d="M451 5c7 0 13 2 17 7 5 4 7 10 7 17v390c0 7-2 13-7 17-4 5-10 7-17 7H339V273h57l9-66h-66v-42c0-11 3-19 7-24 5-5 13-8 26-8h35V73c-12-1-29-2-51-2-26 0-46 7-62 23-15 15-23 36-23 64v49h-57v66h57v170H61c-7 0-13-2-17-7-5-4-7-10-7-17V29c0-7 2-13 7-17 4-5 10-7 17-7z"/></symbol>
<symbol id="twitter" fill="currentColor" viewbox="0 0 512 512"><path d="M161 433c193 0 299-161 299-300v-14c20-15 38-34 52-55-19 9-40 14-60 17 22-13 38-34 46-59-21 13-43 21-67 26-32-35-84-44-126-21s-64 71-53 117c-84-4-163-44-216-110C8 82 22 144 68 175c-17 0-33-5-48-13v1c0 50 36 94 85 104-16 4-32 5-48 2 14 43 54 72 98 73-37 30-83 46-130 45-8 0-17 0-25-1 48 31 104 47 161 47"/></symbol>
<symbol id="arrow-right" fill="currentColor" viewBox="0 0 512 512"><path d="M291 32c0 6 3 12 7 17l133 135H23c-13 0-23 11-23 24s10 24 23 24h408L298 367c-4 4-7 10-7 16s3 12 7 17c10 9 24 9 33 0l173-176c9-9 9-23 0-33L331 15c-9-10-23-10-33 0-4 4-7 10-7 17"/></symbol>
<symbol id="arrow-left" fill="currentColor" viewBox="0 0 512 512"><path d="M220 45c0 6-3 12-7 17L79 200h410c12 0 23 11 23 25 0 13-11 24-23 24H79l134 138c4 5 7 11 7 17 0 7-3 13-7 18-10 9-24 9-33 0L7 242c-9-10-9-25 0-34L180 26c9-9 23-9 33 0 4 5 7 11 7 19"/></symbol>
<symbol id="checkmark" viewBox="0 0 20 16">
<polyline stroke="currentColor" stroke-width="3" transform="translate(10.063477, 4.717773) rotate(-45.000000) translate(-10.063477, -4.717773) " points="2.06347656 0.717773438 2.06347656 8.71777344 18.0634766 8.71777344"></polyline>
</symbol>
</defs>
</svg>

43
inc/activation/namespace.php

@ -6,8 +6,28 @@
namespace Aldine\Activation;
/**
* Create default page content, importing from Pressbooks Publisher, if possible.
*/
function create_default_content() {
if ( ! get_option( 'pb_aldine_activated' ) ) {
$mods = get_option( 'theme_mods_pressbooks-publisher' );
if ( $mods === false ) {
$mods = get_option( 'mods_pressbooks-publisher' );
}
if ( $mods && isset( $mods['pressbooks_publisher_intro_textbox'] ) ) {
$home_content = apply_filters( 'the_content', $mods['pressbooks_publisher_intro_textbox'] );
} else {
$home_content = apply_filters(
'pb_root_home_page_content',
sprintf(
'<h2>%1$s</h2><p>%2$s</p><p><a class="call-to-action" href="/about/">%3$s</a></p>',
__( 'About Pressbooks', 'pressbooks-aldine' ),
__( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ),
__( 'Learn More', 'pressbooks-aldine' )
)
);
}
$default_pages = [
'about' => [
@ -49,14 +69,9 @@ function create_default_content() {
],
'home' => [
'post_title' => __( 'Home', 'pressbooks-aldine' ),
'post_content' => apply_filters(
'pb_root_home_page_content',
sprintf(
'<div class="block block--standard"><h2>%1$s</h2><p>%2$s</p><p><a class="button" href="/about/">%3$s</a></p></div>',
__( 'About Pressbooks', 'pressbooks-aldine' ),
__( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ),
__( 'Learn More', 'pressbooks-aldine' )
)
'post_content' => sprintf(
'<div class="page-section">%s</div>',
$home_content
),
],
];
@ -78,15 +93,9 @@ function create_default_content() {
update_option( 'page_on_front', $pages['home'] );
// Remove content generated by wp_install_defaults
if ( ! wp_delete_post( 1, true ) ) {
return;
}
if ( ! wp_delete_post( 2, true ) ) {
return;
}
if ( ! wp_delete_comment( 1, true ) ) {
return;
}
wp_delete_post( 1, true );
wp_delete_post( 2, true );
wp_delete_comment( 1, true );
// Add "pb_aldine_activated" option to enable check above
add_option( 'pb_aldine_activated', 1 );

25
inc/customizer/namespace.php

@ -169,17 +169,18 @@ function customize_preview_js() {
$assets->setSrcDirectory( 'assets' )->setDistDirectory( 'dist' );
wp_enqueue_script( 'aldine/customizer', $assets->getPath( 'scripts/customizer.js' ), [ 'customize-preview' ], false, null );
wp_enqueue_script( 'wcag-validate-customizer-color-contrast', get_template_directory_uri() . '/lib/customizer-validate-wcag-color-contrast/customizer-validate-wcag-color-contrast.js', [ 'customize-controls' ] );
// TODO @codingStandardsIgnoreStart
// wp_enqueue_script( 'wcag-validate-customizer-color-contrast', get_template_directory_uri() . '/lib/customizer-validate-wcag-color-contrast/customizer-validate-wcag-color-contrast.js', [ 'customize-controls' ] );
$exports = [
'validate_color_contrast' => [
'pb_network_color_primary_fg' => [ 'pb_network_color_primary' ],
'pb_network_color_accent_fg' => [ 'pb_network_color_accent' ],
],
];
wp_scripts()->add_data(
'wcag-validate-customizer-color-contrast',
'data',
sprintf( 'var _validateWCAGColorContrastExports = %s;', wp_json_encode( $exports ) )
);
// $exports = [
// 'validate_color_contrast' => [
// 'pb_network_color_primary_fg' => [ 'pb_network_color_primary' ],
// 'pb_network_color_accent_fg' => [ 'pb_network_color_accent' ],
// ],
// ];
// wp_scripts()->add_data(
// 'wcag-validate-customizer-color-contrast',
// 'data',
// sprintf( 'var _validateWCAGColorContrastExports = %s;', wp_json_encode( $exports ) )
// ); // @codingStandardsIgnoreEnd
}

42
inc/filters/namespace.php

@ -7,6 +7,8 @@
namespace Aldine\Filters;
use function Aldine\Helpers\has_sections;
/**
* Adds custom classes to the array of body classes.
*
@ -23,6 +25,11 @@ function body_classes( array $classes ) {
}
}
/** Add .has-sections if page content has sections */
if ( is_single() || is_page() && has_sections( get_the_ID() ) ) {
$classes[] = 'has-sections';
}
/** Clean up class names for custom templates */
$classes = array_map( function ( $class ) {
return preg_replace( [ '/-php$/', '/^page-template-views/' ], '', $class );
@ -31,6 +38,19 @@ function body_classes( array $classes ) {
return array_filter( $classes );
}
/**
* Add custom query vars for catalog.
*
* @param array $vars The array of available query variables.
*
* @link https://codex.wordpress.org/Plugin_API/Filter_Reference/query_vars
*/
function register_query_vars( $vars ) {
$vars[] = 'license';
$vars[] = 'subject';
return $vars;
}
/**
* Customize excerpt.
*
@ -61,33 +81,33 @@ function add_style_select( $buttons ) {
function add_blocks( $init_array ) {
$style_formats = [
[
'title' => __( 'Standard Block', 'pressbooks-aldine' ),
'title' => __( 'Page Section', 'pressbooks-aldine' ),
'block' => 'div',
'classes' => [ 'block', 'block--standard' ],
'classes' => [ 'page-section' ],
'wrapper' => true,
],
[
'title' => __( 'Alternate Block', 'pressbooks-aldine' ),
'title' => __( 'Page Section (Accent)', 'pressbooks-aldine' ),
'block' => 'div',
'classes' => [ 'block', 'block--alternate' ],
'classes' => [ 'page-section', 'page-section--accent' ],
'wrapper' => true,
],
[
'title' => __( 'Bordered Block', 'pressbooks-aldine' ),
'title' => __( 'Page Section (Bordered)', 'pressbooks-aldine' ),
'block' => 'div',
'classes' => [ 'block', 'block--bordered' ],
'classes' => [ 'page-section', 'page-section--bordered' ],
'wrapper' => true,
],
[
'title' => __( 'Borderless Block', 'pressbooks-aldine' ),
'title' => __( 'Page Section (Borderless)', 'pressbooks-aldine' ),
'block' => 'div',
'classes' => [ 'block', 'block--borderless' ],
'classes' => [ 'page-section', 'page-section--borderless' ],
'wrapper' => true,
],
[
'title' => __( 'Link Button', 'pressbooks-aldine' ),
'selector' => 'a',
'classes' => 'button',
'title' => __( 'Call to Action', 'pressbooks-aldine' ),
'inline' => 'a',
'classes' => [ 'call-to-action' ],
],
];

77
inc/helpers/namespace.php

@ -7,6 +7,8 @@
namespace Aldine\Helpers;
use Pressbooks\Licensing;
/**
* Get catalog data.
*
@ -64,6 +66,43 @@ function get_catalog_licenses() {
return [];
}
/**
* Get licenses currently in use.
*
* @param array $catalog_data
* @return array
*/
function get_available_licenses( $catalog_data ) {
$licenses = [];
$licensing = new \Pressbooks\Licensing();
foreach ( $catalog_data['books'] as $book ) {
$license = $licensing->getLicenseFromUrl( $book['metadata']['license']['url'] );
if ( ! in_array( $license, $licenses, true ) ) {
$licenses[] = $license;
}
}
return $licenses;
}
/**
* Get subjects currently in use.
*
* @param array $catalog_data
* @return array
*/
function get_available_subjects( $catalog_data ) {
$subjects = [];
foreach ( $catalog_data['books'] as $book ) {
if ( ! empty( $book['subject'] ) ) {
$subjects[ substr( $book['subject'], 0, 1 ) ][] = substr( $book['subject'], 0, 2 );
}
}
return $subjects;
}
/**
* Return the default (non-page) menu items.
*
@ -71,13 +110,12 @@ function get_catalog_licenses() {
* @return string $items
*/
function get_default_menu( $items = '' ) {
if ( ! is_front_page() ) {
$items = sprintf(
'<li><a href="%1$s">%2$s</a></li>',
'/',
__( 'Home', 'pressbooks-aldine' )
) . $items;
}
$link = ( is_front_page() ) ? network_home_url( '#main' ) : network_home_url( '/' );
$items = sprintf(
'<li><a href="%1$s">%2$s</a></li>',
$link,
__( 'Home', 'pressbooks-aldine' )
) . $items;
if ( get_option( 'pb_network_contact_form' ) ) {
$items .= sprintf(
'<li><a href="%1$s">%2$s</a></li>',
@ -201,10 +239,16 @@ function handle_contact_form_submission() {
return;
}
function has_blocks( $post_id ) {
/**
* Does a page have page sections?
*
* @param int $post_id The page.
* @return bool
*/
function has_sections( $post_id ) {
$post_content = get_post_field( 'post_content', $post_id );
if ( ! empty( $post_content ) ) {
if ( strpos( $post_content, 'block--standard' ) || strpos( $post_content, 'block--alternate' ) ) {
if ( strpos( $post_content, 'page-section' ) ) {
return true;
} else {
return false;
@ -213,3 +257,18 @@ function has_blocks( $post_id ) {
return false;
}
/**
* Maybe truncate a string to a sensible length.
*
* @param string $string The string.
* @param int $length Max length in characters.
*
* @return string
*/
function maybe_truncate_string( $string, $length = 40 ) {
if ( strlen( $string ) > $length ) {
return substr( $string, 0, strpos( wordwrap( $string, $length ), "\n" ) ) . '&hellip;';
}
return $string;
}

108
lib/customizer-validate-wcag-color-contrast/customizer-validate-wcag-color-contrast.js

@ -1,9 +1,7 @@
/* global wp, _validateWCAGColorContrastExports */
/* exported validateWCAGColorContrast */
var validateWCAGColorContrast = ( function( $, api, exports ) {
var self = {
validate_color_contrast: []
};
let validateWCAGColorContrast = ( function ( $, api, exports ) {
let self = { validate_color_contrast: [] };
if ( exports ) {
$.extend( self, exports );
}
@ -14,8 +12,8 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* @param {wp.customize.Value} setting.validationMessage - Validation message.
* @return {boolean} Whether validation was added.
*/
self.addWCAGColorContrastValidation = function( setting ) {
var initialValidate;
self.addWCAGColorContrastValidation = function ( setting ) {
let initialValidate;
if ( ! self.isColorControl( setting ) ) {
return false;
@ -28,34 +26,34 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* @param {mixed} value - New value being assigned to the setting.
* @returns {*}
*/
setting.validate = function( value ) {
var setting = this, title, validationError;
var current_color = value;
var current_id = this.id;
setting.validate = function ( value ) {
let setting = this, title, validationError;
let current_color = value;
let current_id = this.id;
var all_color_controls = _.union( _.flatten( _.values( self.validate_color_contrast ) ) );
let all_color_controls = _.union( _.flatten( _.values( self.validate_color_contrast ) ) );
// remove other (old) notifications
_.each ( _.without ( all_color_controls , current_id ), function( other_color_control_id ) {
var other_control = api.control.instance( other_color_control_id );
notice = other_control.container.find('.notice');
_.each( _.without( all_color_controls, current_id ), function ( other_color_control_id ) {
let other_control = api.control.instance( other_color_control_id );
notice = other_control.container.find( '.notice' );
notice.hide();
} );
// find other color controls and check contrast with current color control
var other_color_controls = self.validate_color_contrast[ current_id ];
let other_color_controls = self.validate_color_contrast[ current_id ];
_.each ( other_color_controls, function( other_color_control_id ) {
var other_control = api.control.instance( other_color_control_id);
var other_color = other_control.container.find('.color-picker-hex').val();
var name = $( '#customize-control-' + other_color_control_id + ' .customize-control-title').text();
var contrast = self.hex( current_color, other_color );
var score = self.score( contrast );
_.each( other_color_controls, function ( other_color_control_id ) {
let other_control = api.control.instance( other_color_control_id );
let other_color = other_control.container.find( '.color-picker-hex' ).val();
let name = $( '#customize-control-' + other_color_control_id + ' .customize-control-title' ).text();
let contrast = self.hex( current_color, other_color );
let score = self.score( contrast );
// contrast >= 7 ? "AAA" : contrast >= 4.5 ? "AA" : ""
if ( contrast < 4.5 ) {
setting.notifications.remove( other_color_control_id );
validationWarning = new api.Notification( other_color_control_id, { message: self.sprintf( 'WCAG conflict with "%s"<br/>contrast: %s' ,name, contrast), type: 'warning' } );
validationWarning = new api.Notification( other_color_control_id, { message: self.sprintf( 'WCAG conflict with "%s"<br/>contrast: %s', name, contrast ), type: 'warning' } );
setting.notifications.add( validationWarning.code, validationWarning );
// console.log( color_control_id + ' ' + color + ' ' + contrast + ' ' + score );
} else {
@ -75,19 +73,18 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* @param {wp.customize.Setting} setting - Setting.
* @returns {boolean}
*/
self.isColorControl = function( setting ) {
return _.findKey( self.validate_color_contrast, function( key, value ) {
self.isColorControl = function ( setting ) {
return _.findKey( self.validate_color_contrast, function ( key, value ) {
return value == setting.id;
} );
};
api.bind( 'add', function( setting ) {
api.bind( 'add', function ( setting ) {
self.addWCAGColorContrastValidation( setting );
} );
self.sprintf = function( format ) {
for( var i=1; i < arguments.length; i++ ) {
self.sprintf = function ( format ) {
for ( let i=1; i < arguments.length; i++ ) {
format = format.replace( /%s/, arguments[i] );
}
return format;
@ -98,20 +95,20 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
*/
// from https://github.com/sindresorhus/hex-rgb
self.hexRgb = function (hex) {
if (typeof hex !== 'string') {
throw new TypeError('Expected a string');
self.hexRgb = function ( hex ) {
if ( typeof hex !== 'string' ) {
throw new TypeError( 'Expected a string' );
}
hex = hex.replace(/^#/, '');
hex = hex.replace( /^#/, '' );
if (hex.length === 3) {
if ( hex.length === 3 ) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
var num = parseInt(hex, 16);
let num = parseInt( hex, 16 );
return [num >> 16, num >> 8 & 255, num & 255];
return [ num >> 16, num >> 8 & 255, num & 255 ];
};
// from https://github.com/tmcw/relative-luminance
@ -123,14 +120,14 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
// https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients
// red, green, and blue coefficients
var rc = 0.2126,
let rc = 0.2126,
gc = 0.7152,
bc = 0.0722,
// low-gamma adjust coefficient
lowc = 1 / 12.92;
self.adjustGamma = function( g ) {
return Math.pow((g + 0.055) / 1.055, 2.4);
self.adjustGamma = function ( g ) {
return Math.pow( ( g + 0.055 ) / 1.055, 2.4 );
};
/**
@ -142,19 +139,18 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* var luminance = require('relative-luminance');
* var black_lum = luminance([0, 0, 0]); // 0
*/
self.relativeLuminance = function (rgb) {
var rsrgb = rgb[0] / 255;
var gsrgb = rgb[1] / 255;
var bsrgb = rgb[2] / 255;
self.relativeLuminance = function ( rgb ) {
let rsrgb = rgb[0] / 255;
let gsrgb = rgb[1] / 255;
let bsrgb = rgb[2] / 255;
var r = rsrgb <= 0.03928 ? rsrgb * lowc : self.adjustGamma(rsrgb),
g = gsrgb <= 0.03928 ? gsrgb * lowc : self.adjustGamma(gsrgb),
b = bsrgb <= 0.03928 ? bsrgb * lowc : self.adjustGamma(bsrgb);
let r = rsrgb <= 0.03928 ? rsrgb * lowc : self.adjustGamma( rsrgb ),
g = gsrgb <= 0.03928 ? gsrgb * lowc : self.adjustGamma( gsrgb ),
b = bsrgb <= 0.03928 ? bsrgb * lowc : self.adjustGamma( bsrgb );
return r * rc + g * gc + b * bc;
};
// from https://github.com/tmcw/wcag-contrast
/**
* Get the contrast ratio between two relative luminance values
@ -164,10 +160,10 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* @example
* luminance(1, 1); // = 1
*/
self.luminance = function(a, b) {
var l1 = Math.max(a, b);
var l2 = Math.min(a, b);
return (l1 + 0.05) / (l2 + 0.05);
self.luminance = function ( a, b ) {
let l1 = Math.max( a, b );
let l2 = Math.min( a, b );
return ( l1 + 0.05 ) / ( l2 + 0.05 );
};
/**
@ -178,8 +174,8 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* @example
* rgb([0, 0, 0], [255, 255, 255]); // = 21
*/
self.rgb = function(a, b) {
return self.luminance(self.relativeLuminance(a), self.relativeLuminance(b));
self.rgb = function ( a, b ) {
return self.luminance( self.relativeLuminance( a ), self.relativeLuminance( b ) );
};
/**
@ -190,8 +186,8 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* @example
* hex('#000', '#fff'); // = 21
*/
self.hex = function(a, b) {
return self.rgb(self.hexRgb(a), self.hexRgb(b));
self.hex = function ( a, b ) {
return self.rgb( self.hexRgb( a ), self.hexRgb( b ) );
};
/**
@ -201,8 +197,8 @@ var validateWCAGColorContrast = ( function( $, api, exports ) {
* @example
* score(10); // = 'AAA'
*/
self.score = function(contrast) {
return contrast >= 7 ? "AAA" : contrast >= 4.5 ? "AA" : "";
self.score = function ( contrast ) {
return contrast >= 7 ? 'AAA' : contrast >= 4.5 ? 'AA' : '';
};
return self;

17535
package-lock.json generated

File diff suppressed because it is too large Load Diff

4
package.json

@ -1,6 +1,6 @@
{
"name": "@pressbooks/pressbooks-aldine",
"version": "1.0.0-dev",
"version": "1.0.0-beta.1",
"author": "Pressbooks (Book Oven Inc.) <code@pressbooks.com>",
"homepage": "https://github.com/pressbooks/pressbooks-aldine/",
"description": "Aldine is the root theme for Pressbooks.",
@ -54,7 +54,7 @@
"pressbooks-build-tools": "^0.9.0"
},
"dependencies": {
"aetna": "^0.4.0",
"aetna": "^1.0.0-alpha",
"isotope-layout": "^3.0.5",
"jquery-bridget": "^2.0.1",
"js-cookie": "^2.2.0",

26
partials/book.php

@ -1,21 +1,29 @@
<?php use function \Aldine\Helpers\maybe_truncate_string; ?>
<?php $subject = ( isset( $book['subject'] ) ) ? substr( $book['subject'], 0, 2 ) : '';
$date = ( isset( $book['metadata']['datePublished'] ) ) ? str_replace( '-', '', $book['metadata']['datePublished'] ) : '';
?>
<div class="book"
<li class="book"
<?php if ( $date ) { ?>data-date-published="<?php echo $date; ?>"<?php } ?>
data-license="<?php echo ( new \Pressbooks\Licensing() )->getLicenseFromUrl( $book['metadata']['license']['url'] ); ?>"
<?php if ( ! empty( $subject ) ) { ?> data-subject="<?php echo $subject ?>"<?php } ?>
>
<?php if ( ! empty( $subject ) ) { ?>
<p class="book__title">
<a href="<?php echo $book['link']; ?>"><?php echo maybe_truncate_string( $book['metadata']['name'] ); ?></a>
</p>
<?php /* <?php if (isset( $book['metadata']['author'] ) ) { ?>
<p class="book__author">
<?php _e( 'By', 'pressbooks-aldine' ); ?> <?php foreach ( $book['metadata']['author'] as $author ) {
echo $author['name'];
} ?>
</p>
<?php } ?> */ ?>
<?php if ( ! empty( $subject ) ) { ?>
<p class="book__subject">
<a href="<?php echo network_home_url( "/catalog/#$subject" ) ?>"><?php echo \Pressbooks\Metadata\get_subject_from_thema( $book['subject'] ); ?></a>
</p>
<?php } ?>
<p class="book__title">
<a href="<?php echo $book['link']; ?>"><?php echo $book['metadata']['name']; ?></a>
</p>
<p class="book__read-more">
<?php } ?>
<p class="book__read-more">
<a href="<?php echo $book['link']; ?>"><?php _e( 'About this book', 'pressbooks-aldine' ); ?> <svg aria-hidden="true"><use xlink:href="#arrow-right" /></svg></a>
</p>
</div>
</li>

43
partials/content-front-page.php

@ -11,7 +11,6 @@
<?php
use function Aldine\Helpers\has_blocks;
use function Aldine\Helpers\get_catalog_data;
$front_page_catalog = get_option( 'pb_front_page_catalog' );
@ -29,8 +28,7 @@ $next_page = $page + 1;
<p class="entry-description"><?php echo get_bloginfo( 'description', 'display' ); ?></p>
</header><!-- .entry-header -->
<?php $classes = ( has_blocks( get_the_ID() ) ) ? 'entry-content blocks' : 'entry-content'; ?>
<div class="<?php echo $classes; ?>">
<div class="entry-content">
<?php
the_content();
?>
@ -38,39 +36,18 @@ $next_page = $page + 1;
</article><!-- #post-<?php the_ID(); ?> -->
<?php if ( get_option( 'pb_front_page_catalog' ) ) : ?>
<div id="latest-titles" class="latest-books">
<h2><?php echo $latest_books_title; ?></h2>
<div class="track">
<div class="books" data-total-pages="<?php echo $catalog_data['pages']; ?>" <?php if ( $next_page <= $catalog_data['pages'] ) : ?>data-next-page="<?php echo $next_page; ?>"<?php endif; ?>>
<div id="latest-books" class="latest-books">
<h2 id="latest-books-title"><?php echo $latest_books_title; ?></h2>
<div class="slider" role="region" aria-labelledby="latest-books-title" data-total-pages="<?php echo $catalog_data['pages']; ?>" <?php if ( $next_page <= $catalog_data['pages'] ) : ?>data-next-page="<?php echo $next_page; ?>"<?php endif; ?>>
<ul class="books">
<?php foreach ( $catalog_data['books'] as $book ) :
include( locate_template( 'partials/book.php' ) );
endforeach; ?>
</div>
<?php if ( $previous_page || $next_page ) { ?>
<div class="booknav">
<?php } ?>
<?php if ( $previous_page ) : ?>
<a class="previous" rel="previous" data-page="<?php echo $previous_page; ?>" href="<?php echo network_home_url( "/page/$previous_page/#latest-titles" ); ?>">
<span class="screen-reader-text"><?php _e( 'Previous Page', 'pressbooks' ); ?></span>
<svg aria-hidden="true">
<use xlink:href="#arrow-left" />
</svg>
</a>
<?php endif; ?>
<?php if ( $next_page <= $catalog_data['pages'] ) : ?>
<a class="next" rel="next" data-page="<?php echo $next_page; ?>" href="<?php echo network_home_url( "/page/$next_page/#latest-titles" ); ?>">
<span class="screen-reader-text"><?php _e( 'Next Page', 'pressbooks' ); ?></span>
<svg aria-hidden="true">
<use xlink:href="#arrow-right" />
</svg>
</a>
<?php endif; ?>
<?php if ( $previous_page || $next_page ) { ?>
</div>
<?php } ?>
</div>
<div class="catalog-link">
<a class="button button--outline button--wide" href="<?php echo network_home_url( '/catalog/' ); ?>"><?php _e( 'View Complete Catalog', 'pressbooks-aldine' ); ?></a>
</ul>
<?php if ( $previous_page || $next_page ) { include( locate_template( 'partials/paged-navigation.php' ) ); } ?>
</div>
<p class="catalog-link">
<a class="call-to-action" href="<?php echo network_home_url( '/catalog/' ); ?>"><?php _e( 'View Complete Catalog', 'pressbooks-aldine' ); ?></a>
</p>
</div>
<?php endif; ?>

100
partials/content-page-catalog.php

@ -13,6 +13,8 @@
use function Aldine\Helpers\get_catalog_data;
use function Aldine\Helpers\get_catalog_licenses;
use function Aldine\Helpers\get_available_subjects;
use function Aldine\Helpers\get_available_licenses;
$current_page = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$orderby = ( get_query_var( 'orderby' ) ) ? get_query_var( 'orderby' ) : 'title';
@ -22,58 +24,71 @@ $catalog_data = get_catalog_data( $current_page, 9, $orderby, $license, $subject
$previous_page = ( $current_page > 1 ) ? $current_page - 1 : 0;
$next_page = $current_page + 1;
$licenses = get_catalog_licenses();
$subject_groups = ( defined( 'PB_PLUGIN_VERSION' ) ) ? \Pressbooks\Metadata\get_thema_subjects() : [];
$available_licenses = get_available_licenses( $catalog_data );
$subjects = ( defined( 'PB_PLUGIN_VERSION' ) ) ? \Pressbooks\Metadata\get_thema_subjects() : [];
$available_subjects = get_available_subjects( $catalog_data );
?>
<?php get_template_part( 'partials/page', 'header' ); ?>
<section class="network-catalog">
<div class="controls">
<div class="search">
<h2><a href="#search"><?php _e( 'Search by titles or keyword', 'pressbooks-aldine' ); ?> <svg class="arrow" width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg"><path d="M6.255 8L0 0h12.51z" fill="#b01109" fill-rule="evenodd"/></svg></a></h2>
</div>
<div class="filters">
<a href="#filter"><?php _e( 'Filter by', 'pressbooks-aldine' ); ?> <svg class="arrow" width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg"><path d="M6.255 8L0 0h12.51z" fill="#b01109" fill-rule="evenodd"/></svg></a>
<div id="filter" class="filter-groups">
<?php foreach ( $subject_groups as $key => $val ) : ?>
<div class="<?php echo $key; ?> subjects" id="<?php echo $key; ?>">
<a href="#<?php echo $key; ?>"><?php echo $val['label']; ?> <svg class="arrow" width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg"><path d="M6.255 8L0 0h12.51z" fill="#b01109" fill-rule="evenodd"/></svg></a>
<ul class="filter-list">
<form role="form" class="filter-sort" method="get">
<input type="hidden" name="paged" value="<?php echo $current_page; ?>" />
<fieldset class="subject-filters">
<h2><?php _e( 'Filter by Subject', 'pressbooks-aldine' ); ?></h2>
<input type="radio" name="subject" id="all-subjects" value="" <?php checked( $subject, '' ); ?>>
<label for="all-subjects"><?php _e( 'All Subjects', 'pressbooks-aldine' ); ?> <svg class="checked"><use xlink:href="#checkmark" /></svg></label>
<div class="subject-groups">
<?php foreach ( $subjects as $key => $val ) :
if ( array_key_exists( $key, $available_subjects ) ) : ?>
<h3><span class="label"><?php echo $val['label']; ?></span></h3>
<?php foreach ( $val['children'] as $k => $v ) :
if ( strlen( $k ) === 2 ) : ?>
<li><a data-filter="{{ $k }}"><?php echo $v; ?><span class="close">&times;</span></a></li>
if ( in_array( $k, $available_subjects[ $key ], true ) ) : ?>
<input type="radio" name="subject" id="<?php echo $k; ?>" value="<?php echo $k; ?>" <?php checked( $subject, $k ); ?>>
<label for="<?php echo $k; ?>"><span class="label"><?php echo $v; ?></span> <svg class="checked"><use xlink:href="#checkmark" /></svg></label>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endforeach; ?>
</div>
<div class="licenses" id="licenses">
<a href="#licenses"><?php _e( 'Licenses', 'pressbooks-aldine' ); ?><svg class="arrow" width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg"><path d="M6.255 8L0 0h12.51z" fill="#b01109" fill-rule="evenodd"/></svg></a>
<ul class="filter-list">
<?php foreach ( $licenses as $key => $value ) : ?>
<li><a data-filter="<?php echo $key; ?>"><?php echo $value; ?><span class="close">&times;</span></a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="sort">
<a href="#sort"><?php _e( 'Sort by', 'pressbooks-aldine' ); ?> <svg class="arrow" width="13" height="8" viewBox="0 0 13 8" xmlns="http://www.w3.org/2000/svg"><path d="M6.255 8L0 0h12.51z" fill="#b01109" fill-rule="evenodd"/></svg></a>
<ul id="sort" class="sorts">
<li><a data-sort="title" href="<?php echo "/catalog/page/$current_page/?orderby=title"; ?>"><?php _e( 'Title', 'pressbooks-aldine' ); ?></a></li>
<li><a data-sort="subject" href="<?php echo "/catalog/page/$current_page/?orderby=subject"; ?>"><?php _e( 'Subject', 'pressbooks-aldine' ); ?></a></li>
<li><a data-sort="latest" href="<?php echo "/catalog/page/$current_page/?orderby=latest"; ?>"><?php _e( 'Latest', 'pressbooks-aldine' ); ?></a></li>
</ul>
</div>
</div>
<div class="books">
<?php endif; ?>
<?php endforeach; ?>
</div>
</fieldset>
<fieldset class="license-filters">
<h2><?php _e( 'Filter by License', 'pressbooks-aldine' ); ?></h2>
<input type="radio" name="license" id="all-licenses" value="" <?php checked( $license, '' ); ?>>
<label for="all-licenses"><?php _e( 'All Licenses', 'pressbooks-aldine' ); ?> <svg class="checked"><use xlink:href="#checkmark" /></svg></label>
<?php foreach ( $licenses as $key => $value ) :
if ( in_array( $key, $available_licenses, true ) ) : ?>
<input type="radio" name="license" id="<?php echo $key; ?>" value="<?php echo $key; ?>" <?php checked( $license, $key ); ?>>
<label for="<?php echo $key; ?>"><?php echo $value; ?> <svg class="checked"><use xlink:href="#checkmark" /></svg></label>
<?php endif;
endforeach; ?>
</fieldset>
<fieldset class="sorts">
<h2><?php _e( 'Sort by', 'pressbooks-aldine' ); ?></h2>
<?php
$sorts = [
'title' => __( 'Title', 'pressbooks-aldine' ),
'subject' => __( 'Subject', 'pressbooks-aldine' ),
'latest' => __( 'Latest', 'pressbooks-aldine' ),
];
foreach ( $sorts as $key => $value ) { ?>
<input type="radio" name="orderby" id="<?php echo $key ?>" value="<?php echo $key ?>" <?php checked( $orderby, $key ); ?>>
<label for="<?php echo $key ?>"><?php echo $value; ?> <svg class="checked"><use xlink:href="#checkmark" /></svg></label>
<?php } ?>
</fieldset>
<button type="button" class="clear-filters" hidden><?php _e( 'Clear Filters', 'pressbooks-aldine' ); ?></button>
<button type="submit"><?php _e( 'Submit', 'pressbooks-aldine' ); ?></button>
</form>
<ul class="books">
<?php foreach ( $catalog_data['books'] as $book ) :
include( locate_template( 'partials/book.php' ) );
endforeach; ?>
</div>
</ul>
<?php if ( $catalog_data['pages'] > 1 ) : ?>
<nav class="catalog-navigation">
<?php if ( $previous_page ) : ?><a class="previous" data-page="<?php echo $previous_page; ?>" href="<?php echo network_home_url( "/catalog/page/$previous_page/" ); ?>"><?php _e( 'Previous', 'pressbooks-aldine' ); ?></a><?php endif; ?>
<?php if ( $previous_page ) : ?><a class="previous" rel="previous" data-page="<?php echo $previous_page; ?>" href="<?php echo network_home_url( "/catalog/page/$previous_page/" ); ?>"><span class="screen-reader-text"><?php _e( 'Previous Page', 'pressbooks' ); ?></span>
<svg aria-hidden="true">
<use xlink:href="#arrow-left" />
</svg></a><?php endif; ?>
<div class="pages">
<?php for ( $i = 1; $i <= $catalog_data['pages']; $i++ ) :
if ( $i === $current_page ) : ?>
@ -83,7 +98,10 @@ $subject_groups = ( defined( 'PB_PLUGIN_VERSION' ) ) ? \Pressbooks\Metadata\get_
<?php endif; ?>
<?php endfor; ?>
</div>
<?php if ( $next_page <= $catalog_data['pages'] ) : ?><a class="next" data-page="<?php echo $next_page; ?>" href="<?php echo network_home_url( "/catalog/page/$next_page/" ); ?>"><?php _e( 'Next', 'pressbooks-aldine' ); ?></a><?php endif; ?>
<?php if ( $next_page <= $catalog_data['pages'] ) : ?><a class="next" rel="next" data-page="<?php echo $next_page; ?>" href="<?php echo network_home_url( "/catalog/page/$next_page/" ); ?>"><span class="screen-reader-text"><?php _e( 'Next Page', 'pressbooks' ); ?></span>
<svg aria-hidden="true">
<use xlink:href="#arrow-right" />
</svg></a><?php endif; ?>
</nav>
<?php endif; ?>
</section>

9
partials/content-page.php

@ -9,19 +9,12 @@
?>
<?php
use function Aldine\Helpers\has_blocks;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php $classes = ( has_blocks( get_the_ID() ) ) ? 'entry-content blocks' : 'entry-content'; ?>
<div class="<?php echo $classes; ?>">
<div class="entry-content">
<?php
the_content();

19
partials/paged-navigation.php

@ -0,0 +1,19 @@
<nav class="booknav" aria-labelledby="latest-books-title book-navigation">
<span class="screen-reader-text"><?php _e( 'Navigation', 'pressbooks-aldine' ); ?></span>
<?php if ( $previous_page ) : ?>
<a class="previous" rel="previous" data-page="<?php echo $previous_page; ?>" href="<?php echo network_home_url( "/page/$previous_page/#latest-books" ); ?>">
<span class="screen-reader-text"><?php _e( 'Previous Page', 'pressbooks' ); ?></span>
<svg aria-hidden="true">
<use xlink:href="#arrow-left" />
</svg>
</a>
<?php endif; ?>
<?php if ( $next_page <= $catalog_data['pages'] ) : ?>
<a class="next" rel="next" data-page="<?php echo $next_page; ?>" href="<?php echo network_home_url( "/page/$next_page/#latest-books" ); ?>">
<span class="screen-reader-text"><?php _e( 'Next Page', 'pressbooks' ); ?></span>
<svg aria-hidden="true">
<use xlink:href="#arrow-right" />
</svg>
</a>
<?php endif; ?>
</nav>

28
webpack.mix.js

@ -1,4 +1,4 @@
let mix = require( 'laravel-mix' );
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
@ -16,14 +16,14 @@ const partials = 'partials';
const assets = 'assets';
const dist = 'dist';
mix.setPublicPath( dist );
mix.setResourceRoot( '../' );
mix.setPublicPath(dist);
mix.setResourceRoot('../');
// BrowserSync
mix.browserSync( {
host: 'localhost',
mix.browserSync({
host: 'localhost',
proxy: 'https://pressbooks.test',
port: 3000,
port: 3100,
files: [
'*.php',
`${inc}/**/*.php`,
@ -31,7 +31,7 @@ mix.browserSync( {
`${dist}/**/*.css`,
`${dist}/**/*.js`,
],
} );
});
// Sass
mix.sass( `${assets}/styles/aldine.scss`, `${dist}/styles/aldine.css` );
@ -54,28 +54,28 @@ mix
// Assets
mix
.copy( `${assets}/fonts`, `${dist}/fonts`, false )
.copy( `${assets}/images`, `${dist}/images`, false );
.copy(`${assets}/fonts`, `${dist}/fonts`, false)
.copy(`${assets}/images`, `${dist}/images`, false);
// Options
mix.options( { processCssUrls: false } );
mix.options({ processCssUrls: false });
// Source maps when not in production.
if ( ! mix.inProduction() ) {
if (!mix.inProduction()) {
mix.sourceMaps();
}
// Hash and version files in production.
if ( mix.inProduction() ) {
if (mix.inProduction()) {
mix.version();
}
// Add Isotope support.
mix.webpackConfig( {
mix.webpackConfig({
resolve: {
alias: {
masonry: 'masonry-layout',
isotope: 'isotope-layout',
},
},
} );
});

1445
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save