Skip to content

Commit

Permalink
Refactor. Add global styles for heading and quote
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Q committed Feb 7, 2020
1 parent e291e15 commit a7c32cc
Show file tree
Hide file tree
Showing 13 changed files with 421 additions and 235 deletions.
10 changes: 10 additions & 0 deletions lib/demo-block-templates/front-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ <h6>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h6>
scelerisque. Etiam euismod blandit leo a maximus.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit</p>
</blockquote>
<!-- /wp:quote -->

<!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link">Hello</a></div>
<!-- /wp:button -->

<!-- wp:columns {"align":"wide"} -->
<div class="wp-block-columns alignwide">
<!-- wp:column -->
Expand Down
17 changes: 9 additions & 8 deletions packages/block-library/src/heading/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,27 @@
h4,
h5,
h6 {
color: var(--wp-color-text);
line-height: var(--wp-typography-titleLineHeight);
color: var(--wp-color--text);
font-weight: var(--wp-heading--fontWeight);
line-height: var(--wp-typography--titleLineHeight);
}
}

.wp-gs h1 {
font-size: var(--wp-typography-fontSizeH1);
font-size: var(--wp-typography--fontSizeH1);
}
.wp-gs h2 {
font-size: var(--wp-typography-fontSizeH2);
font-size: var(--wp-typography--fontSizeH2);
}
.wp-gs h3 {
font-size: var(--wp-typography-fontSizeH3);
font-size: var(--wp-typography--fontSizeH3);
}
.wp-gs h4 {
font-size: var(--wp-typography-fontSizeH4);
font-size: var(--wp-typography--fontSizeH4);
}
.wp-gs h5 {
font-size: var(--wp-typography-fontSizeH5);
font-size: var(--wp-typography--fontSizeH5);
}
.wp-gs h6 {
font-size: var(--wp-typography-fontSizeH6);
font-size: var(--wp-typography--fontSizeH6);
}
7 changes: 4 additions & 3 deletions packages/block-library/src/paragraph/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ p.has-text-color a {
}

.wp-gs p {
color: var(--wp-color-text);
font-size: var(--wp-typography-fontSize);
line-height: var(--wp-typography-lineHeight);
color: var(--wp-color--text);
font-size: var(--wp-typography--fontSize);
font-weight: var(--wp-typography--fontWeight);
line-height: var(--wp-typography--lineHeight);
}
6 changes: 6 additions & 0 deletions packages/block-library/src/quote/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@
}
}
}

.wp-gs .wp-block-quote {
p {
font-size: var(--wp-quote--fontSize);
}
}
224 changes: 0 additions & 224 deletions packages/edit-site/src/components/sidebar/global-styles-panel.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import { GlobalStylesStateProvider } from './store';

import { Panel } from '@wordpress/components';

import {
ColorPanel,
HeadingPanel,
QuotePanel,
TypographyPanel,
} from './panels';

export default function GlobalStylesPanel() {
return (
<GlobalStylesStateProvider>
<Panel header={ __( 'Global Styles' ) }>
<TypographyPanel />
<ColorPanel />
<HeadingPanel />
<QuotePanel />
</Panel>
</GlobalStylesStateProvider>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { PanelBody, ColorControl } from '@wordpress/components';

/**
* Internal dependencies
*/
import { useGlobalStylesState } from '../store';

export default function ColorsPanel() {
const {
textColor,
setTextColor,
backgroundColor,
setBackgroundColor,
primaryColor,
setPrimaryColor,
} = useGlobalStylesState();

return (
<PanelBody title={ __( 'Colors' ) } initialOpen={ false }>
<ColorControl
label={ __( 'Text' ) }
value={ textColor }
onChange={ setTextColor }
/>
<ColorControl
label={ __( 'Background' ) }
value={ backgroundColor }
onChange={ setBackgroundColor }
/>
<ColorControl
label={ __( 'Primary' ) }
value={ primaryColor }
onChange={ setPrimaryColor }
/>
</PanelBody>
);
}
Loading

0 comments on commit a7c32cc

Please sign in to comment.