Skip to content

Commit

Permalink
Merge pull request #121 from studiopress/gutenberg-module
Browse files Browse the repository at this point in the history
Extract Gutenberg functionality
  • Loading branch information
mattlawck authored Oct 24, 2018
2 parents 6368ba3 + 9a548c8 commit 28627ba
Show file tree
Hide file tree
Showing 6 changed files with 434 additions and 414 deletions.
78 changes: 7 additions & 71 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
// Starts the engine.
require_once get_template_directory() . '/lib/init.php';

// Defines the child theme (do not remove).
define( 'CHILD_THEME_NAME', 'Genesis Sample' );
define( 'CHILD_THEME_URL', 'https://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.7.0' );

// Sets up the Theme.
require_once get_stylesheet_directory() . '/lib/theme-defaults.php';

Expand Down Expand Up @@ -46,10 +51,8 @@ function genesis_sample_localization_setup() {
// Adds the Genesis Connect WooCommerce notice.
require_once get_stylesheet_directory() . '/lib/woocommerce/woocommerce-notice.php';

// Defines the child theme (do not remove).
define( 'CHILD_THEME_NAME', 'Genesis Sample' );
define( 'CHILD_THEME_URL', 'https://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.7.0' );
// Adds Gutenberg support.
require_once get_stylesheet_directory() . '/lib/gutenberg/init.php';

add_action( 'wp_enqueue_scripts', 'genesis_sample_enqueue_scripts_styles' );
/**
Expand Down Expand Up @@ -178,73 +181,6 @@ function genesis_sample_content_width() {
// Adds image sizes.
add_image_size( 'sidebar-featured', 75, 75, true );

add_action( 'enqueue_block_editor_assets', 'genesis_sample_block_editor_styles' );
/**
* Enqueues block editor style.
*/
function genesis_sample_block_editor_styles() {

wp_enqueue_style( 'genesis-sample-block-editor-fonts', '//fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,700', array(), CHILD_THEME_VERSION );
wp_enqueue_style( 'genesis-sample-block-editor-styles', get_theme_file_uri( '/style-editor.css' ), false, '1.0', 'all' );

}

// Adds support for block alignments.
add_theme_support( 'align-wide' );

// Adds support for editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'small', 'genesis-sample' ),
'shortName' => __( 'S', 'genesis-sample' ),
'size' => 12,
'slug' => 'small',
),
array(
'name' => __( 'regular', 'genesis-sample' ),
'shortName' => __( 'M', 'genesis-sample' ),
'size' => 16,
'slug' => 'regular',
),
array(
'name' => __( 'large', 'genesis-sample' ),
'shortName' => __( 'L', 'genesis-sample' ),
'size' => 20,
'slug' => 'large',
),
array(
'name' => __( 'larger', 'genesis-sample' ),
'shortName' => __( 'XL', 'genesis-sample' ),
'size' => 24,
'slug' => 'larger',
),
)
);

// Adds support for editor color palette.
add_theme_support(
'editor-color-palette',
array(
array(
'name' => __( 'Light gray', 'genesis-sample' ),
'slug' => 'light-gray',
'color' => '#f5f5f5',
),
array(
'name' => __( 'Medium gray', 'genesis-sample' ),
'slug' => 'medium-gray',
'color' => '#999',
),
array(
'name' => __( 'Dark gray', 'genesis-sample' ),
'slug' => 'dark-gray',
'color' => '#333',
),
)
);

// Adds support for after entry widget.
add_theme_support( 'genesis-after-entry-widget-area' );

Expand Down
216 changes: 216 additions & 0 deletions lib/gutenberg/front-end.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
/* Font Sizes
--------------------------------------------- */

.entry-content p.has-small-font-size{
font-size: 12px;
}

.entry-content p.has-regular-font-size{
font-size: 16px;
}

.entry-content p.has-large-font-size{
font-size: 20px;
}

.entry-content p.has-larger-font-size{
font-size: 24px;
}

/* Color Palette
--------------------------------------------- */

