Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Add Inner Block Rendering and Atomic Block Styles #2607

Merged
merged 38 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e089b74
Register Atomic Blocks and save some block content
mikejolley May 29, 2020
0b6839a
renderInnerBlocks utility
mikejolley May 29, 2020
aef45cd
Frontend Rendering
mikejolley Jun 1, 2020
05504c1
Clean up atomic block classnames
mikejolley Jun 1, 2020
c6b37d8
Move shared styles
mikejolley Jun 1, 2020
ed3dd98
Create a hoc for attribute mapping
mikejolley Jun 1, 2020
ad64572
Rename some unpluralised class names
mikejolley Jun 2, 2020
207aaea
Remove prefixes from atomic component class names
mikejolley Jun 2, 2020
bc7dd82
Updated styles
mikejolley Jun 2, 2020
2707c00
Update styles from master
mikejolley Jun 2, 2020
8d4a670
Revert product list styles
mikejolley Jun 2, 2020
2bbb70a
2020 fixes
mikejolley Jun 2, 2020
43a0b7f
Separate renderFrontend from renderInnerBlocks
mikejolley Jun 3, 2020
4dbef83
Lazy loading of components
mikejolley Jun 3, 2020
c4af97c
Tweak loading classes
mikejolley Jun 3, 2020
f0cd7aa
FIx all products loading state
mikejolley Jun 3, 2020
5d3490f
Revert lazy implementation - creates too many unneccessary files due …
mikejolley Jun 3, 2020
3431ff0
Cleanup
mikejolley Jun 3, 2020
161c062
Remove wcBlocksBuildUrl
mikejolley Jun 3, 2020
7296da4
Move call to register_atomic_blocks
mikejolley Jun 3, 2020
f8fcca7
Remove duplicate key
mikejolley Jun 3, 2020
ce2478f
reuse render frontend
mikejolley Jun 3, 2020
d968649
Corectly handle frontend attribute mapping to keep editor working
mikejolley Jun 4, 2020
e80fd34
Style updates
mikejolley Jun 4, 2020
04a1403
Update side effects
mikejolley Jun 4, 2020
2e4df86
Remove width style from rating to fix alignment
mikejolley Jun 4, 2020
28afde6
Move ssr grid styles to main stylesheet
mikejolley Jun 4, 2020
6aa10cc
Put back prefixed classnames
mikejolley Jun 4, 2020
6f0c974
2020 styling fixes
mikejolley Jun 4, 2020
ce6cac9
Create frontend files instead of doing it all in block map
mikejolley Jun 4, 2020
b446428
Update assets/js/atomic/utils/get-block-map.js
mikejolley Jun 4, 2020
061ab48
Update assets/js/atomic/utils/render-parent-block.js
mikejolley Jun 4, 2020
f42eb6a
Fix last child alignment regardless of block type
mikejolley Jun 4, 2020
fe49bde
More specificity fixes
mikejolley Jun 4, 2020
aa3ca0d
2020 button alignment
mikejolley Jun 4, 2020
3edb6a7
static fix to prevent offsets
mikejolley Jun 4, 2020
ecaef9f
fix placeholder image in firefox
mikejolley Jun 4, 2020
8383733
Issues reported in feedback
mikejolley Jun 5, 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
279 changes: 279 additions & 0 deletions assets/css/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,282 @@
.wc-block-link-button {
@include link-button();
}

// These styles are for the server side rendered product grid blocks.
.wc-block-grid__products .wc-block-grid__product-image {
text-decoration: none;
display: block;
position: relative;

a {
text-decoration: none;
border: 0;
outline: 0;
box-shadow: none;
}

img {
width: 100%;

&[hidden] {
display: none;
}
}
}
.edit-post-visual-editor .editor-block-list__block .wc-block-grid__product-title,
.editor-styles-wrapper .wc-block-grid__product-title,
.wc-block-grid__product-title {
font-family: inherit;
line-height: 1.2em;
font-weight: 700;
padding: 0;
color: inherit;
font-size: inherit;
display: block;
}
.wc-block-grid__product-price {
display: block;

.wc-block-grid__product-price__regular {
margin-right: 0.5em;
}
}
.wc-block-grid__product-add-to-cart {
word-break: break-word;
white-space: normal;
a,
button {
word-break: break-word;
white-space: normal;
margin: 0 auto !important;
display: inline-flex;
justify-content: center;

&.loading {
opacity: 0.25;
}

&::after {
margin-left: 0.5em;
display: inline-block;
}

&.added::after {
font-family: WooCommerce; /* stylelint-disable-line */
content: "\e017";
}

&.loading::after {
font-family: WooCommerce; /* stylelint-disable-line */
content: "\e031";
animation: spin 2s linear infinite;
}
}
}
.wc-block-grid__product-rating {
display: block;

.wc-block-grid__product-rating__stars,
.star-rating {
overflow: hidden;
position: relative;
width: 5.3em;
height: 1.618em;
line-height: 1.618;
font-size: 1em;
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
font-family: star;
font-weight: 400;
margin: 0 auto;
text-align: left;

&::before {
content: "\53\53\53\53\53";
top: 0;
left: 0;
right: 0;
position: absolute;
opacity: 0.5;
color: #aaa;
white-space: nowrap;
}
span {
overflow: hidden;
top: 0;
left: 0;
right: 0;
position: absolute;
padding-top: 1.5em;
}
span::before {
content: "\53\53\53\53\53";
top: 0;
left: 0;
right: 0;
position: absolute;
color: #000;
white-space: nowrap;
}
}
}
.wc-block-grid__product-onsale {
@include font-size(small);
padding: em($gap-smallest) em($gap-small);
display: inline-block;
width: auto;
border: 1px solid #43454b;
border-radius: 3px;
color: #43454b;
background: #fff;
text-align: center;
text-transform: uppercase;
font-weight: 600;
z-index: 9;
position: relative;
}

