Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try/global styles theme #22

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
ca466a8
Bootstrap theme
oandregal Feb 13, 2020
42b216b
Add theme support for global styles
oandregal Feb 13, 2020
1585825
Paragraph, Headings, Lists
oandregal Feb 13, 2020
ea70c17
Accomodate more blocks
oandregal Feb 13, 2020
1ec6935
Add resets
oandregal Feb 14, 2020
c5a80db
Set core & paragraph styles
oandregal Feb 18, 2020
98dd7f8
Add styles for paragraphs in block quotes
oandregal Feb 18, 2020
0447a10
Make the colors more safe for testers
oandregal Feb 18, 2020
f687e77
Add template
oandregal Feb 21, 2020
d977ce2
Update theme.json to settings present in controls PR
oandregal Feb 21, 2020
2c8c6df
Add styles for blocks
oandregal Feb 21, 2020
50aa29a
Add style for button
oandregal Feb 21, 2020
411f27f
Adapt variable names
oandregal Feb 21, 2020
4f757cf
Load styles in edit-sit
oandregal Feb 21, 2020
6376ef2
Decamelize property names
oandregal Feb 21, 2020
c54ec34
Limit to general variables
oandregal Feb 21, 2020
687f6d5
Adapt to resolver variable names
oandregal Feb 24, 2020
45274ee
Add metadata, including text domain
oandregal Feb 25, 2020
4c27a2d
Add comment
oandregal Feb 27, 2020
3d3f4e5
Blockquote: add color
oandregal Feb 27, 2020
e25d39f
Add background color to theme
oandregal Feb 27, 2020
46ffc3d
Make quote use the global variable
oandregal Feb 28, 2020
5083b67
Remove unused variable
oandregal Feb 28, 2020
7805818
Remove auto-generated variables
oandregal Mar 3, 2020
4d0fa8f
Use Gutenberg demo content
oandregal Mar 3, 2020
d694f10
Target selectors and center content
oandregal Mar 3, 2020
a23a24f
Revert "Use Gutenberg demo content"
oandregal Mar 3, 2020
4b5a71e
Add the gutenberg demo content --- not used yet
oandregal Mar 3, 2020
3cc7edb
Remove quote and button from demo
oandregal Mar 27, 2020
d016535
Use new property names
oandregal Mar 27, 2020
ed9c92b
Adapt to editor styles now that edit-site has support
oandregal Mar 27, 2020
440f15f
Theme needs to enqueue styles for the editor
oandregal Mar 30, 2020
147e264
Rename files for clarity
oandregal Mar 30, 2020
ea326c2
Use block-level inline vars if present
oandregal Mar 31, 2020
84d6d4f
Fix styles file name
oandregal Mar 31, 2020
37dcd5b
Fix style file name
oandregal Mar 31, 2020
1268901
Remove unnecessary line-height override
oandregal Mar 31, 2020
507b770
Remove unnecessary overrides
oandregal Mar 31, 2020
731c9d9
Add required header comments to style.css
oandregal Apr 2, 2020
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
225 changes: 225 additions & 0 deletions global-styles/block-templates/gutenberg-demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<!-- wp:heading {"level":1} -->
<h1>Welcome to the Gutenberg Editor</h1>
<!-- /wp:heading -->

<!-- wp:cover {"url":"https://cldup.com/Fz-ASbo2s3.jpg","className":"alignwide"} -->
<div class="wp-block-cover has-background-dim alignwide" style="background-image:url(https://cldup.com/Fz-ASbo2s3.jpg)">
<div class="wp-block-cover__inner-container">
<!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
<p class="has-text-align-center has-large-font-size">Of Mountains &amp; Printing Presses</p>
<!-- /wp:paragraph -->
</div>
</div>
<!-- /wp:cover -->

<!-- wp:paragraph -->
<p>The goal of this new editor is to make adding rich content to WordPress simple and enjoyable. This whole post is
composed of <em>pieces of content</em>—somewhat similar to LEGO bricks—that you can move around and interact with.
Move your cursor around and you’ll notice the different blocks light up with outlines and arrows. Press the arrows
to reposition blocks quickly, without fearing about losing things in the process of copying and pasting.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>What you are reading now is a <strong>text block</strong> the most basic block of all. The text block has its own
controls to be moved freely around the post...</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">... like this one, which is right aligned.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Headings are separate blocks as well, which helps with the outline and organization of your content.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>A Picture is Worth a Thousand Words</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Handling images and media with the utmost care is a primary focus of the new editor. Hopefully, you’ll find aspects
of adding captions or going full-width with your pictures much easier and robust than before.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center"} -->
<div class="wp-block-image">
<figure class="aligncenter"><img src="https://cldup.com/cXyG__fTLN.jpg" alt="Beautiful landscape" />
<figcaption>If your theme supports it, you’ll see the "wide" button on the image toolbar. Give it a try.
</figcaption>
</figure>
</div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Try selecting and removing or editing the caption, now you don’t have to be careful about selecting the image or
other text by mistake and ruining the presentation.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>The <em>Inserter</em> Tool</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Imagine everything that WordPress can do is available to you quickly and in the same place on the interface. No need
to figure out HTML tags, classes, or remember complicated shortcode syntax. That’s the spirit behind the
inserter—the <code>(+)</code> button you’ll see around the editor—which allows you to browse all available content
blocks and add them into your post. Plugins and themes are able to register their own, opening up all sort of
possibilities for rich editing and publishing.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Go give it a try, you may discover things WordPress can already add into your posts that you didn’t know about.
Here’s a short list of what you can currently find there:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul>
<li>Text &amp; Headings</li>
<li>Images &amp; Videos</li>
<li>Galleries</li>
<li>Embeds, like YouTube, Tweets, or other WordPress posts.</li>
<li>Layout blocks, like Buttons, Hero Images, Separators, etc.</li>
<li>And <em>Lists</em> like this one of course :)</li>
</ul>
<!-- /wp:list -->

