Skip to content

Commit

Permalink
Improve handbook styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheu committed Nov 27, 2017
1 parent d774aec commit fe7b4ba
Show file tree
Hide file tree
Showing 20 changed files with 135 additions and 176 deletions.
20 changes: 10 additions & 10 deletions assets/src/scripts/components/NavAccordion/NavAccordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function( navAccordionItem ) {

navAccordionToggle.appendChild( span ) ;
navAccordionToggle.classList.add( 'Btn' );
navAccordionToggle.classList.add( 'NavAccordion_Toggle' );
navAccordionToggle.classList.add( 'nav-accordion__toggle' );
navAccordionToggle.setAttribute( 'role', 'button' );
navAccordionToggle.setAttribute( 'aria-haspopup', 'true' );

Expand All @@ -33,29 +33,29 @@ export default function( navAccordionItem ) {
var toggleSubNav = function( show ) {

if ( 'undefined' === typeof show ) {
show = navAccordionItem.classList.contains( 'NavAccordion_Item-Closed' );
show = navAccordionItem.classList.contains( 'nav-accordion__item--closed' );
navAccordionToggle.setAttribute( 'aria-expanded', 'false' );
}

if ( show ) {
navAccordionItem.classList.remove( 'NavAccordion_Item-Closed' );
navAccordionItem.classList.add( 'NavAccordion_Item-Open' );
navAccordionToggle.classList.add( 'NavAccordion_Toggle-Open' );
navAccordionItem.classList.remove( 'nav-accordion__item--closed' );
navAccordionItem.classList.add( 'nav-accordion__item--open' );
navAccordionToggle.classList.add( 'nav-accordion__toggle--open' );
navAccordionToggle.setAttribute( 'aria-expanded', 'true' );
subNav.style.display = 'block';
} else {
navAccordionItem.classList.add( 'NavAccordion_Item-Closed' );
navAccordionItem.classList.remove( 'NavAccordion_Item-Open' );
navAccordionToggle.classList.remove( 'NavAccordion_Toggle-Open' );
navAccordionItem.classList.add( 'nav-accordion__item--closed' );
navAccordionItem.classList.remove( 'nav-accordion__item--open' );
navAccordionToggle.classList.remove( 'nav-accordion__toggle--open' );
navAccordionToggle.setAttribute( 'aria-expanded', 'false' );
subNav.style.display = 'none';
}

}

if ( navAccordionItem.classList.contains( 'NavAccordion_Item-Active' ) ) {
if ( navAccordionItem.classList.contains( 'nav-accordion__item--active' ) ) {
toggleSubNav( true );
} else if ( subNav.getElementsByClassName( 'NavAccordion_Item-Active' ).length > 0 ) {
} else if ( subNav.getElementsByClassName( 'nav-accordion__item--active' ).length > 0 ) {
toggleSubNav( true );
} else {
toggleSubNav( false );
Expand Down
4 changes: 2 additions & 2 deletions assets/src/scripts/components/PageHistory/PageHistoryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class PageHistoryList extends React.Component {
toggleButtonClasses = [ 'btn btn--small btn--toggle' ];
toggleButtonClasses.push( this.state.expanded ? ' btn--state-expanded' : null );

loadMorebuttonClasses = [ 'btn btn--small btn-Link' ];
loadMorebuttonClasses = [ 'btn btn--small btn--tertiary' ];
loadMorebuttonClasses.push( this.props.loading ? 'btn-Loading' : null );

return (
Expand All @@ -50,7 +50,7 @@ export default class PageHistoryList extends React.Component {
})}
</ul>
<button onClick={ () => actions.onfetchRevisions() } className={ loadMorebuttonClasses.join( ' ' ) } disabled={ ! this.props.hasMore }>
<span className={ this.props.loading ? 'Loading Loading-Active' : 'Loading' }></span>
{ this.props.loading && <span className="loading loading--active"></span> }
{ PageHistorySettings.strings.loadMore }
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion assets/src/scripts/components/SearchBar/SearchBarResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class SearchBarResult extends Component {
'search-bar__result--post': 'post' === this.props.type
});

let style = { width: ( this.props.containerWidth - 60 ) + 'px' }
let style = {}

return (
<div style={ style } className={ classes }>
Expand Down
22 changes: 10 additions & 12 deletions assets/src/scripts/components/SearchBar/SearchBarResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,24 @@ export default class SearchBarResults extends Component {

render() {

// Get the height of the whole document.
// Bit convoluted, taken from jQuery.
var height = Math.max(
document.body.scrollHeight,
document.body.offsetHeight,
document.documentElement.clientHeight,
document.documentElement.scrollHeight,
document.documentElement.offsetHeight
);

var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var search = document.getElementById( 'site-search' );
var adminBar = document.getElementById( 'wpadminbar' );

if ( search ) {
height -= search.offsetHeight;
}

if ( adminBar ) {
height = height - adminBar.offsetHeight;
height -= adminBar.offsetHeight;
}

height -= 54;

let displayNoResults = this.props.query.length > 1 && this.props.results.length < 1;

return (
<div className="search-bar__results" style={ { maxHeight: ( height - 108 ) + 'px' } }>
<div className="search-bar__results" style={ { maxHeight: height }}>

<h3
className="search-bar__results__info"
Expand Down
2 changes: 1 addition & 1 deletion assets/src/scripts/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ searchBarContainers.forEach( searchBarContainer => {

// Init Accordion Nav for all NavAccordion Items.
Array.prototype.forEach.call(
document.getElementsByClassName( 'NavAccordion_Item' ),
document.getElementsByClassName( 'nav-accordion__item' ),
initNavAccordion
);

4 changes: 2 additions & 2 deletions assets/src/styles/base/_fonts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ li,
}

.wf-active {
.NavAccordion ul,
.NavAccordion ol {
.nav-accordion ul,
.nav-accordion ol {
transition: opacity linear 0.05s, max-height ease-in-out 0.1s;
}
}
33 changes: 6 additions & 27 deletions assets/src/styles/base/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,47 +28,26 @@ body {
}

.site-content-container {

width: 100%;
padding: $margin-vertical-sm $gutter-width * 2;
display: grid;
grid-template-columns: auto;

@media #{ $mq-md-up } {
width: calc( 100% - 300px );
max-width: calc( 40rem + #{ $gutter-width + 250px + $gutter-width * 2 } );
grid-template-columns: calc( 100% - 250px - $gutter-width ) 250px;
grid-column-gap: $gutter-width;
}

@media #{ $mq-lg-up } {
max-width: calc( 40rem + #{ $gutter-width * 2 + 250px + $gutter-width * 4 } );
padding: $margin-vertical-sm * 2 ( $gutter-width * 4 );
grid-template-columns: calc( 100% - 250px - #{ $gutter-width * 2 } ) 250px;
grid-column-gap: $gutter-width * 2;
}
}

.site-content {

width: 100%;
float: left;

@media #{ $mq-md-up } {
width: calc( 100% - 250px );
padding-right: $gutter-width;
}

@media #{ $mq-lg-up } {
padding-right: $gutter-width * 2;
}
}

.site-content-sidebar {

width: 100%;
float: left;

@media #{ $mq-md-up } {
width: 250px;
}

}

.site-footer {
width: 100%;
clear: both;
Expand Down
1 change: 0 additions & 1 deletion assets/src/styles/base/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ $border-color-darken: darken( $border-color, 10% ) !default;

// Page History
$color-success: $hm-handbook-colour-green !default;
$color-pagehistory-background: $hm_light-grey !default;
$color-pagehistory-list: $hm-medium-grey !default;

// Sidebar
Expand Down
2 changes: 1 addition & 1 deletion assets/src/styles/components/_Nav.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Nav_Item-Private a:before {
.nav-accordion__item--private a:before {
$iconSrc: iconSrc( "lock" );
content: " ";
display: inline-block;
Expand Down
15 changes: 4 additions & 11 deletions assets/src/styles/components/_PageHistory.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
}

.PageHistory_List_Container {

width: 100%;
position: relative;
margin: $base-line-height 0;
padding: #{ $base-line-height / 2 } #{ $gutter-width };
background: $color-pagehistory-background;
border-radius: 2px;

@media #{ $mq-md-up } {
Expand All @@ -36,11 +33,10 @@
}

.PageHistory_List_Container {
.PageHistory_List + .btn .Loading {
.PageHistory_List + .btn .loading {
background-image: url( "#{ $images-path }/icons/icon-spinner-black.svg" );
background-size: 50%;
margin-right: 7px;
opacity: 0.3;
background-size: 60%;
margin: 0 3px 0 -5px;
}
}

Expand Down Expand Up @@ -99,7 +95,6 @@

& + .btn {
margin: 0;
padding: 0;
}

}
Expand Down Expand Up @@ -162,7 +157,6 @@
@include text-sm;
display: none; // Only shown when active.
white-space: pre-wrap;
background: $color-pagehistory-background;
padding: $base-line-height / 2 $gutter-width / 2;
font-family: $font-family-code;
word-wrap: break-word;
Expand All @@ -182,11 +176,10 @@
}

.btn--toggle {

background: none;
border: none;
position: absolute;
top: .7775rem;
top: 0;
right: $gutter-width;
margin: 0;
text-indent: 100%;
Expand Down
1 change: 0 additions & 1 deletion assets/src/styles/components/_Pagination.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.Pagination {

@include clearfix;

margin: $base-line-height auto;
Expand Down
15 changes: 13 additions & 2 deletions assets/src/styles/components/_footer.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
.Footer {
.site-footer {
margin-top: $margin-vertical-lg;
border-top: 1px solid $border-color-light;

.hm-link {
&:link,
&:visited {
border: none;
color: $hm-medium-grey;
}

.hm-logo--tiny {
margin-left: 0;
}

&:hover,
&:active,
&:focus {
Expand All @@ -11,7 +23,6 @@
opacity: 1;
}
}

}

.footer-content {
Expand Down
Loading

0 comments on commit fe7b4ba

Please sign in to comment.