Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions packages/edit-site/src/components/global-styles/custom-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* WordPress dependencies
*/
import {
ExternalLink,
TextareaControl,
Panel,
PanelBody,
__experimentalVStack as VStack,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
Expand All @@ -14,6 +14,7 @@ import { experiments as blockEditorExperiments } from '@wordpress/block-editor';
* Internal dependencies
*/
import { unlock } from '../../experiments';
import Subtitle from './subtitle';

const { useGlobalStyle } = unlock( blockEditorExperiments );
function CustomCSSControl( { blockName } ) {
Expand Down Expand Up @@ -52,24 +53,6 @@ function CustomCSSControl( { blockName } ) {

return (
<>
<TextareaControl
__nextHasNoMarginBottom
value={
customCSS?.replace( ignoreThemeCustomCSS, '' ) ||
themeCustomCSS
}
onChange={ ( value ) => handleOnChange( value ) }
rows={ 15 }
className="edit-site-global-styles__custom-css-input"
spellCheck={ false }
help={
<>
<ExternalLink href="https://wordpress.org/support/article/css/">
{ __( 'Learn more about CSS' ) }
</ExternalLink>
</>
}
/>
{ originalThemeCustomCSS && (
<Panel>
<PanelBody
Expand All @@ -82,6 +65,19 @@ function CustomCSSControl( { blockName } ) {
</PanelBody>
</Panel>
) }
<VStack spacing={ 3 }>
<Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>
<TextareaControl
__nextHasNoMarginBottom
value={
customCSS?.replace( ignoreThemeCustomCSS, '' ) ||
themeCustomCSS
}
onChange={ ( value ) => handleOnChange( value ) }
className="edit-site-global-styles__custom-css-input"
spellCheck={ false }
/>
</VStack>
</>
);
}
Expand Down
14 changes: 8 additions & 6 deletions packages/edit-site/src/components/global-styles/screen-css.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
* WordPress dependencies
*/
import { sprintf, __ } from '@wordpress/i18n';
import { __experimentalVStack as VStack } from '@wordpress/components';
import { ExternalLink } from '@wordpress/components';
import { getBlockType } from '@wordpress/blocks';

/**
* Internal dependencies
*/
import ScreenHeader from './header';
import Subtitle from './subtitle';
import CustomCSSControl from './custom-css';

function ScreenCSS( { name } ) {
Expand All @@ -34,11 +33,14 @@ function ScreenCSS( { name } ) {
return (
<>
<ScreenHeader title={ __( 'CSS' ) } description={ description } />
<ExternalLink
href="https://wordpress.org/support/article/css/"
className="edit-site-global-styles-screen-css-help-link"
>
{ __( 'Learn more about CSS' ) }
</ExternalLink>
<div className="edit-site-global-styles-screen-css">
<VStack spacing={ 3 }>
<Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>
<CustomCSSControl blockName={ name } />
</VStack>
<CustomCSSControl blockName={ name } />
</div>
</>
);
Expand Down
34 changes: 34 additions & 0 deletions packages/edit-site/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,32 @@ $block-preview-height: 150px;
border-radius: $radius-block-ui;
}

.edit-site-global-styles-screen-css {
flex: 1 1 auto;
display: flex;
flex-direction: column;

.components-v-stack {
flex: 1 1 auto;

.edit-site-global-styles__custom-css-input {
flex: 1 1 auto;
display: flex;
flex-direction: column;

.components-base-control__field {
flex: 1 1 auto;
display: flex;
flex-direction: column;

.components-textarea-control__input {
flex: 1 1 auto;
}
}
}
}
}

.edit-site-global-styles__custom-css-input textarea {
font-family: $editor_html_font;
}
Expand All @@ -148,6 +174,9 @@ $block-preview-height: 150px;
overflow-y: scroll;
}

.edit-site-global-styles-screen-css-help-link {
padding-left: $grid-unit-20;
}
.edit-site-global-styles-screen-variations {
margin-top: $grid-unit-20;
border-top: 1px solid $gray-300;
Expand All @@ -156,3 +185,8 @@ $block-preview-height: 150px;
margin: $grid-unit-30 $grid-unit-20;
}
}

.edit-site-global-styles-sidebar__navigator-screen {
display: flex;
flex-direction: column;
}