/** * External dependencies */ import React from 'react'; /** * WordPress dependencies */ const { __ } = wp.i18n; /** * Internal dependencies */ import './configurations.scss'; import Action from '../../components/sui-box/action'; import Box from '../../components/sui-box'; import Button from '../../components/sui-button'; import Checkbox from '../../components/sui-checkbox'; import Tabs from '../../components/sui-tabs'; import Select from '../../components/sui-select'; /** * Configurations component. * * @since 2.7.2 */ export default class Configurations extends React.Component { /** * Component header. * * @return {JSX.Element} Header action buttons. */ getHeaderActions() { const buttons = ( ); return ; } /** * Component footer. * * @return {JSX.Element} Footer action buttons. */ getFooterActions() { const buttons = ( ); return ; } /** * Files tab content. * * @return {JSX.Element} Content */ tabFiles() { return ( { 'speedy' === this.props.view && } ); } /** * Exclusions tab content. * * @return {JSX.Element} Content */ tabExclusions() { let items = []; [ 'styles', 'scripts' ].forEach( ( type ) => { if ( 'undefined' === this.props.assets[ type ] ) { return; } const assets = Object.entries( this.props.assets[ type ] ).map( ( el ) => { const value = el[ 1 ].handle + ' (' + __( 'file: ', 'wphb' ) + el[ 1 ].src + ')'; return [ type + '-' + el[ 1 ].handle, value ]; } ); items = window.lodash.union( items, assets ); } ); const styles = this.props.exclusions.styles.map( ( el ) => 'styles-' + el ); const scripts = this.props.exclusions.scripts.map( ( el ) => 'scripts-' + el ); const exclusions = window.lodash.union( styles, scripts ); return ( ); } /** * Tabs content. * * @return {Object} Tab content elements. */ getTabs() { return [ { id: 'auto-files', description: __( 'Choose which files you want to automatically optimize.', 'wphb' ), content: this.tabFiles(), active: true, }, { id: 'auto-exclusions', description: __( "By default, we'll optimize all the CSS and JS files we can find. If you have specific files you want to leave as-is, list them here, and we'll exclude them.", 'wphb' ), content: this.tabExclusions(), }, ]; } /** * Component body. * * @return {JSX.Element} Content. */ getContent() { const tabsMenu = [ { title: __( 'Files', 'wphb' ), id: 'auto-files', checked: true, }, { title: __( 'Exclusions', 'wphb' ), id: 'auto-exclusions', }, ]; return ( { __( 'The configurations will be applied to the enabled automatic optimization option.', 'wphb' ) } ); } /** * Render component. * * @return {JSX.Element} Configurations component. */ render() { return ( ); } }
{ __( 'The configurations will be applied to the enabled automatic optimization option.', 'wphb' ) }