<!-- wp:separator -->
<hr class="wp-block-separator" />
<!-- /wp:separator -->

<!-- wp:heading -->
<h2>Visual Editing</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>A huge benefit of blocks is that you can edit them in place and manipulate your content directly. Instead of having
fields for editing things like the source of a quote, or the text of a button, you can directly change the content.
Try editing the following quote:</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote">
<p>The editor will endeavor to create a new page and post building experience that makes writing rich posts
effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat”
embed discovery.</p><cite>Matt Mullenweg, 2017</cite>
</blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>The information corresponding to the source of the quote is a separate text field, similar to captions under images,
so the structure of the quote is protected even if you select, modify, or remove the source. It’s always easy to add
it back.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Blocks can be anything you need. For instance, you may want to add a subdued quote as part of the composition of your
text, or you may prefer to display a giant stylized one. All of these options are available in the inserter.</p>
<!-- /wp:paragraph -->

<!-- wp:gallery {"ids":[null,null,null],"columns":2} -->
<figure class="wp-block-gallery columns-2 is-cropped">
<ul class="blocks-gallery-grid">
<li class="blocks-gallery-item">
<figure><img src="https://cldup.com/n0g6ME5VKC.jpg" alt="" /></figure>
</li>
<li class="blocks-gallery-item">
<figure><img src="https://cldup.com/ZjESfxPI3R.jpg" alt="" /></figure>
</li>
<li class="blocks-gallery-item">
<figure><img src="https://cldup.com/EKNF8xD2UM.jpg" alt="" /></figure>
</li>
</ul>
</figure>
<!-- /wp:gallery -->

<!-- wp:paragraph -->
<p>You can change the amount of columns in your galleries by dragging a slider in the block inspector in the sidebar.
</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Media Rich</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you combine the new <strong>wide</strong> and <strong>full-wide</strong> alignments with galleries, you can create
a very media rich layout, very quickly:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"full"} -->
<figure class="wp-block-image alignfull"><img src="https://cldup.com/8lhI-gKnI2.jpg"
alt="Accessibility is important — don’t forget image alt attribute" /></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Sure, the full-wide image can be pretty big. But sometimes the image is worth it.</p>
<!-- /wp:paragraph -->

<!-- wp:gallery {"ids":[null,null],"align":"wide"} -->
<figure class="wp-block-gallery alignwide columns-2 is-cropped">
<ul class="blocks-gallery-grid">
<li class="blocks-gallery-item">
<figure><img src="https://cldup.com/_rSwtEeDGD.jpg" alt="" /></figure>
</li>
<li class="blocks-gallery-item">
<figure><img src="https://cldup.com/L-cC3qX2DN.jpg" alt="" /></figure>
</li>
</ul>
</figure>
<!-- /wp:gallery -->

<!-- wp:paragraph -->
<p>The above is a gallery with just two images. It’s an easier way to create visually appealing layouts, without having
to deal with floats. You can also easily convert the gallery back to individual images again, by using the block
switcher.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Any block can opt into these alignments. The embed block has them also, and is responsive out of the box:</p>
<!-- /wp:paragraph -->

<!-- wp:core-embed/vimeo {"url":"https://vimeo.com/22439234","type":"video","providerNameSlug":"vimeo","align":"wide","className":"wp-has-aspect-ratio wp-embed-aspect-16-9"} -->
<figure
class="wp-block-embed-vimeo alignwide wp-block-embed is-type-video is-provider-vimeo wp-has-aspect-ratio wp-embed-aspect-16-9">
<div class="wp-block-embed__wrapper">
https://vimeo.com/22439234
</div>
</figure>
<!-- /wp:core-embed/vimeo -->

<!-- wp:paragraph -->
<p>You can build any block you like, static or dynamic, decorative or plain. Here’s a pullquote block:</p>
<!-- /wp:paragraph -->

