Penscratch 2: Start building out Gutenberg styles and support.

This commit is contained in:
Laurel Fulford 2018-11-08 10:12:33 -08:00
parent 09b6f6f511
commit 127ea625ea
3 changed files with 611 additions and 0 deletions

235
penscratch-2/css/blocks.css Normal file
View file

@ -0,0 +1,235 @@
/*
Theme Name: Penscratch 2
Description: Used to style Gutenberg Blocks.
*/
/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
1.0 General Block Styles
2.0 Blocks - Common Blocks
3.0 Blocks - Formatting
4.0 Blocks - Layout Elements
5.0 Blocks - Widgets
6.0 Blocks - Colors
--------------------------------------------------------------*/
/*--------------------------------------------------------------
1.0 General Block Styles
--------------------------------------------------------------*/
[class^="wp-block-"] figcaption {
}
[class^="wp-block-"]:not(.wp-block-gallery) figcaption {
color: inherit;
}
/*--------------------------------------------------------------
2.0 Blocks - Common Blocks
--------------------------------------------------------------*/
/* Paragraph */
p.has-drop-cap:not(:focus)::first-letter {
font-size: 5em;
margin-top: 0.15em;
}
/* Gallery */
.wp-block-gallery {
margin: 0 0 27px;
}
/* Quote */
.wp-block-quote.is-large,
.wp-block-quote.is-style-large {
}
.rtl .wp-block-quote.is-large,
.rtl .wp-block-quote.is-style-large {
}
/* Audio */
.wp-block-audio {
margin: 0 0 27px;
}
.wp-block-audio audio {
display: block;
width: 100%;
}
/* Cover */
.wp-block-cover-image .wp-block-cover-image-text,
.wp-block-cover-image .wp-block-cover-text,
.wp-block-cover-image h2,
.wp-block-cover .wp-block-cover-image-text,
.wp-block-cover .wp-block-cover-text,
.wp-block-cover h2 {
font-size: 1.5em;
}
/* File */
.wp-block-file a.wp-block-file__button,
.wp-block-file a.wp-block-file__button:visited {
}
.wp-block-file a.wp-block-file__button:hover,
.wp-block-file a.wp-block-file__button:focus,
.wp-block-file a.wp-block-file__button:active {
}
.rtl .wp-block-file * + .wp-block-file__button {
margin-left: .75em;
margin-right: 0;
}
/* Video */
.wp-block-video video {
width: 100%;
}
/*--------------------------------------------------------------
3.0 Blocks - Formatting
--------------------------------------------------------------*/
/* Verse */
.wp-block-verse {
}
/* Pullquote */
.wp-block-pullquote blockquote {
}
.wp-block-pullquote blockquote p {
}
.wp-block-pullquote cite,
.wp-block-pullquote.alignleft cite,
.wp-block-pullquote.alignright cite {
}
/* Table */
.wp-block-table th {
text-align: left;
}
.rtl .wp-block-table th {
text-align: right;
}
/*--------------------------------------------------------------
4.0 Blocks - Layout Elements
--------------------------------------------------------------*/
/* Buttons */
.wp-block-button .wp-block-button__link:not(.has-text-color) {
}
.wp-block-button .wp-block-button__link:not(.has-background) {
}
.wp-block-button .wp-block-button__link {
}
.wp-block-button__link:hover,
.wp-block-button__link:focus,
.wp-block-button__link:active {
}
/* Separator */
.wp-block-separator {
border: 0;
}
.wp-block-separator:not(.is-style-wide):not(.is-style-dots) {
margin-left: auto;
margin-right: auto;
max-width: 100px;
}
/* Media & Text */
.wp-block-media-text {
margin-bottom: 27px;
}
.wp-block-media-text *:last-child {
margin-bottom: 0;
}
/*--------------------------------------------------------------
5.0 Blocks - Widgets
--------------------------------------------------------------*/
/* Categories, Latest Posts & Archives */
.wp-block-categories.aligncenter,
.wp-block-categories.aligncenter ul,
.wp-block-latest-posts.aligncenter,
.wp-block-archives.aligncenter {
list-style-position: inside;
margin-left: 0;
margin-right: 0;
text-align: center;
}
/* Latest Comments */
.wp-block-latest-comments {
margin-left: 0;
margin-right: 0;
}
.wp-block-latest-comments__comment-date {
color: inherit;
}
/* Latest Posts */
.wp-block-latest-posts.is-grid {
margin-left: 0;
margin-right: 0;
}
/*--------------------------------------------------------------
6.0 Blocks - Colors
--------------------------------------------------------------*/
.has-pale-pink-color,
.has-pale-pink-color:hover,
.has-pale-pink-color:focus,
.has-pale-pink-color:active {
color: #f78da7;
}
.has-pale-pink-background-color,
.has-pale-pink-background-color:hover.
.has-pale-pink-background-color:focus,
.has-pale-pink-background-color:active,
.has-pale-pink-background-color:visited {
background-color: #f78da7;
}