.entry-content .has-light-gray-background-color {
background-color: #f5f5f5;
}

.entry-content .has-light-gray-color {
color: #f5f5f5;
}

.entry-content .has-medium-gray-background-color {
background-color: #999;
}

.entry-content .has-medium-gray-color {
color: #999;
}

.entry-content .has-dark-gray-background-color {
background-color: #333;
}

.entry-content .has-dark-gray-color {
color: #333;
}

/* Background Color
--------------------------------------------- */

.entry-content p.has-background {
padding: 25px 30px;
}

.entry-content p.has-background.box-shadow {
box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.entry-content p.has-background.light-text a {
color: #fff;
text-decoration: underline;
}

.entry-content p.has-background.light-text a:focus,
.entry-content p.has-background.light-text a:hover {
text-decoration: none;
}

/* Alignment
--------------------------------------------- */

.wp-block-button.alignleft,
.wp-block-cover-image.alignleft {
margin-right: 2em;
}

.wp-block-button.alignright,
.wp-block-cover-image.alignright {
margin-left: 2em;
}

.wp-block-image.alignwide,
.wp-block-image.alignfull,
.wp-block-embed.alignwide,
.wp-block-embed.alignfull {
margin-bottom: 30px;
}

.full-width-content .entry-content .alignfull {
margin-left: calc( -100vw / 2 + 100% / 2 );
margin-right: calc( -100vw / 2 + 100% / 2 );
max-width: 100vw;
}

/* Columns
--------------------------------------------- */

.entry-content .wp-block-columns {
display: block;
margin-bottom: 30px;
}

.entry-content .wp-block-columns .wp-block-column {
margin-left: 15px;
margin-right: 15px;
}

.entry-content .wp-block-columns .wp-block-column:first-of-type {
margin-left: 0;
}

.entry-content .wp-block-columns .wp-block-column:last-of-type {
margin-right: 0;
}

/* Cover Image
--------------------------------------------- */

.full-width-content .entry-content .wp-block-cover-image.alignfull {
width: 100vw;
}

.entry-content .wp-block-cover-image .wp-block-cover-image-text {
font-size: 48px;
}

/* Buttons
--------------------------------------------- */

.content .wp-block-button .wp-block-button__link {
background-color: #333;
border: 0;
border-radius: 0;
color: #fff;
cursor: pointer;
font-size: 16px;
font-weight: 600;
padding: 15px 30px;
text-align: center;
text-decoration: none;
white-space: normal;
width: auto;
}

.content .wp-block-button .wp-block-button__link:focus,
.content .wp-block-button .wp-block-button__link:hover {
background-color: #0073e5;
color: #fff;
}

/* Other Blocks
---------------------------------------------------------------------------------------------------- */

.wp-block-preformatted {
white-space: pre-wrap;
}

hr.wp-block-separator {
border: none;
border-top: 1px solid #eee;
margin: 1.65em auto;
}

.wp-block-separator:not(.is-style-wide):not(.is-style-dots) {
max-width: 100px
}

.wp-block-audio audio {
display: inline-block;
width: 100%;
}

.entry-content .wp-block-gallery {
padding-left: 0;
}

.entry-content .wp-block-quote cite {
color: #666;
display: block;
font-size: 14px;
margin-top: -25px;
}

.entry-content .wp-block-image figcaption {
color: #666;
font-size: 14px;
font-style: italic;
margin-bottom: 30px;
margin-top: 10px;
}

/* Media Queries
--------------------------------------------- */

@media only screen and (min-width: 510px) {

.entry-content .wp-block-columns {
display: flex;
}

.entry-content .wp-block-columns .wp-block-column {
flex: 1;
margin-left: 15px;
margin-right: 15px;
}

}

@media only screen and (min-width: 1062px) {

.full-width-content .entry-content .alignwide {
margin-left: -180px;
margin-right: -180px;
min-width: 1062px;
}

}
Loading

0 comments on commit 28627ba

Please sign in to comment.