Skip to content

Commit

Permalink
Release 1.11.0 (#318)
Browse files Browse the repository at this point in the history
* Add additional classes on Card to close #275

* Extend Posts Collection with Carousel support (#290)

* Init #289

* Improvements on desktop and mobiles for carousel

* Change arrow position and variable style on mobiles

* Use columns instead of slides per row

* Improve styling on mobiles

* Show only next slide on mobiles

* Remove spacing for dots

* Remove padding left right for carousel 1 column

* Fix for slider overflowig inside the editor

* Fix missing padding on mobiles

* DRY with slick settings

* Add carousel variation for Posts Collection

* Improve variation name

* New conversation message when conversation ends see #296

* Adjust spacing for comments closed

* Small adjustments to spacing see #296

* Consider border height for spacing top

* Revert

* Init

* Minor improvements for grid on mobiles

* Add icons

* Remove markup when there is no content

* Add grid to entry-content when layout is on page

* Adjust content start and end variables

* Improve comments for CSS grid

* Fix specificity problem and improve group block position

* Add contente center column

* Some tweaks for editor styling

* overall improvements for layout block on frontend and editor

* Code cleanup and refactoring

* Change block mark-up and improve default behaviour

* Change on some controls and improve css specificity

* Update block name

* Replace layout with sidecar and simplify block settings see #303

* More refactoring for new block name and fix complex layout

* Fix sticky block

* Adjustments to how we check overlapping blocks

* Cleanup in breaking alignemnts

* Performance improvements on mobile

* Apply break classes only if sidebar existy

* Do not add break classes on ignored blocks

* Improve comments

* Minor copy improvement

* Align grid items at start

* Improve item overlapping logic on complex layout

* Change the way we handle sidecars without sidebar content

* Rename breaking classes

* Improve variables names

* Minor changes to sidecar -wd variable when there is no content in sidebar

* More comments to help future me

* Fix pull left and right in breaking blocks

* Add new lines to ws and we plus new comments for this scenarior

* New way to align grid items

* Apply new alignment options

* A lot of improvements for Sidecar new logic

* Apply correct formula to wide width

* More cleanup

* Some cleanup inside the editor

* Use debounce when checking breaking blocks

* Fix error

* Minor

* Better checcking

* Remove wrong logic for removing nocolissionclass

* Major improvs for JS

* Improve pull items on mobile

* Changes for editor

* Updated outlines for Sidecar block

* Progress on editor

* Improvements for editor

* Minor

* Improve alignments inside articles

* Use rem for gap size

* Rename large to medium

* Consider grid gap on content width

* Cleanup and some comments

* More cleanup

* Consider gap on minimum sidebar width

* Come back to old functionality of grid

* Cancel resizable component for images inside editor

* Remove console.log

* Some details plus remove some garbage

* More cleanup

* Fix z-index on frontend

* More z-index fixes inside the editor

* Better offset width values

* Change default to medium sidebars

* Overall improvements for block alignments

* Apply new rules for alignments

* Use has-sidebar class

* Consider sidebar and side spacings when we do the math

* Fix sidebar sizing in editor

* Fix specitificity issue

* Unify font size multiplier

* Fix z-index

* Improve sidebar size logic

* Fix typo

* Remove sticky block inside editor

* Add margin on sidebar on mobile

* Remove unused z-index

* Remove font size modifier on group inside collection

* More improvements to comments

* Minor fix for alignments

* Comment sidecar in sidecar for the moment

* Make sure every block is 100% width inside sidecar

* Apply 100% on all blocks inside novablocks-content

* Fix width

* Do not apply offset when we have has-sidebar

* Minor

* Minor

* Remove two sidebar template and add new block appender

* Adjustments to offset

* Increase default grid-gap

* Collection title should be 100% inside the editor

* Use new container width var

* Minor

* Remove gap after we removed sidebar columns

* Revert Slideshow block commit

* Some cleanup and code formatting

* First attempt to simplify code

* More simplification to for overlapping logic

* Replace Customify option name

* Extend Header Block on Articles (#305)

* Add new features to sticky header on articles

* Apply next and reading header on Simple header layout

* Minor changes to header block

* Improve header overflow on reading

* Improve PHP markup to use underscore pattern

* Fix header overflow on header with one row

* Update package-lock

* Bump version to 1.11.0

* Update comments

* Minor

* Remove opentable z-index

* Set default display mode to block

* Show reading  bar only on posts

* Remove and fix comment line

* Add helper for sticky option in Sidecar

* Fix comment number

* Sidebar left class as const

* Rename align_classes with class

* Use const when overwriting is not needed

* Do not init sticky row on every scroll

* Remove code that will be available in the next release

* Move block limits in block content alignments

* Move some header function in extras

* Move sidecar area preview inside blockedit

* Remove alignments for complex layout

* Remove is selected on Group inside controls

* Remove redundant Fragment

* Improve header php functions

* Minor

* Recalculate overlapped block inside overlappinglbocks loop

* Show reading header only on articles

* Remove garbage function

* Update readme.txt

* Hide sticky blocks when overlapping other blocks (#317)

* Hide sticky blocks when overlapping other blocks

* Minor

Co-authored-by: madalingorbanescu <[email protected]>

Co-authored-by: Madalin Gorbanescu <[email protected]>
Co-authored-by: George Olaru <[email protected]>
Co-authored-by: Razvan Onofrei <[email protected]>

Co-authored-by: Madalin Gorbanescu <[email protected]>
Co-authored-by: George Olaru <[email protected]>
Co-authored-by: Razvan Onofrei <[email protected]>
  • Loading branch information
4 people authored Jun 4, 2021
1 parent 0981c74 commit 19ef207
Show file tree
Hide file tree
Showing 37 changed files with 33,779 additions and 67,368 deletions.
2 changes: 1 addition & 1 deletion nova-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Nova Blocks
* Plugin URI: https://github.com/pixelgrade/nova-blocks/
* Description: Nova Blocks is a collection of <strong>distinctive Gutenberg blocks</strong>, committed to making your site shine like a newborn star. It is taking a design-driven approach to help you made the right decisions and showcase your content in the best shape.
* Version: 1.10.0
* Version: 1.11.0
* Author: Pixelgrade
* Author URI: https://www.pixelgrade.com
* Text Domain: __plugin_txtd
Expand Down
98,528 changes: 31,301 additions & 67,227 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nova-blocks",
"version": "1.10.0",
"version": "1.11.0",
"main": "blocks/index.js",
"license": "GPL-3.0+",
"engines": {
Expand All @@ -26,8 +26,7 @@
"@novablocks/doppler": "file:packages/doppler",
"@novablocks/easings": "file:packages/easings",
"@novablocks/icons": "file:packages/icons",
"@novablocks/utils": "file:packages/utils",
"node-gyp": "^3.8.0"
"@novablocks/utils": "file:packages/utils"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.12.13",
Expand Down Expand Up @@ -55,7 +54,7 @@
"node-watch": "^0.7.1",
"os": "^0.1.1",
"path": "^0.12.7",
"postcss": "^8.2.10",
"postcss": "^8.2.5",
"rimraf": "^3.0.2",
"rtlcss": "^3.1.2",
"svg-sprite-loader": "^5.2.1",
Expand Down
1 change: 1 addition & 0 deletions packages/base-styles/mixins/_media-queries.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $nova-breakpoints: (
tablet: 768px,
lap: 1024px,
desktop: 1366px,
ultra: 1800px
);

@mixin above($value) {
Expand Down
4 changes: 1 addition & 3 deletions packages/block-editor/src/components/notice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ const Notice = ( props ) => {

if ( hidden ) {
return null;
};

console.log(dismissLabel);
}

return (
<div className={ 'novablocks-notice' }>
Expand Down
147 changes: 147 additions & 0 deletions packages/block-library/src/blocks/header/extras.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?php

if ( ! function_exists('get_header_row_block' ) ) {

/**
* Get the Header Row based on attributes.
*
* @return array
*/

function get_header_row_block( $row_type, $row_type_value ) {

$post = get_block_area_post( 'header' );

$block = [];

if ( ! empty( $post->post_content ) && has_blocks( $post->post_content ) ) {

// Get all blocks inside Block Area;
$header_block = ( parse_blocks( $post->post_content ) )[0];

// Get InnerBlocks
$inner_blocks = $header_block['innerBlocks'];

foreach ( $inner_blocks as $inner_block ) {

// Select InnerBlock which match Sticky Row attribute.
if ( $inner_block['attrs'][$row_type] === $row_type_value ) {
$block = $inner_block;
}
}
}

return $block;
}
}

if ( ! function_exists('header_block_updated') ) {

/**
* Check if Header Blocks is using Header Rows.
*
* @return boolean
*/

function header_block_updated() {

$post = get_block_area_post( 'header' );

if ( ! empty( $post->post_content ) && has_blocks( $post->post_content ) ) {

if ( has_block( 'novablocks/header-row', $post ) ) {
return true;
}
}

return false;
}
}

if ( ! function_exists('get_block_area_post') ) {

/**
* Helper function to get Block Area Post.
*
* @param string $slug
*
* @return object;
*/

function get_block_area_post( $slug ) {

$block_area = get_posts( array(
'name' => $slug,
'post_type' => 'block_area',
'post_status' => 'publish',
'numberposts' => 1,
'fields' => 'ids',
) );

// Header Block Area ID.
$block_area_id = $block_area[0];

// Header Block Area Post.
$post = get_post( $block_area_id );

return $post;
}
}

if ( ! function_exists('get_reading_bar_markup') ) {

/**
* Render Reading Bar and Reading Progress
*/

function get_reading_bar_markup() {

// We want to show Reading Bar
// only on Posts.
if ( ! is_singular('post') ) {
return;
}

?>
<!--Reading Bar-->
<div class="c-reading-bar js-reading-bar u-header-sides-spacing">

<!--Menu Button-->
<div class="c-reading-bar__wrapper-menu-trigger">
<?php if ( has_nav_menu( 'primary' ) ) { ?>
<div class="wp-block-buttons">
<div class="wp-block-button">
<a class="wp-block-button__link c-reading-bar__menu-trigger js-sticky-menu-trigger">
<span class="novablocks-menu__button-label"><?php esc_html_e( 'Menu', '__theme_txtd' ); ?></span>
</a>
</div>
</div>
<?php } ?>
</div>

<!--Reading/Next Article-->
<?php
$next_post = get_next_post();
if ( ! empty( $next_post ) && ! is_wp_error( $next_post ) ): ?>
<div class="c-reading-bar__wrapper-title c-reading-bar__wrapper-title--next">
<label class="post-title__label"><?php esc_html_e( 'Next:', '__theme_txtd' ); ?></label>
<a class="post-title__post-name" href="<?php the_permalink( $next_post ); ?>">
<?php echo get_the_title( $next_post ); ?>
</a>
</div><!-- .c-reading-bar__wrapper-title -->
<?php endif; ?>
<div class="c-reading-bar__wrapper-title c-reading-bar__wrapper-title--current">
<label class="post-title__label"><?php esc_html_e( 'Reading:', '__theme_txtd' ); ?></label>
<?php the_title( '<span class="post-title__post-name">', '</span>' ); ?>
</div><!-- .c-reading-bar__wrapper-title -->

<!--Share Button-->
<div class="c-reading-bar__wrapper-social">
<?php echo do_blocks( '<!-- wp:novablocks/sharing-overlay {"buttonLabel":"Share"} --><!-- /wp:novablocks/sharing-overlay -->' ); ?>
</div><!-- .c-reading-bar__wrapper-social -->
</div><!-- .c-reading-bar -->

<!--Reading Progress Bar-->
<progress class="c-reading-progress js-reading-progress"></progress>
<?php }
}
131 changes: 122 additions & 9 deletions packages/block-library/src/blocks/header/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,29 @@ import { addSocialMenuClass } from "./utils";
function( $, window, undefined ) {

const $siteHeader = $( '.site-header--main' ),
$stickyHeader = $( '.site-header--secondary' );
$stickyHeader = $( '.site-header--secondary' ),
$stickyMenuTrigger = $( '.js-sticky-menu-trigger' ),
currentHeader = $stickyHeader.length ? $stickyHeader : $siteHeader,
mainHeaderShouldBeSticky = $('.site-header--main[data-sticky]').length && ! $stickyHeader.length,
wpAdminBar = $('#wpadminbar'),
wpAdminBarHeight = ! wpAdminBar.length ? '0' : wpAdminBar.outerHeight(),
isArticle = $('body').hasClass('single-post'),
$progressBar = $( '.js-reading-progress' ),
$promoBar = $('.js-promo-bar');

let $stickyRow = $('.site-header--main .site-header__row[data-sticky=true]'),
stickyHeaderShown = false,
primaryRowShown = false,
mainHeaderShouldBeSticky = $('.site-header--main[data-sticky]').length && ! $stickyHeader.length,
wpAdminBar = $('#wpadminbar'),
wpAdminBarHeight = ! wpAdminBar.length ? '0' : wpAdminBar.outerHeight();
let stickyHeaderShown = false,
primaryRowShown = false,
$stickyRow = isArticle ? $('.site-header__row--primary') : $('.site-header--main .site-header__row[data-sticky=true]'),
$elementWithOverflow = currentHeader;

$( window ).on( 'scroll', showStickyHeaderOnScroll );
$( window ).on( 'scroll', makeHeaderStickyOnScroll );
$stickyMenuTrigger.on('click', onClickStickyMenu );

$(document).ready(function($) {
progressBarInit();
readingHeaderInit();
})

// This function will add .social-menu-item class
// on menu-items if it's needed.
Expand All @@ -37,8 +49,7 @@ import { addSocialMenuClass } from "./utils";
let stickyRowOffSet = $stickyRow.offset().top,
windowScrollY = window.scrollY,
primaryRowIsVisible = windowScrollY > $siteHeader.outerHeight(),
isSticky = windowScrollY > stickyRowOffSet - wpAdminBarHeight,
$promoBar = $('.js-promo-bar');
isSticky = windowScrollY > stickyRowOffSet - wpAdminBarHeight;

// If we find any promo bar,
// we should consider it's height for the offset.
Expand Down Expand Up @@ -77,5 +88,107 @@ import { addSocialMenuClass } from "./utils";
stickyHeaderShown = mainHeaderIsSticky;
}
}

// Init Reading Progress Bar
function progressBarInit() {

let $entryContent = $( '.entry-content' ),
max = 0;

if ( ! isArticle ) {
return;
}

$( window ).on( 'scroll', function() {

let scrollPosition = $( window ).scrollTop(),
startPosition = $entryContent.offset().top;

if ( scrollPosition > startPosition ) {
max = $entryContent.outerHeight() - $entryContent.offset().top;
$progressBar.attr( 'max', max ).css( 'opacity', 0 );
$progressBar.css( 'opacity', 0.95 ).attr( 'value', scrollPosition - startPosition );
} else {
$progressBar.attr( 'value', 0 );
}
} )
}

// Handle Articles Header on Scroll
// Show Current or Next Article
// based on scroll position.
function readingHeaderInit() {
let $window = $( window ),
$title = $('.entry-title');

if ( below('lap') || ! isArticle ) {
return;
}

let titleOffset = $title.offset().top,
titleHeight = $title.outerHeight(),
doc = document.documentElement,
lastScroll = 0,
latestScroll = 0,
scrollDirection = 'up',
$content = $( '.entry-content' ),
contentOffset = $content.offset().top,
contentHeight = $content.outerHeight(),
windowHeight = $window.height(),
offSet = 0,
scrollTop = 0,
reading = false,
next = false;

function handleArticleScrolling() {
latestScroll = ( window.pageYOffset || doc.scrollTop ) - ( doc.clientTop || 0 );
scrollDirection = latestScroll > lastScroll ? 'down' : 'up';
lastScroll = latestScroll;

offSet = 20;
scrollTop = $( this ).scrollTop();
requestAnimationFrame( update );
}

$window.on( 'scroll', handleArticleScrolling );

function update() {
reading = false;
next = false;

if ( scrollDirection !== 'up' && latestScroll > titleOffset + titleHeight ) {
if ( latestScroll <= contentOffset + contentHeight - windowHeight ) {
reading = true;
} else {
next = true;
}
}

if ( reading || next ) {

if (currentHeader.hasClass('site-header--main')) {
$elementWithOverflow = currentHeader.find('.site-header__wrapper');
}

$elementWithOverflow.css('overflow', 'hidden');
} else {
setTimeout( () => {
$elementWithOverflow.css( 'overflow', '' );
}, 350 );
}

// Toggle Class to show Next Article
currentHeader.toggleClass( 'site-header--next', next );

// Toggle Class to show Current Article
currentHeader.toggleClass( 'site-header--reading', reading );
}
}

// Helper function to hide Reading/Next
// and show default header.
function onClickStickyMenu() {
currentHeader.removeClass('site-header--reading site-header--next');
}
}
)( jQuery, window );
Loading

0 comments on commit 19ef207

Please sign in to comment.