View file

@ -0,0 +1,359 @@
/*
Theme Name: Penscratch 2
Description: Used to style Gutenberg Blocks in the editor.
*/
/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
1.0 General Typography
2.0 General Block Settings
3.0 Blocks - Common Blocks
4.0 Blocks - Formatting
5.0 Blocks - Layout Elements
6.0 Blocks - Widgets
--------------------------------------------------------------*/
/*--------------------------------------------------------------
1.0 General Typography
--------------------------------------------------------------*/
.edit-post-visual-editor .editor-block-list__block,
.editor-default-block-appender input[type="text"].editor-default-block-appender__content {
}
/* Font size */
.edit-post-visual-editor .editor-block-list__block,
.edit-post-visual-editor .editor-block-list__block p,
.editor-default-block-appender input[type="text"].editor-default-block-appender__content {
}
/* Colour */
.edit-post-visual-editor .editor-block-list__block {
}
/* Post title */
.editor-post-title__block .editor-post-title__input {
}
/* Headings */
.edit-post-visual-editor h1,
.wp-block-freeform.block-library-rich-text__tinymce h1,
.edit-post-visual-editor h2,
.wp-block-freeform.block-library-rich-text__tinymce h2,
.edit-post-visual-editor h3,
.wp-block-freeform.block-library-rich-text__tinymce h3,
.edit-post-visual-editor h4,
.wp-block-freeform.block-library-rich-text__tinymce h4,
.edit-post-visual-editor h5,
.wp-block-freeform.block-library-rich-text__tinymce h5,
.edit-post-visual-editor h6,
.wp-block-freeform.block-library-rich-text__tinymce h6 {
}
.edit-post-visual-editor h1,
.wp-block-freeform.block-library-rich-text__tinymce h1 {
}
.edit-post-visual-editor h2,
.wp-block-freeform.block-library-rich-text__tinymce h2 {
}
.edit-post-visual-editor h3,
.wp-block-freeform.block-library-rich-text__tinymce h3 {
}
.edit-post-visual-editor h4,
.wp-block-freeform.block-library-rich-text__tinymce h4 {
}
.edit-post-visual-editor h5,
.wp-block-freeform.block-library-rich-text__tinymce h5 {
}
.edit-post-visual-editor h6,
.wp-block-freeform.block-library-rich-text__tinymce h6 {
}
/*--------------------------------------------------------------
2.0 General Block Settings
--------------------------------------------------------------*/
/* Main content width */
.wp-block {
max-width: 100%; /* 700px + 30px to account for padding */
}
/* Link styles */
.edit-post-visual-editor a,
.editor-block-list__block a,
.wp-block-freeform.block-library-rich-text__tinymce a {
color: #999;
}
/* Table styles */
.wp-block-freeform.block-library-rich-text__tinymce table {
}
.wp-block-freeform.block-library-rich-text__tinymce table,
.wp-block-freeform.block-library-rich-text__tinymce table th,
.wp-block-freeform.block-library-rich-text__tinymce table td {
.wp-block-freeform.block-library-rich-text__tinymce table th,
.wp-block-freeform.block-library-rich-text__tinymce table td {
padding: 0.5em;
}
.rtl .wp-block-freeform.block-library-rich-text__tinymce td,
.rtl .wp-block-freeform.block-library-rich-text__tinymce th {
text-align: right;
}
/* Quote styles */
.wp-block-freeform.block-library-rich-text__tinymce blockquote {
}
.wp-block-freeform.block-library-rich-text__tinymce blockquote cite {
}
/* List styles */
.wp-block-freeform.block-library-rich-text__tinymce li,
.editor-styles-wrapper li {
margin-bottom: 0;
}
/* Code styles */
.wp-block-freeform.block-library-rich-text__tinymce code {
}
/* Caption styles */
[class^="wp-block-"] figcaption {
}
[class^="wp-block-"]:not(.wp-block-gallery) figcaption {
}
/* Definition List styles */
.wp-block-freeform.block-library-rich-text__tinymce dt {
font-weight: bold;
}
/* Pre styles */
.wp-block-freeform.block-library-rich-text__tinymce pre {
}
/*--------------------------------------------------------------
3.0 Blocks - Common Blocks
--------------------------------------------------------------*/
/* Paragraph */
p.has-drop-cap:not(:focus)::first-letter {
font-size: 5em;
margin-top: 0.15em;
}
/* Quote */
.editor-styles-wrapper .wp-block-quote,
.wp-block-quote:not(.is-large):not(.is-style-large) {
}
.wp-block-quote .wp-block-quote__citation {
}
.wp-block-quote.is-large p,
.wp-block-quote.is-style-large p {
}
.wp-block-quote.is-large .wp-block-quote__citation,
.wp-block-quote.is-style-large .wp-block-quote__citation {
}
/* Cover */
.edit-post-visual-editor .editor-block-list__block .wp-block-cover-image .wp-block-cover-image-text,
.edit-post-visual-editor .editor-block-list__block .wp-block-cover-image .wp-block-cover-text,
.edit-post-visual-editor .editor-block-list__block .wp-block-cover-image h2,
.edit-post-visual-editor .editor-block-list__block .wp-block-cover .wp-block-cover-image-text,
.edit-post-visual-editor .editor-block-list__block .wp-block-cover .wp-block-cover-text,
.edit-post-visual-editor .editor-block-list__block .wp-block-cover h2 {
font-size: 1.5em;
}
/* File */
.wp-block-file__textlink {
}
.wp-block-file__textlink:hover,
.wp-block-file__textlink:focus {
}
.editor-styles-wrapper .wp-block-file .mce-content-body.wp-block-file__button {
}
.wp-block-file .wp-block-file__button,
.wp-block-file .wp-block-file__button:visited {
}
.wp-block-file .wp-block-file__button:hover,
.wp-block-file .wp-block-file__button:focus,
.wp-block-file .wp-block-file__button:active {
}
/*--------------------------------------------------------------
4.0 Blocks - Formatting
--------------------------------------------------------------*/
/* Verse */
.wp-block-verse {
}
.wp-block-verse pre {
}
/* Code */
.wp-block-code {
border: none;
border-radius: 0;
}
.wp-block-code textarea {
background: transparent;
}
/* Preformatted */
.wp-block-preformatted {
}
/* Pullquote */
.wp-block-pullquote {
}
.wp-block-pullquote__citation {
}
.wp-block-pullquote.alignleft blockquote > .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before,
.wp-block-pullquote.alignright blockquote > .block-library-pullquote__content .editor-rich-text__tinymce[data-is-empty="true"]::before,
.wp-block-pullquote.alignleft blockquote > .editor-rich-text p,
.wp-block-pullquote.alignright blockquote > .editor-rich-text p {
font-size: 20px;
}
/* Table */
.wp-block-table th,
.wp-block-table td {
}
.wp-block-table th {
text-align: left;
}
.rtl .wp-block-table th {
text-align: right;
}
.wp-block-table__cell-content {
padding: 0.5em;
}
/*--------------------------------------------------------------
5.0 Blocks - Layout Elements
--------------------------------------------------------------*/
/* Buttons */
.wp-block-button .wp-block-button__link {
}
.wp-block-button__link:hover,
.wp-block-button__link:focus,
.wp-block-button__link:active {
}
/* Separator */
.wp-block-separator {
background-color: #ccc;
border: 0;
height: 1px;
}
/*--------------------------------------------------------------
6.0 Blocks - Widgets
--------------------------------------------------------------*/
/* Categories, Latest Posts & Archives */
[data-align="center"] .wp-block-categories ul,
[data-align="center"] .wp-block-latest-posts ul,
[data-align="center"] .wp-block-archives ul {
list-style-position: inside;
}
/* Latest Comments */
.editor-styles-wrapper .wp-block-latest-comments {
padding-left: 0;
padding-right: 0;
}
.wp-block-latest-comments__comment-date {
color: inherit;
}

View file

@ -73,6 +73,9 @@ function penscratch_2_setup() {
'default-color' => 'eeeeee',
'default-image' => '',
) ) );
// Add support for responsive embeds.
add_theme_support( 'responsive-embeds' );
}
endif; // penscratch_2_setup
add_action( 'after_setup_theme', 'penscratch_2_setup' );
@ -146,6 +149,9 @@ function penscratch_2_scripts() {
wp_enqueue_style( 'penscratch-2-style', get_stylesheet_uri() );
wp_enqueue_style( 'penscratch-2-fonts', penscratch_2_fonts_url(), array(), null );
// Theme block stylesheet.
wp_enqueue_style( 'penscratch-2-block-style', get_theme_file_uri( '/css/blocks.css' ), array( 'penscratch-2-style' ), '1.0' );
wp_enqueue_script( 'penscratch-2-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'penscratch-2-scripts', get_template_directory_uri() . '/js/penscratch-2.js', array( 'jquery' ), '20170608', true );
@ -158,6 +164,17 @@ function penscratch_2_scripts() {
}
add_action( 'wp_enqueue_scripts', 'penscratch_2_scripts' );
/**
* Enqueue editor styles for Gutenberg
*/
function penscratch_2_block_editor_styles() {
// Block styles.
wp_enqueue_style( 'penscratch-2-block-editor-style', get_theme_file_uri( '/css/editor-blocks.css' ) );
// Fonts.
wp_enqueue_style( 'penscratch-2-fonts-url', penscratch_2_fonts_url(), array(), null );
}
add_action( 'enqueue_block_editor_assets', 'penscratch_2_block_editor_styles' );
/**
* Register Google Fonts
*/