Skip to content

Commit

Permalink
Merge pull request #103 from pixelgrade/fix/novablocks-integration
Browse files Browse the repository at this point in the history
Fix Nova Blocks integration
  • Loading branch information
razwan authored Apr 14, 2020
2 parents bf6684d + 7e0280c commit 12535c3
Show file tree
Hide file tree
Showing 21 changed files with 376 additions and 479 deletions.
46 changes: 20 additions & 26 deletions assets/scss/blocks/nova-blocks/_frontend.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
@import "style";

.novablocks-media[class],
.novablocks-slideshow[class],
.novablocks-hero[class] {
.block-is-moderate,
.block-is-highlighted,
.novablocks-slideshow,
.novablocks-hero {

& + & {
& + &[class] {
margin-top: 0;
}
}

.block-is-moderate + .block-is-moderate:not(.novablocks-media),
.block-is-highlighted + .block-is-highlighted[class] {
padding-top: 0;
}

.novablocks-announcement-bar {
--novablocks-announcement-color: var(--sm-light-primary);

Expand All @@ -26,29 +32,14 @@
}
}

.novablocks-media {

&.block-is-basic {

& + & {
padding-top: 0;
}
}

& + :not(.novablocks-media) {
margin-top: 0;
}

&.content-is-moderate {
--novablocks-block-content-box-shadow:
0 32px 128px rgba(0, 0, 0, 0.1),
0 16px 64px rgba(0, 0, 0, 0.1),
0 8px 16px rgba(0, 0, 0, 0.1);
}
.content-is-moderate {
--novablocks-block-content-box-shadow:
0 32px 128px rgba(0, 0, 0, 0.1),
0 16px 64px rgba(0, 0, 0, 0.1),
0 8px 16px rgba(0, 0, 0, 0.1);
}

&.novablocks-media--blog {
--novablocks-block-content-box-shadow: none;
}
.novablocks-media {

&.novablocks-media--no-thumbnail {

Expand Down Expand Up @@ -89,6 +80,9 @@
// Nova - Google Map
@import "google-map/style";

// Nova - Header
@import "header/style";

// Nova - Hero
@import "hero/style";

Expand Down
10 changes: 3 additions & 7 deletions assets/scss/blocks/nova-blocks/_style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@at-root {

:root:root {
html:root {
--novablocks-color-1: var(--current-color-primary);
--novablocks-color-2: var(--current-color-secondary);
--novablocks-color-3: var(--current-color-tertiary);
Expand All @@ -15,12 +15,8 @@

--nova-food-menu-item-highlight-color: var(--current-dark-primary);

--novablocks-spacing: var(--theme-spacing-fluid-medium);
--novablocks-media-spacing: var(--novablocks-spacing);
--novablocks-sides-spacings: var(--theme-wrapper-sides-spacing);
}
}

.novablocks-block {
&.novablocks-media {
--novablocks-block-padding: var(--novablocks-spacing);
}
}
11 changes: 11 additions & 0 deletions assets/scss/blocks/nova-blocks/header/_style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@media only screen and (min-width: 1000px) {

.site-header {

ul.menu,
.menu > ul {
display: flex;
flex-wrap: wrap;
}
}
}
65 changes: 24 additions & 41 deletions assets/scss/blocks/nova-blocks/media/_style.scss
Original file line number Diff line number Diff line change
@@ -1,75 +1,58 @@
@at-root {

:root {
--novablocks-spacing: var(--theme-spacing-fluid-medium);
--novablocks-block-content-padding: var(--theme-spacing-fluid-large);
}
// hack to contain negative margin-top of .novablocks-media__layout
.novablocks-media > .wp-block-group__inner-container {
padding-top: 1px;
}

.novablocks-media__content {
max-width: 100%;
@include apply-font(body);

--novablocks-block-content-padding: var(--novablocks-spacing);

&[class] {
flex-basis: calc(50% - var(--novablocks-media-spacing));
}
}

.novablocks-media__aside {

// 0.5px to help Edge resolve the calc
flex-basis: calc(50% + var(--novablocks-media-spacing) - 0.5px);
&[class] {
// 0.5px to help Edge resolve the calc
flex-basis: calc(50% + var(--novablocks-media-spacing) - 0.5px);
}

.novablocks-media:not(.novablocks-media--no-thumbnail) & {
min-height: 15em;
}
}

.novablocks-media__image {
.novablocks-media__image {

svg {
@include image-cover;
object-fit: contain;
}
svg {
@include image-cover;
object-fit: contain;
}
}

.block-is-moderate {
--novablocks-block-background-color: var(--current-light-tertiary);
.novablocks-block__content {

@include above(tablet) {
--novablocks-block-content-padding: var(--novablocks-spacing);
}
}

.novablocks-media--blog[class] {
--novablocks-block-content-box-shadow: none;
--novablocks-block-background-color: var(--current-light-tertiary);

.novablocks-media__content {
margin-bottom: 0;
.novablocks-media__image {
height: 100%;
min-height: 400px;
}

.novablocks-media__aside {
order: 0;
}

&.has-image-on-the-left {
.novablocks-media__layout {
flex-direction: row-reverse;
}
}
}

@include below(tablet) {

.novablocks-media__content {
flex-basis: 100%;
}

.novablocks-block[class][class] {
--novablocks-block-padding: 0;
--novablocks-block-background-color: transparent;
--novablocks-block-content-text-color: var(--current-dark-secondary);
}

.novablocks-block__content {
--novablocks-block-content-padding: 0;
box-shadow: none;
&.has-image-on-the-left .novablocks-media__layout {
flex-direction: row-reverse;
}
}
10 changes: 5 additions & 5 deletions assets/scss/components/_alignment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
.editor-styles-wrapper [data-align=#{$alignment}] [data-block] {

&:not(:first-child) {
margin-top: var(--theme-spacing-small);
margin-top: var(--element-spacing);
}

&:not(:last-child) {
margin-bottom: var(--theme-spacing-small);
margin-bottom: var(--element-spacing);
}
}
}
Expand All @@ -27,7 +27,7 @@
}

%wp-block > .align#{$alignment} {
margin-bottom: var(--theme-spacing-small);
margin-bottom: var(--element-spacing);
}

%wp-block.align#{$alignment},
Expand All @@ -53,14 +53,14 @@
%wp-block > .alignright,
.editor-block-list__block[data-align=right] .editor-block-list__block-edit,
.block-editor-block-list__block[data-align=right] .editor-block-list__block-edit {
margin-left: var(--theme-spacing-small);
margin-left: var(--element-spacing);
}

%wp-block.alignleft,
%wp-block > .alignleft,
.editor-block-list__block[data-align=left] .editor-block-list__block-edit,
.block-editor-block-list__block[data-align=left] .editor-block-list__block-edit {
margin-right: var(--theme-spacing-small);
margin-right: var(--element-spacing);
}

%wp-block.aligncenter,
Expand Down
10 changes: 7 additions & 3 deletions assets/scss/components/_entry-content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@

.entry-content,
.wp-block-column,
[class*="__inner-container"]{
[class*="__inner-container"] {
@include space-children-y( var(--theme-spacing-small) );
}

.wp-block-column > :not(:first-child) {
--element-spacing: var(--theme-spacing);
.wp-block-column,
[class*="__inner-container"] {

> :not(:first-child) {
--element-spacing: var(--theme-spacing);
}
}

.novablocks-cards-collection > .wp-block-group__inner-container {
Expand Down
35 changes: 35 additions & 0 deletions assets/scss/fallbacks/_novablocks-block.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.novablocks-block[class] {
padding: var(--novablocks-block-padding) 0;
color: var(--novablocks-block-text-color);
background-color: var(--novablocks-block-background-color);
}

.novablocks-block__content {
position: relative;

color: var(--novablocks-block-content-text-color);
transform: translateZ(0);

&[class] {
padding: var(--novablocks-block-content-padding);
}

@include above(tablet) {
box-shadow: var(--novablocks-block-content-box-shadow);

&:after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: -1;

display: block;
background-color: var(--novablocks-block-content-background-color);
opacity: var(--novablocks-block-content-background-opacity);
pointer-events: none;
}
}
}
12 changes: 12 additions & 0 deletions assets/scss/fallbacks/_novablocks-emphasis.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.block-is-moderate,
.block-is-highlighted {
--novablocks-block-padding: var(--novablocks-spacing);
}

@include above(tablet) {

.content-is-moderate {
--novablocks-block-content-padding: var(--novablocks-spacing);
--novablocks-block-content-background-color: var(--current-light-primary);
}
}
35 changes: 35 additions & 0 deletions assets/scss/fallbacks/_novablocks-media.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.novablocks-media__image {
position: relative;

img {
@include image-cover;
}
}

.novablocks-media__inner-container {
display: flex;
height: 100%;
flex-direction: column;
justify-content: center;

word-break: break-word;
}

.novablocks-media__layout {
margin-top: calc( -1 * var(--novablocks-media-spacing) );
margin-left: calc( -1 * var(--novablocks-media-spacing) );

> * {
padding-left: var(--novablocks-media-spacing);
margin-top: var(--novablocks-media-spacing);
}

@include above(tablet) {
display: flex;
flex-wrap: wrap;

> * {
flex: 1 0 50%;
}
}
}
Loading

0 comments on commit 12535c3

Please sign in to comment.