summaryrefslogtreecommitdiff
path: root/inc/builder/type/header/primary-header
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2021-07-21 14:54:07 -0500
committerZach van Rijn <me@zv.io>2021-07-21 14:54:07 -0500
commit9d4123cee1867ee7199b06bdc92d40611f547ecc (patch)
tree6d864e2725242863afed1f8ba12d9c7a9bc63a69 /inc/builder/type/header/primary-header
downloadblog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.gz
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.bz2
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.tar.xz
blog-ng-9d4123cee1867ee7199b06bdc92d40611f547ecc.zip
Initial unmodified import from Astra (Version: 3.6.5) @ /wp-content/themes/astra/.
Diffstat (limited to 'inc/builder/type/header/primary-header')
-rw-r--r--inc/builder/type/header/primary-header/assets/js/minified/customizer-preview.min.js1
-rw-r--r--inc/builder/type/header/primary-header/assets/js/unminified/customizer-preview.js152
-rw-r--r--inc/builder/type/header/primary-header/class-astra-primary-header-loader.php115
-rw-r--r--inc/builder/type/header/primary-header/class-astra-primary-header.php45
-rw-r--r--inc/builder/type/header/primary-header/dynamic-css/dynamic.css.php238
5 files changed, 551 insertions, 0 deletions
diff --git a/inc/builder/type/header/primary-header/assets/js/minified/customizer-preview.min.js b/inc/builder/type/header/primary-header/assets/js/minified/customizer-preview.min.js
new file mode 100644
index 0000000..993c385
--- /dev/null
+++ b/inc/builder/type/header/primary-header/assets/js/minified/customizer-preview.min.js
@@ -0,0 +1 @@
+!function(){var t=AstraBuilderPrimaryHeaderData.tablet_break_point||768,r=AstraBuilderPrimaryHeaderData.mobile_break_point||544;wp.customize("astra-settings[hb-header-height]",function(a){a.bind(function(a){var e;""==a.desktop&&""==a.tablet&&""==a.mobile||(e="",e+=".ast-mobile-header-wrap .ast-primary-header-bar , .ast-primary-header-bar .site-primary-header-wrap {",e+="min-height: "+a.desktop+"px;",e+="} ",e+=".ast-desktop .ast-primary-header-bar .main-header-menu > .menu-item {",e+="line-height: "+a.desktop+"px;",e+="} ",e+="@media (max-width: "+t+"px) {",e+=".ast-mobile-header-wrap .ast-primary-header-bar , .ast-primary-header-bar .site-primary-header-wrap {",e+="min-height: "+a.tablet+"px;",e+="} ",e+="} ",e+="@media (max-width: "+r+"px) {",e+=".ast-mobile-header-wrap .ast-primary-header-bar , .ast-primary-header-bar .site-primary-header-wrap {",e+="min-height: "+a.mobile+"px;",e+="} ",e+="} ",astra_add_dynamic_css("hb-header-height",e))})}),wp.customize("astra-settings[hb-header-main-layout-width]",function(a){a.bind(function(a){var e="";"content"!==a?(e+="#masthead .ast-container, .site-header-focus-item + .ast-breadcrumbs-wrapper {",e+="max-width: unset;",e+="padding-left: 35px;",e+="padding-right: 35px;"):(e="#masthead .ast-container, .site-header-focus-item + .ast-breadcrumbs-wrapper {",e+="max-width: 100%",e+="padding-left: 20px;",e+="padding-right: 20px;"),e+="} ",e+="@media (max-width: "+AstraBuilderPrimaryHeaderData.header_break_point+"px) {",e+="#masthead .ast-mobile-header-wrap .ast-above-header-bar, #masthead .ast-mobile-header-wrap .ast-primary-header-bar, #masthead .ast-mobile-header-wrap .ast-below-header-bar {",e+="padding-left: 20px;",e+="padding-right: 20px;",e+="} ",e+="} ",astra_add_dynamic_css("hb-header-main-layout-width",e)})}),wp.customize("astra-settings[hb-header-main-sep]",function(a){a.bind(function(a){var e="";e+=".ast-header-break-point .ast-primary-header-bar, .ast-primary-header-bar {",e+="border-bottom-width: "+a+"px;",e+="border-bottom-style: solid;",e+="border-color:"+wp.customize("astra-settings[hb-header-main-sep-color]").get()+";",e+="}",astra_add_dynamic_css("hb-header-main-sep",e)})}),astra_css("astra-settings[hb-header-main-sep-color]","border-color",".ast-header-break-point .ast-primary-header-bar, .ast-primary-header-bar"),astra_apply_responsive_background_css("astra-settings[hb-header-bg-obj-responsive]",".main-header-bar","desktop"),astra_apply_responsive_background_css("astra-settings[hb-header-bg-obj-responsive]",".ast-primary-header.main-header-bar","tablet"),astra_apply_responsive_background_css("astra-settings[hb-header-bg-obj-responsive]",".ast-primary-header.main-header-bar","mobile"),astra_builder_advanced_css("section-primary-header-builder",".ast-desktop .ast-primary-header-bar, .ast-header-break-point .ast-primary-header-bar"),astra_builder_visibility_css("section-primary-header-builder",".ast-primary-header-bar","grid"),wp.customize("astra-settings[section-header-builder-layout-margin]",function(a){a.bind(function(a){var e;""==a.desktop.bottom&&""==a.desktop.top&&""==a.desktop.left&&""==a.desktop.right&&""==a.tablet.bottom&&""==a.tablet.top&&""==a.tablet.left&&""==a.tablet.right&&""==a.mobile.bottom&&""==a.mobile.top&&""==a.mobile.left&&""==a.mobile.right||(e="",e+=".ast-hfb-header .site-header {",e+="margin-left: "+a.desktop.left+a["desktop-unit"]+";",e+="margin-right: "+a.desktop.right+a["desktop-unit"]+";",e+="margin-top: "+a.desktop.top+a["desktop-unit"]+";",e+="margin-bottom: "+a.desktop.bottom+a["desktop-unit"]+";",e+="} ",e+="@media (max-width: "+t+"px) {",e+=".ast-hfb-header .site-header {",e+="margin-left: "+a.tablet.left+a["tablet-unit"]+";",e+="margin-right: "+a.tablet.right+a["tablet-unit"]+";",e+="margin-top: "+a.tablet.top+a["desktop-unit"]+";",e+="margin-bottom: "+a.tablet.bottom+a["desktop-unit"]+";",e+="} ",e+="} ",e+="@media (max-width: "+r+"px) {",e+=".ast-hfb-header .site-header {",e+="margin-left: "+a.mobile.left+a["mobile-unit"]+";",e+="margin-right: "+a.mobile.right+a["mobile-unit"]+";",e+="margin-top: "+a.mobile.top+a["desktop-unit"]+";",e+="margin-bottom: "+a.mobile.bottom+a["desktop-unit"]+";",e+="} ",e+="} ",astra_add_dynamic_css("section-header-builder-layout-margin-toggle-button",e))})})}(jQuery); \ No newline at end of file
diff --git a/inc/builder/type/header/primary-header/assets/js/unminified/customizer-preview.js b/inc/builder/type/header/primary-header/assets/js/unminified/customizer-preview.js
new file mode 100644
index 0000000..1118135
--- /dev/null
+++ b/inc/builder/type/header/primary-header/assets/js/unminified/customizer-preview.js
@@ -0,0 +1,152 @@
+/**
+ * This file adds some LIVE to the Customizer live preview. To leverage
+ * this, set your custom settings to 'postMessage' and then add your handling
+ * here. Your javascript should grab settings from customizer controls, and
+ * then make any necessary changes to the page using jQuery.
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+( function( $ ) {
+
+ var tablet_break_point = AstraBuilderPrimaryHeaderData.tablet_break_point || 768,
+ mobile_break_point = AstraBuilderPrimaryHeaderData.mobile_break_point || 544;
+
+ wp.customize( 'astra-settings[hb-header-height]', function( value ) {
+ value.bind( function( size ) {
+
+ if( size.desktop != '' || size.tablet != '' || size.mobile != '' ) {
+ var dynamicStyle = '';
+ dynamicStyle += '.ast-mobile-header-wrap .ast-primary-header-bar , .ast-primary-header-bar .site-primary-header-wrap {';
+ dynamicStyle += 'min-height: ' + size.desktop + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '.ast-desktop .ast-primary-header-bar .main-header-menu > .menu-item {';
+ dynamicStyle += 'line-height: ' + size.desktop + 'px;';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += '.ast-mobile-header-wrap .ast-primary-header-bar , .ast-primary-header-bar .site-primary-header-wrap {';
+ dynamicStyle += 'min-height: ' + size.tablet + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += '.ast-mobile-header-wrap .ast-primary-header-bar , .ast-primary-header-bar .site-primary-header-wrap {';
+ dynamicStyle += 'min-height: ' + size.mobile + 'px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ astra_add_dynamic_css( 'hb-header-height', dynamicStyle );
+ }
+ } );
+ } );
+
+ // Primary Header - Layout > Content Width.
+ wp.customize( 'astra-settings[hb-header-main-layout-width]', function( setting ) {
+ setting.bind( function( layout ) {
+
+ var dynamicStyle = '';
+
+ if ( 'content' !== layout ) {
+ dynamicStyle += '#masthead .ast-container, .site-header-focus-item + .ast-breadcrumbs-wrapper {';
+ dynamicStyle += 'max-width: unset;';
+ dynamicStyle += 'padding-left: 35px;';
+ dynamicStyle += 'padding-right: 35px;';
+ dynamicStyle += '} ';
+
+ } else {
+ dynamicStyle = '#masthead .ast-container, .site-header-focus-item + .ast-breadcrumbs-wrapper {';
+ dynamicStyle += 'max-width: 100%';
+ dynamicStyle += 'padding-left: 20px;';
+ dynamicStyle += 'padding-right: 20px;';
+ dynamicStyle += '} ';
+ }
+
+ dynamicStyle += '@media (max-width: ' + AstraBuilderPrimaryHeaderData.header_break_point + 'px) {';
+ dynamicStyle += '#masthead .ast-mobile-header-wrap .ast-above-header-bar, #masthead .ast-mobile-header-wrap .ast-primary-header-bar, #masthead .ast-mobile-header-wrap .ast-below-header-bar {';
+ dynamicStyle += 'padding-left: 20px;';
+ dynamicStyle += 'padding-right: 20px;';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ astra_add_dynamic_css( 'hb-header-main-layout-width', dynamicStyle );
+ } );
+ } );
+
+ // Border Bottom width.
+ wp.customize( 'astra-settings[hb-header-main-sep]', function( value ) {
+ value.bind( function( border ) {
+
+ var color = wp.customize( 'astra-settings[hb-header-main-sep-color]' ).get(),
+ dynamicStyle = '';
+
+ dynamicStyle += '.ast-header-break-point .ast-primary-header-bar, .ast-primary-header-bar {';
+ dynamicStyle += 'border-bottom-width: ' + border + 'px;';
+ dynamicStyle += 'border-bottom-style: solid;';
+ dynamicStyle += 'border-color:' + color + ';';
+ dynamicStyle += '}';
+
+ astra_add_dynamic_css( 'hb-header-main-sep', dynamicStyle );
+
+ } );
+ } );
+
+ // Border Color.
+ astra_css(
+ 'astra-settings[hb-header-main-sep-color]',
+ 'border-color',
+ '.ast-header-break-point .ast-primary-header-bar, .ast-primary-header-bar'
+ );
+
+ // Responsive BG styles > Primary Header Row.
+ astra_apply_responsive_background_css( 'astra-settings[hb-header-bg-obj-responsive]', '.main-header-bar', 'desktop' );
+ astra_apply_responsive_background_css( 'astra-settings[hb-header-bg-obj-responsive]', '.ast-primary-header.main-header-bar', 'tablet' );
+ astra_apply_responsive_background_css( 'astra-settings[hb-header-bg-obj-responsive]', '.ast-primary-header.main-header-bar', 'mobile' );
+
+ // Advanced CSS Generation.
+ astra_builder_advanced_css( 'section-primary-header-builder', '.ast-desktop .ast-primary-header-bar, .ast-header-break-point .ast-primary-header-bar' );
+
+ // Advanced Visibility CSS Generation.
+ astra_builder_visibility_css( 'section-primary-header-builder', '.ast-primary-header-bar', 'grid' );
+
+ // Advanced CSS for Header Builder - Margin.
+ wp.customize( 'astra-settings[section-header-builder-layout-margin]', function( value ) {
+ value.bind( function( margin ) {
+ if(
+ margin.desktop.bottom != '' || margin.desktop.top != '' || margin.desktop.left != '' || margin.desktop.right != '' ||
+ margin.tablet.bottom != '' || margin.tablet.top != '' || margin.tablet.left != '' || margin.tablet.right != '' ||
+ margin.mobile.bottom != '' || margin.mobile.top != '' || margin.mobile.left != '' || margin.mobile.right != ''
+ ) {
+ var dynamicStyle = '';
+ dynamicStyle += '.ast-hfb-header .site-header {';
+ dynamicStyle += 'margin-left: ' + margin['desktop']['left'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['desktop']['right'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['desktop']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['desktop']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + tablet_break_point + 'px) {';
+ dynamicStyle += '.ast-hfb-header .site-header {';
+ dynamicStyle += 'margin-left: ' + margin['tablet']['left'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['tablet']['right'] + margin['tablet-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['tablet']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['tablet']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+
+ dynamicStyle += '@media (max-width: ' + mobile_break_point + 'px) {';
+ dynamicStyle += '.ast-hfb-header .site-header {';
+ dynamicStyle += 'margin-left: ' + margin['mobile']['left'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-right: ' + margin['mobile']['right'] + margin['mobile-unit'] + ';';
+ dynamicStyle += 'margin-top: ' + margin['mobile']['top'] + margin['desktop-unit'] + ';';
+ dynamicStyle += 'margin-bottom: ' + margin['mobile']['bottom'] + margin['desktop-unit'] + ';';
+ dynamicStyle += '} ';
+ dynamicStyle += '} ';
+ astra_add_dynamic_css( 'section-header-builder-layout-margin-toggle-button', dynamicStyle );
+ }
+ } );
+ } );
+
+
+} )( jQuery );
diff --git a/inc/builder/type/header/primary-header/class-astra-primary-header-loader.php b/inc/builder/type/header/primary-header/class-astra-primary-header-loader.php
new file mode 100644
index 0000000..2f12bcd
--- /dev/null
+++ b/inc/builder/type/header/primary-header/class-astra-primary-header-loader.php
@@ -0,0 +1,115 @@
+<?php
+/**
+ * Button Styling Loader for Astra theme.
+ *
+ * @package Astra
+ * @author Brainstorm Force
+ * @copyright Copyright (c) 2020, Brainstorm Force
+ * @link https://www.brainstormforce.com
+ * @since Astra 3.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Customizer Initialization
+ *
+ * @since 3.0.0
+ */
+class Astra_Primary_Header_Loader {
+
+ /**
+ * Constructor
+ *
+ * @since 3.0.0
+ */
+ public function __construct() {
+ add_action( 'customize_preview_init', array( $this, 'preview_scripts' ), 110 );
+
+ // Markup.
+ remove_filter( 'body_class', 'astra_body_classes' );
+ add_filter( 'body_class', array( $this, 'astra_body_header_classes' ) );
+ }
+
+ /**
+ * Adds custom classes to the array of body classes.
+ *
+ * @since 1.0.0
+ * @param array $classes Classes for the body element.
+ * @return array
+ */
+ public function astra_body_header_classes( $classes ) {
+
+ if ( wp_is_mobile() ) {
+ $classes[] = 'ast-header-break-point';
+ } else {
+ $classes[] = 'ast-desktop';
+ }
+
+ if ( astra_is_amp_endpoint() ) {
+ $classes[] = 'ast-amp';
+ }
+
+ // Apply separate container class to the body.
+ $content_layout = astra_get_content_layout();
+ if ( 'content-boxed-container' == $content_layout ) {
+ $classes[] = 'ast-separate-container';
+ } elseif ( 'boxed-container' == $content_layout ) {
+ $classes[] = 'ast-separate-container ast-two-container';
+ } elseif ( 'page-builder' == $content_layout ) {
+ $classes[] = 'ast-page-builder-template';
+ } elseif ( 'plain-container' == $content_layout ) {
+ $classes[] = 'ast-plain-container';
+ }
+ // Sidebar location.
+ $page_layout = 'ast-' . astra_page_layout();
+ $classes[] = esc_attr( $page_layout );
+
+ // Current Astra verion.
+ $classes[] = esc_attr( 'astra-' . ASTRA_THEME_VERSION );
+
+ /**
+ * Add class for header width
+ */
+ $header_content_layout = astra_get_option( 'hb-header-main-layout-width' );
+
+ if ( 'full' == $header_content_layout ) {
+ $classes[] = 'ast-full-width-primary-header';
+ }
+
+ return $classes;
+ }
+
+ /**
+ * Customizer Preview
+ *
+ * @since 3.0.0
+ */
+ public function preview_scripts() {
+ /**
+ * Load unminified if SCRIPT_DEBUG is true.
+ */
+ /* Directory and Extension */
+ $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
+ $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
+ wp_enqueue_script( 'astra-heading-primary-customizer-preview-js', ASTRA_PRIMARY_HEADER_URI . '/assets/js/' . $dir_name . '/customizer-preview' . $file_prefix . '.js', array( 'customize-preview', 'astra-customizer-preview-js' ), ASTRA_THEME_VERSION, true );
+
+ // Localize variables for Button JS.
+ wp_localize_script(
+ 'astra-heading-primary-customizer-preview-js',
+ 'AstraBuilderPrimaryHeaderData',
+ array(
+ 'header_break_point' => astra_header_break_point(),
+ 'tablet_break_point' => astra_get_tablet_breakpoint(),
+ 'mobile_break_point' => astra_get_mobile_breakpoint(),
+ )
+ );
+ }
+}
+
+/**
+* Kicking this off by creating the object of the class.
+*/
+new Astra_Primary_Header_Loader();
diff --git a/inc/builder/type/header/primary-header/class-astra-primary-header.php b/inc/builder/type/header/primary-header/class-astra-primary-header.php
new file mode 100644
index 0000000..ebe81dd
--- /dev/null
+++ b/inc/builder/type/header/primary-header/class-astra-primary-header.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Heading Colors for Astra theme.
+ *
+ * @package Astra
+ * @author Brainstorm Force
+ * @copyright Copyright (c) 2020, Brainstorm Force
+ * @link https://www.brainstormforce.com
+ * @since Astra 3.0.0.
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+define( 'ASTRA_PRIMARY_HEADER_DIR', ASTRA_THEME_DIR . 'inc/builder/type/header/primary-header' );
+define( 'ASTRA_PRIMARY_HEADER_URI', ASTRA_THEME_URI . 'inc/builder/type/header/primary-header' );
+
+/**
+ * Heading Initial Setup
+ *
+ * @since 3.0.0
+ */
+class Astra_Primary_Header {
+
+ /**
+ * Constructor function that initializes required actions and hooks
+ */
+ public function __construct() {
+ // @codingStandardsIgnoreStart WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
+ require_once ASTRA_PRIMARY_HEADER_DIR . '/class-astra-primary-header-loader.php';
+
+ // Include front end files.
+ if ( ! is_admin() ) {
+ require_once ASTRA_PRIMARY_HEADER_DIR . '/dynamic-css/dynamic.css.php';
+ remove_filter( 'astra_dynamic_theme_css', 'astra_header_breakpoint_style' );
+ }
+ // @codingStandardsIgnoreEnd WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
+ }
+}
+
+/**
+ * Kicking this off by creating an object.
+ */
+new Astra_Primary_Header();
diff --git a/inc/builder/type/header/primary-header/dynamic-css/dynamic.css.php b/inc/builder/type/header/primary-header/dynamic-css/dynamic.css.php
new file mode 100644
index 0000000..3d9caf8
--- /dev/null
+++ b/inc/builder/type/header/primary-header/dynamic-css/dynamic.css.php
@@ -0,0 +1,238 @@
+<?php
+/**
+ * Primary Header - Dynamic CSS
+ *
+ * @package Astra
+ * @since 3.0.0
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit; // Exit if accessed directly.
+}
+
+/**
+ * Heading Colors
+ */
+add_filter( 'astra_dynamic_theme_css', 'astra_primary_header_breakpoint_style', 11 );
+
+/**
+ * Dynamic CSS
+ *
+ * @param string $dynamic_css Astra Dynamic CSS.
+ * @param string $dynamic_css_filtered Astra Dynamic CSS Filters.
+ * @return String Generated dynamic CSS for Heading Colors.
+ *
+ * @since 3.0.0
+ */
+function astra_primary_header_breakpoint_style( $dynamic_css, $dynamic_css_filtered = '' ) {
+
+ if ( ! is_customize_preview() && ( ! Astra_Builder_helper::is_row_empty( 'primary', 'header', 'desktop' ) && ! Astra_Builder_helper::is_row_empty( 'primary', 'header', 'mobile' ) ) ) {
+ return $dynamic_css;
+ }
+
+ // Parsed CSS.
+ $parse_css = '';
+
+ $hb_header_height = astra_get_option( 'hb-header-height' );
+
+ // Header Height.
+ $hb_header_height_desktop = ( isset( $hb_header_height['desktop'] ) && ! empty( $hb_header_height['desktop'] ) ) ? $hb_header_height['desktop'] : '';
+ $hb_header_height_tablet = ( isset( $hb_header_height['tablet'] ) && ! empty( $hb_header_height['tablet'] ) ) ? $hb_header_height['tablet'] : '';
+ $hb_header_height_mobile = ( isset( $hb_header_height['mobile'] ) && ! empty( $hb_header_height['mobile'] ) ) ? $hb_header_height['mobile'] : '';
+
+
+ $common_css_output = array(
+ '.ast-mobile-header-wrap .ast-primary-header-bar, .ast-primary-header-bar .site-primary-header-wrap' => array(
+ 'min-height' => astra_get_css_value( $hb_header_height_desktop, 'px' ),
+ ),
+ '.ast-desktop .ast-primary-header-bar .main-header-menu > .menu-item' => array(
+ 'line-height' => astra_get_css_value( $hb_header_height_desktop, 'px' ),
+ ),
+ );
+
+ $parse_css .= astra_parse_css( $common_css_output );
+
+ if ( Astra_Builder_Helper::is_component_loaded( 'woo-cart', 'header' ) || Astra_Builder_Helper::is_component_loaded( 'edd-cart', 'header' ) ) {
+ $common_css_cart_output = array(
+ '.ast-desktop .ast-primary-header-bar .ast-header-woo-cart, .ast-desktop .ast-primary-header-bar .ast-header-edd-cart' => array(
+ 'line-height' => astra_get_css_value( $hb_header_height_desktop, 'px' ),
+ ),
+ );
+
+ $parse_css .= astra_parse_css( $common_css_cart_output );
+ }
+
+
+ $astra_header_width = astra_get_option( 'hb-header-main-layout-width' );
+ $header_breadcrumb_position = astra_get_option( 'breadcrumb-position' );
+
+ /* Width for Header */
+ if ( 'content' !== $astra_header_width ) {
+ $general_global_responsive = array(
+ '#masthead .ast-container, .site-header-focus-item + .ast-breadcrumbs-wrapper' => array(
+ 'max-width' => '100%',
+ 'padding-left' => '35px',
+ 'padding-right' => '35px',
+ ),
+ );
+
+ /* Parse CSS from array()*/
+ $parse_css .= astra_parse_css( $general_global_responsive );
+
+ } elseif ( 'astra_header_primary_container_after' == $header_breadcrumb_position ) {
+ $site_content_width = astra_get_option( 'site-content-width', 1200 );
+ $general_global_responsive = array(
+ '.site-header-focus-item + .ast-breadcrumbs-wrapper' => array(
+ 'max-width' => astra_get_css_value( $site_content_width + 40, 'px' ),
+ 'margin-left' => 'auto',
+ 'margin-right' => 'auto',
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ ),
+ );
+
+ /* Parse CSS from array()*/
+ $parse_css .= astra_parse_css( $general_global_responsive );
+ }
+
+ $padding_below_breakpoint = array(
+ '#masthead .ast-mobile-header-wrap .ast-primary-header-bar, #masthead .ast-mobile-header-wrap .ast-below-header-bar' => array(
+ 'padding-left' => '20px',
+ 'padding-right' => '20px',
+ ),
+ );
+
+ $parse_css .= astra_parse_css( $padding_below_breakpoint, '', astra_get_tablet_breakpoint() );
+
+ // Header Separator.
+ $header_separator = absint( astra_get_option( 'hb-header-main-sep' ) );
+
+ // Apply border only when it has positive value.
+ if ( $header_separator ) {
+ $header_separator_color = astra_get_option( 'hb-header-main-sep-color' );
+
+ $border_responsive_style = array(
+ '.ast-header-break-point .ast-primary-header-bar' => array(
+ 'border-bottom-width' => astra_get_css_value( $header_separator, 'px' ),
+ 'border-bottom-color' => esc_attr( $header_separator_color ),
+ 'border-bottom-style' => 'solid',
+ ),
+ );
+
+
+ $border_desktop_style = array(
+ '.ast-primary-header-bar' => array(
+ 'border-bottom-width' => astra_get_css_value( $header_separator, 'px' ),
+ 'border-bottom-color' => esc_attr( $header_separator_color ),
+ 'border-bottom-style' => 'solid',
+ ),
+ );
+
+ } else {
+ $border_responsive_style = array(
+ '.ast-header-break-point .ast-primary-header-bar' => array(
+ 'border-bottom-style' => 'none',
+ ),
+ );
+
+ $border_desktop_style = array(
+ '.ast-primary-header-bar' => array(
+ 'border-bottom-style' => 'none',
+ ),
+ );
+ }
+
+ $parse_css .= astra_parse_css( $border_responsive_style );
+ $parse_css .= astra_parse_css( $border_desktop_style, astra_get_tablet_breakpoint( '', 1 ) );
+
+ $header_bg_obj = astra_get_option( 'hb-header-bg-obj-responsive' );
+
+ /**
+ * Responsive Colors options
+ * Header Responsive Background with Image
+ */
+ $desktop_colors = array(
+ '.ast-primary-header-bar' => astra_get_responsive_background_obj( $header_bg_obj, 'desktop' ),
+ );
+
+ $tablet_colors = array(
+ '.ast-primary-header-bar.ast-primary-header' => astra_get_responsive_background_obj( $header_bg_obj, 'tablet' ),
+ '.ast-mobile-header-wrap .ast-primary-header-bar, .ast-primary-header-bar .site-primary-header-wrap' => array(
+ 'min-height' => astra_get_css_value( $hb_header_height_tablet, 'px' ),
+ ),
+ );
+ $mobile_colors = array(
+ '.ast-primary-header-bar.ast-primary-header' => astra_get_responsive_background_obj( $header_bg_obj, 'mobile' ),
+ '.ast-mobile-header-wrap .ast-primary-header-bar , .ast-primary-header-bar .site-primary-header-wrap' => array(
+ 'min-height' => astra_get_css_value( $hb_header_height_mobile, 'px' ),
+ ),
+ );
+
+ /* Parse CSS from array() */
+ /**
+ * Tweak - Check for AMP Support.
+ */
+ $parse_css .= apply_filters( 'astra_addon_colors_dynamic_css_desktop', astra_parse_css( $desktop_colors ) );
+ $parse_css .= apply_filters( 'astra_addon_colors_dynamic_css_tablet', astra_parse_css( $tablet_colors, '', astra_get_tablet_breakpoint() ) );
+ $parse_css .= apply_filters( 'astra_addon_colors_dynamic_css_mobile', astra_parse_css( $mobile_colors, '', astra_get_mobile_breakpoint() ) );
+
+ /**
+ * Tweak - $remove_bottom_sire_brancing - Search in Astra Pro.
+ */
+
+ // Trim white space for faster page loading.
+ $dynamic_css .= Astra_Enqueue_Scripts::trim_css( $parse_css );
+
+ $_section = 'section-primary-header-builder';
+
+ $parent_selector = '.ast-desktop .ast-primary-header-bar.main-header-bar, .ast-header-break-point #masthead .ast-primary-header-bar.main-header-bar';
+
+ $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_advanced_margin_padding_css( $_section, $parent_selector );
+
+ $dynamic_css .= Astra_Builder_Base_Dynamic_CSS::prepare_visibility_css( $_section, '.ast-primary-header-bar', 'block', 'grid' );
+
+ // Advanced CSS for Header Builder.
+ $margin = astra_get_option( 'section-header-builder-layout-margin' );
+
+ // Desktop CSS.
+ $css_output_desktop = array(
+
+ '.ast-hfb-header .site-header' => array(
+ // Margin CSS.
+ 'margin-top' => astra_responsive_spacing( $margin, 'top', 'desktop' ),
+ 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'desktop' ),
+ 'margin-left' => astra_responsive_spacing( $margin, 'left', 'desktop' ),
+ 'margin-right' => astra_responsive_spacing( $margin, 'right', 'desktop' ),
+ ),
+ );
+
+ // Tablet CSS.
+ $css_output_tablet = array(
+
+ '.ast-hfb-header .site-header' => array(
+ // Margin CSS.
+ 'margin-top' => astra_responsive_spacing( $margin, 'top', 'tablet' ),
+ 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'tablet' ),
+ 'margin-left' => astra_responsive_spacing( $margin, 'left', 'tablet' ),
+ 'margin-right' => astra_responsive_spacing( $margin, 'right', 'tablet' ),
+ ),
+ );
+
+ // Mobile CSS.
+ $css_output_mobile = array(
+
+ '.ast-hfb-header .site-header' => array(
+ // Margin CSS.
+ 'margin-top' => astra_responsive_spacing( $margin, 'top', 'mobile' ),
+ 'margin-bottom' => astra_responsive_spacing( $margin, 'bottom', 'mobile' ),
+ 'margin-left' => astra_responsive_spacing( $margin, 'left', 'mobile' ),
+ 'margin-right' => astra_responsive_spacing( $margin, 'right', 'mobile' ),
+ ),
+ );
+
+ $dynamic_css .= astra_parse_css( $css_output_desktop );
+ $dynamic_css .= astra_parse_css( $css_output_tablet, '', astra_get_tablet_breakpoint() );
+ $dynamic_css .= astra_parse_css( $css_output_mobile, '', astra_get_mobile_breakpoint() );
+
+ return $dynamic_css;
+}