<!-- wp:pullquote -->
<figure class="wp-block-pullquote">
<blockquote>
<p>Code is Poetry</p><cite>The WordPress community</cite>
</blockquote>
</figure>
<!-- /wp:pullquote -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">
<em>
If you want to learn more about how to build additional blocks, or if you are interested in helping with the
project, head over to the <a href="https://github.com/WordPress/gutenberg">GitHub repository</a>. </em>
</p>
<!-- /wp:paragraph -->

<!-- wp:button {"align":"center"} -->
<div class="wp-block-button aligncenter"><a class="wp-block-button__link"
href="https://github.com/WordPress/gutenberg">Help build Gutenberg</a></div>
<!-- /wp:button -->

<!-- wp:separator -->
<hr class="wp-block-separator" />
<!-- /wp:separator -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">Thanks for testing Gutenberg!</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">👋</p>
<!-- /wp:paragraph -->
28 changes: 28 additions & 0 deletions global-styles/block-templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!-- wp:heading {"level":1} -->
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h1>
<!-- /wp:heading -->

<!-- wp:heading {"level":2} -->
<h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h4>
<!-- /wp:heading -->

<!-- wp:heading {"level":5} -->
<h5>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h5>
<!-- /wp:heading -->

<!-- wp:heading {"level":6} -->
<h6>Lorem ipsum dolor sit amet, consectetur adipiscing elit</h6>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Mauris consequat augue quis risus sollicitudin commodo. In hac habitasse platea dictumst. Pellentesque massa sem,
ultrices non tempus ac, aliquet ac nunc. Sed porttitor ac mi a malesuada. Donec blandit vel arcu blandit
scelerisque. Etiam euismod blandit leo a maximus.</p>
<!-- /wp:paragraph -->
55 changes: 55 additions & 0 deletions global-styles/editor-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Theme Name: Global Styles
Text Domain: global-styles
Version: 0.1
Requires at least: 5.3
Description: A test theme using the new WordPress block templating system and Global Styles.
Author: wordpressdotorg
Author URI: https://wordpress.org
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

All files, unless otherwise stated, are released under the GNU General Public
License version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html)

This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned
with others.
*/

/*
* These block styles are meant to be added to the blocks themselves.
* We only have them here to have a safe playground
* while we figure out all the loose ends.
*/

/* HEADING BLOCK ------------------------------------------- */
h1 {
font-size: calc(1px * var(--wp--typography--font-base) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale));
}

h2 {
font-size: calc(1px * var(--wp--typography--font-base) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale));
}

h3 {
font-size: calc(1px * var(--wp--typography--font-base) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale));
}

h4 {
font-size: calc(1px * var(--wp--typography--font-base) * var(--wp--typography--font-scale) * var(--wp--typography--font-scale));
}

h5 {
font-size: calc(1px * var(--wp--typography--font-base) * var(--wp--typography--font-scale));
}

h6 {
font-size: calc(0.5px * var(--wp--typography--font-base) * var(--wp--typography--font-scale));
}


/* PARAGRAPH BLOCK ------------------------------------------- */
p {
font-size: calc(1px * var(--wp--typography--font-base));
}
14 changes: 14 additions & 0 deletions global-styles/experimental-theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"color": {
"background": "#fff",
"text": "#000"
},
"typography": {
"font-base": 16,
"font-scale": 1.2,
"font-weight-base": 400,
"font-weight-heading": 400,
"line-height-base": 1.5,
"line-height-heading": 1.5
}
}
18 changes: 18 additions & 0 deletions global-styles/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

function global_styles_experimental_after_setup_theme() {
add_theme_support('editor-styles');
add_editor_style('style.css');
add_editor_style('editor-styles.css');
}
add_action( 'after_setup_theme', 'global_styles_experimental_after_setup_theme' );

function global_styles_experimental_wp_enqueue_scripts() {
wp_enqueue_style(
'global-styles-theme-style-resets',
get_stylesheet_directory_uri() . '/style.css',
array(),
filemtime( dirname( __FILE__ ) . '/style.css' )
);
}
add_action( 'wp_enqueue_scripts', 'global_styles_experimental_wp_enqueue_scripts' );
3 changes: 3 additions & 0 deletions global-styles/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

// Silence is golden.
20 changes: 20 additions & 0 deletions global-styles/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
Theme Name: Global Styles
Author: the WordPress team
Author URI: https://wordpress.org/
Description: Global Styles, a playground for testing FSE.
Requires at least: WordPress 4.9.6
Version: 0.1
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: global-styles
Tags: one-column, flexible-header, accessibility-ready, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, rtl-language-support, sticky-post, threaded-comments, translation-ready
*/

body {
box-sizing: border-box;
background-color: var(--wp--color--background);
max-width: 50rem;
margin-left: auto;
margin-right: auto;
}