-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1394 from Automattic/add/1361-taxonomy-page
Apply new error taxonomy page design
- Loading branch information
Showing
10 changed files
with
485 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
#col-left { | ||
display: none; | ||
} | ||
#col-right { | ||
float: none; | ||
width: auto; | ||
} | ||
|
||
/* Improve column widths */ | ||
td.column-details pre, | ||
td.column-sources pre { | ||
overflow: auto; | ||
} | ||
|
||
th.column-created_date_gmt, | ||
th.column-error_type { | ||
width: 15%; | ||
} | ||
|
||
th.column-status { | ||
width: 10%; | ||
} | ||
|
||
.fixed th.column-posts { | ||
width: 10%; | ||
} | ||
|
||
/* Details column */ | ||
.details-attributes__summary { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
details[open] .details-attributes__summary { | ||
font-weight: 600; | ||
margin-bottom: 15px; | ||
} | ||
|
||
.details-attributes__summary::-webkit-details-marker { | ||
display: none; | ||
} | ||
|
||
.details-attributes__summary::after { | ||
order: 99; | ||
width: 12px; | ||
height: 12px; | ||
background-image: url("../images/down-triangle.svg"); | ||
background-size: cover; | ||
background-position: center; | ||
content: ""; | ||
} | ||
|
||
details[open] .details-attributes__summary::after { | ||
transform: rotate(180deg); | ||
} | ||
|
||
.details-attributes__title, | ||
.details-attributes__attr { | ||
color: #dc3232; | ||
} | ||
|
||
.details-attributes__list { | ||
margin-top: 0; | ||
padding-left: 45px; | ||
list-style-type: disc; | ||
} | ||
|
||
.details-attributes__list li { | ||
word-break: break-all; | ||
} | ||
|
||
.details-attributes__value { | ||
color: #00a0d2; | ||
} | ||
|
||
/* Error details toggle button */ | ||
.manage-column.column-details { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
|
||
.error-details-toggle { | ||
display: flex; | ||
flex-direction: column; | ||
height: 12px; | ||
margin-right: 10px; | ||
padding: 0; | ||
background: none; | ||
border: none; | ||
cursor: pointer; | ||
} | ||
|
||
.error-details-toggle.is-open { | ||
transform: rotate(180deg); | ||
} | ||
|
||
.error-details-toggle::before, | ||
.error-details-toggle::after { | ||
width: 12px; | ||
height: 12px; | ||
background-image: url("../images/down-triangle.svg"); | ||
background-size: cover; | ||
background-position: center; | ||
content: ""; | ||
} | ||
|
||
/* Status text icons */ | ||
.status-text { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.status-text::before { | ||
margin-right: 10px; | ||
background-size: 20px 20px; | ||
height: 20px; | ||
width: 20px; | ||
content: ""; | ||
} | ||
|
||
.status-text.sanitized::before { | ||
background-image: url( '../images/amp-logo-icon.svg' ); | ||
} | ||
|
||
.status-text.new::before { | ||
background-image: url( '../images/baseline-error.svg' ); | ||
} | ||
|
||
.status-text.accepted::before { | ||
background-image: url( '../images/baseline-check-circle-green.svg' ); | ||
} | ||
|
||
.status-text.rejected::before { | ||
background-image: url( '../images/baseline-error-blue.svg' ); | ||
} | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import domReady from '@wordpress/dom-ready'; | ||
|
||
/** | ||
* Localized data | ||
*/ | ||
import { btnAriaLabel } from 'amp-validation-i18n'; | ||
|
||
const OPEN_CLASS = 'is-open'; | ||
|
||
/** | ||
* Adds detail toggle buttons to the header and footer rows of the validation error "details" column. | ||
* The buttons are added via JS because there's no easy way to append them to the heading of a sortable | ||
* table column via backend code. | ||
*/ | ||
function addToggleButtons() { | ||
[ ...document.querySelectorAll( 'th.column-details.manage-column' ) ].forEach( th => { | ||
const button = document.createElement( 'button' ); | ||
button.setAttribute( 'aria-label', btnAriaLabel ); | ||
button.setAttribute( 'type', 'button' ); | ||
button.setAttribute( 'class', 'error-details-toggle' ); | ||
th.appendChild( button ); | ||
} ); | ||
} | ||
|
||
/** | ||
* Adds a listener toggling all details in the error type taxonomy details column. | ||
*/ | ||
function addToggleListener() { | ||
let open = false; | ||
|
||
const details = [ ...document.querySelectorAll( '.column-details details' ) ]; | ||
const toggleButtons = [ ...document.querySelectorAll( 'button.error-details-toggle' ) ]; | ||
const onButtonClick = () => { | ||
open = ! open; | ||
toggleButtons.forEach( btn => { | ||
btn.classList.toggle( OPEN_CLASS ); | ||
} ); | ||
details.forEach( detail => { | ||
if ( open ) { | ||
detail.setAttribute( 'open', true ); | ||
} else { | ||
detail.removeAttribute( 'open' ); | ||
} | ||
} ); | ||
}; | ||
|
||
window.addEventListener( 'click', event => { | ||
if ( toggleButtons.includes( event.target ) ) { | ||
onButtonClick(); | ||
} | ||
} ); | ||
} | ||
|
||
domReady( () => { | ||
addToggleButtons(); | ||
addToggleListener(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.