From 45f369eb145495b949d43b29d23931b1d09fb4b1 Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Wed, 24 Apr 2019 20:32:55 +0200 Subject: [PATCH] WIP #2684 @4 --- .../cube/src/Elementor/Widgets/Heading.php | 18 +++++++--- .../cube/src/Elementor/Widgets/TextBlock.php | 36 +++++++++++-------- .../assets/styles/common/global.styl | 8 ++--- .../assets/styles/common/utilities.styl | 7 ++-- .../assets/styles/widgets/heading.styl | 15 +++++--- .../assets/styles/widgets/text-block.styl | 5 ++- 6 files changed, 56 insertions(+), 33 deletions(-) diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/Heading.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/Heading.php index 70fcf19..efa5c75 100644 --- a/wp-content/mu-plugins/cube/src/Elementor/Widgets/Heading.php +++ b/wp-content/mu-plugins/cube/src/Elementor/Widgets/Heading.php @@ -26,7 +26,7 @@ class Heading extends Widget_Base // Elementor interface icon public function get_icon() { - return 'eicon-align-left'; + return 'eicon-heading'; } // Where to display the widget in the Elementor interface @@ -106,11 +106,19 @@ class Heading extends Widget_Base $this->add_render_attribute('title', 'class', ['heading-title']); // Rendered content - echo '
'; - if (!empty($subtitle)) echo "

get_render_attribute_string('subtitle')}>$subtitle

"; - if (!empty($title)) echo "

get_render_attribute_string('title')}>$title

"; + echo '
'; - echo '
'; + if (!empty($subtitle)) { + echo '
'; + echo "

get_render_attribute_string('subtitle')}>$subtitle

"; + echo '
'; + } + + if (!empty($title)) { + echo "

get_render_attribute_string('title')}>$title

"; + } + + echo '
'; } /** diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php index 27feca8..6a5793e 100644 --- a/wp-content/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php +++ b/wp-content/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php @@ -76,20 +76,6 @@ class TextBlock extends Widget_Base { ] ); - $this->add_control( - 'title_decoration', - [ - 'label' => __( 'Hide title decoration?', 'cube' ), - 'type' => Controls_Manager::SWITCHER, - 'selectors' => [ - "{{WRAPPER}} .text-block-title:after" => 'display: none', - ], - 'condition' => [ - "title!" => '', - ], - ] - ); - $this->add_control( 'body', [ @@ -131,7 +117,27 @@ class TextBlock extends Widget_Base { ] ); - + $this->add_control( + 'padding_top', + [ + 'label' => __('Disable padding top', 'cube'), + 'type' => Controls_Manager::SWITCHER, + 'default' => '', + 'return_value' => 'pt0', + 'prefix_class' => '', + ] + ); + + $this->add_control( + 'padding_bottom', + [ + 'label' => __('Disable padding bottom', 'cube'), + 'type' => Controls_Manager::SWITCHER, + 'default' => '', + 'return_value' => 'pb0', + 'prefix_class' => '', + ] + ); $this->add_control( 'title_size', diff --git a/wp-content/themes/c6/resources/assets/styles/common/global.styl b/wp-content/themes/c6/resources/assets/styles/common/global.styl index 8d537b4..08ff15c 100644 --- a/wp-content/themes/c6/resources/assets/styles/common/global.styl +++ b/wp-content/themes/c6/resources/assets/styles/common/global.styl @@ -19,7 +19,7 @@ html box-sizing: inherit body - background-color: #eee + background-color: #fff color: $colors.text font-family: $font line-height: 1.6 @@ -28,9 +28,9 @@ body min-width: 320px // Main content wrapper - constrain on larger screens -.main - center() - background-color: #fff +//.main +// center() +// background-color: #fff // Paragraph spacing p:not(:last-of-type) diff --git a/wp-content/themes/c6/resources/assets/styles/common/utilities.styl b/wp-content/themes/c6/resources/assets/styles/common/utilities.styl index 588f2ce..5a0d4ea 100644 --- a/wp-content/themes/c6/resources/assets/styles/common/utilities.styl +++ b/wp-content/themes/c6/resources/assets/styles/common/utilities.styl @@ -5,7 +5,10 @@ padding-top: 0 !important padding-bottom: 0 !important -.pt0 +.pt0, +.pt0 > .elementor-widget-container padding-top: 0 !important -.pb0 + +.pb0, +.pb0 > .elementor-widget-container padding-bottom: 0 !important diff --git a/wp-content/themes/c6/resources/assets/styles/widgets/heading.styl b/wp-content/themes/c6/resources/assets/styles/widgets/heading.styl index 335c20d..7dc164e 100644 --- a/wp-content/themes/c6/resources/assets/styles/widgets/heading.styl +++ b/wp-content/themes/c6/resources/assets/styles/widgets/heading.styl @@ -1,15 +1,19 @@ .heading position: relative + horizontal-spacing(7.5vw) + font-size: $font-size-extra-large // Size for title + used for positioning subtitle + + &-subtitle-wrapper + position: absolute + top: 0.93em // This moves the text down the height of ~1 character from the title + left: 0 &-subtitle writing-mode: vertical-lr transform: rotate(180deg) text-orientation: sideways margin: 0 - position: absolute transform-origin: top right - top: 5.5em - left: -5em border-left: 2px solid padding-left: 0.25em text-transform: uppercase @@ -17,4 +21,7 @@ color: $colors.orange &-title - font-weight: 700 \ No newline at end of file + // Use the font size from the parent, which is also used to help with positioning + font-size: inherit + font-weight: 700 + margin-bottom: 0 diff --git a/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl b/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl index 64d255b..cef1902 100644 --- a/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl +++ b/wp-content/themes/c6/resources/assets/styles/widgets/text-block.styl @@ -2,15 +2,14 @@ // Padding is applied here so it can be overridden by Elementor .elementor-widget-cube-text .elementor-widget-container center(480px) - constrain(padding-left, 5vw) - constrain(padding-right, 5vw) + horizontal-spacing(5vw) + vertical-spacing(10vw) box-sizing: content-box // So padding doesn't influence max-width // When in a "default" section layout, add some padding //.layout-default & // constrain(padding-left, 7.5vw) - .text-block &-subtitle -- 2.39.5