// Element spacing.
.wc-block-grid__product {
.wc-block-grid__product-image,
.wc-block-grid__product-title {
margin: 0 0 $gap-small;
}
// If centered when toggling alignment on, use auto margins to prevent flexbox stretching it.
.wc-block-grid__product-price,
.wc-block-grid__product-rating,
.wc-block-grid__product-add-to-cart,
.wc-block-grid__product-onsale {
margin: 0 auto $gap-small;
}
}

.theme-twentysixteen {
.wc-block-grid {
// Prevent white theme styles.
.price ins {
color: #77a464;
}
}
}

.theme-twentynineteen {
.wc-block-grid__product {
font-size: 0.88889em;
}
// Change the title font to match headings.
.wc-block-grid__product-title,
.wc-block-grid__product-onsale,
.wc-block-components-product-title,
.wc-block-components-product-sale-badge {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}
.wc-block-grid__product-title::before {
display: none;
}
.wc-block-grid__product-onsale,
.wc-block-components-product-sale-badge {
line-height: 1;
}
}

.theme-twentytwenty {
$twentytwenty-headings: -apple-system, blinkmacsystemfont, "Helvetica Neue", helvetica, sans-serif;
$twentytwenty-highlights-color: #cd2653;

.wc-block-grid__product-link {
color: #000;
}

.wc-block-grid__product-title,
.wc-block-components-product-title {
font-family: $twentytwenty-headings;
color: #000;
font-size: 1.2em;
}

.wp-block-columns .wc-block-components-product-title {
margin-top: 0;
}

.wc-block-grid__product-price,
.wc-block-components-product-price {
&__value,
.woocommerce-Price-amount {
font-family: $twentytwenty-headings;
font-size: 0.9em;
}

del {
opacity: 0.5;
}

ins {
text-decoration: none;
}
}

.wc-block-grid__product-rating,
.star-rating {
font-size: 0.7em;

.wc-block-grid__product-rating__stars,
.wc-block-components-product-rating__stars {
line-height: 1;
}
}

.wc-block-grid__product-add-to-cart > .wp-block-button__link,
.wc-block-components-product-button > .wp-block-button__link {
font-family: $twentytwenty-headings;
}

.wc-block-grid__products .wc-block-grid__product-onsale,
.wc-block-layout .wc-block-components-product-sale-badge {
background: $twentytwenty-highlights-color;
color: #fff;
font-family: $twentytwenty-headings;
font-weight: 700;
letter-spacing: -0.02em;
line-height: 1.2;
text-transform: uppercase;
}

// These styles are not applied to the All Products atomic block, so it can be positioned normally.
.wc-block-grid__products .wc-block-grid__product-onsale {
position: absolute;
right: 4px;
top: 4px;
z-index: 1;
}

// Override style from WC Core that set its position to absolute.
// These rulesets can be removed once https://github.com/woocommerce/woocommerce/pull/26516 is released.
.wc-block-grid__products .wc-block-components-product-sale-badge {
position: static;
}
.wc-block-grid__products .wc-block-grid__product-image .wc-block-components-product-sale-badge {
position: absolute;
}

// These styles are not applied to the All Products atomic block, so it can be positioned normally.
.wc-block-grid__products .wc-block-grid__product-onsale:not(.wc-block-components-product-sale-badge) {
position: absolute;
right: 4px;
top: 4px;
z-index: 1;
}

@media only screen and (min-width: 768px) {
.wc-block-grid__products .wc-block-grid__product-onsale {
@include font-size(small);
padding: em($gap-smaller);
}
}

@media only screen and (min-width: 1168px) {
.wc-block-grid__products .wc-block-grid__product-onsale {
@include font-size(small);
padding: em($gap-smaller);
}
}
}
7 changes: 0 additions & 7 deletions assets/js/atomic/blocks/product/block-components.js

This file was deleted.

Loading