]> _ Git - ccv-wordpress.git/commitdiff
WIP #3053
authorStephen Cameron <stephen@cubedesigners.com>
Tue, 5 Nov 2019 18:55:25 +0000 (19:55 +0100)
committerStephen Cameron <stephen@cubedesigners.com>
Tue, 5 Nov 2019 18:55:25 +0000 (19:55 +0100)
13 files changed:
wp-content/mu-plugins/cube/src/Elementor/Widgets/BackgroundImage.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/HeaderSlideshow.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/LinkCarousel.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/NewsBanner.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/PictoGrid.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/TextBlock.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/_Base.php [new file with mode: 0644]
wp-content/themes/CCV/resources/assets/styles/common/layout.styl
wp-content/themes/CCV/resources/assets/styles/components/mmenu.styl
wp-content/themes/CCV/resources/assets/styles/widgets/picto-grid.styl
wp-content/themes/CCV/resources/assets/styles/widgets/text-block.styl
wp-content/themes/CCV/resources/views/partials/header.blade.php
wp-content/themes/CCV/tailwind.config.js

index 34780f9f7f266c56cc9ab175fd9ce61462a4046a..d502e1e99b0920661834a886bb114568dbeb688d 100644 (file)
@@ -2,12 +2,11 @@
 
 namespace Cube\Elementor\Widgets;
 
-use Elementor\Widget_Base;
 use Elementor\Controls_Manager;
 use Elementor\Utils;
 
 
-class BackgroundImage extends Widget_Base {
+class BackgroundImage extends _Base {
 
     protected $_has_template_content = false; // Tell Elementor that content is all rendered dynamically
 
@@ -26,11 +25,6 @@ class BackgroundImage extends Widget_Base {
         return 'eicon-image';
     }
 
-    // Where to display the widget in the Elementor interface
-    public function get_categories() {
-        return [ 'theme-elements' ];
-    }
-
     /**
      * List of scripts the widget depends on.
      * Used to set scripts dependencies required to run the widget.
@@ -88,6 +82,8 @@ class BackgroundImage extends Widget_Base {
         );
         
         $this->end_controls_section();
+
+        $this->common_controls();
     }
     /**
      * Render the widget output on the frontend.
index 0ce746e5224d50257ab692a60f4e43a4aea4fba1..57e86d72af4cf895c339c209c15266b3a7f7bcd5 100644 (file)
@@ -3,13 +3,12 @@
 namespace Cube\Elementor\Widgets;
 
 use Elementor\Utils;
-use Elementor\Widget_Base;
 use Elementor\Controls_Manager;
 
 use function Roots\asset;
 
 
-class HeaderSlideshow extends Widget_Base {
+class HeaderSlideshow extends _Base {
 
     protected $_has_template_content = false; // Tell Elementor that content is all rendered dynamically
 
@@ -28,11 +27,6 @@ class HeaderSlideshow extends Widget_Base {
         return 'eicon-slideshow';
     }
 
-    // Where to display the widget in the Elementor interface
-    public function get_categories() {
-        return [ 'theme-elements' ];
-    }
-
     /**
      * List of scripts the widget depends on.
      * Used to set scripts dependencies required to run the widget.
@@ -102,6 +96,8 @@ class HeaderSlideshow extends Widget_Base {
         );
         
         $this->end_controls_section();
+
+        $this->common_controls();
     }
     /**
      * Render the widget output on the frontend.
index 3a748518bdf298b38d6fd5a11280aafe709536b3..4a4d139b94b9c0a49df153c29ebbc49c0470afa1 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Cube\Elementor\Widgets;
 
-use Elementor\Widget_Base;
 use Elementor\Controls_Manager;
 use Elementor\Utils;
 
@@ -10,7 +9,7 @@ use function Roots\view;
 use function Roots\asset;
 
 
-class LinkCarousel extends Widget_Base {
+class LinkCarousel extends _Base {
 
     // Widget name / ID
     public function get_name() {
@@ -27,11 +26,6 @@ class LinkCarousel extends Widget_Base {
         return 'eicon-slider-device';
     }
 
-    // Where to display the widget in the Elementor interface
-    public function get_categories() {
-        return [ 'theme-elements' ];
-    }
-
     /**
      * List of scripts the widget depends on.
      * Used to set scripts dependencies required to run the widget.
@@ -104,7 +98,7 @@ class LinkCarousel extends Widget_Base {
         );
         $this->end_controls_section();
 
-
+        $this->common_controls();
     }
     /**
      * Render the widget output on the frontend.
index 2d19caa46ee1d4ea05ed6864b1566eb49e900b20..388f311ebd8528db1a506a9ead5a8d3c322043ec 100644 (file)
@@ -2,11 +2,10 @@
 
 namespace Cube\Elementor\Widgets;
 
-use Elementor\Widget_Base;
 use Elementor\Controls_Manager;
 
 
-class NewsBanner extends Widget_Base {
+class NewsBanner extends _Base {
 
     protected $_has_template_content = false; // Tell Elementor that content is all rendered dynamically
 
@@ -25,11 +24,6 @@ class NewsBanner extends Widget_Base {
         return 'eicon-posts-ticker';
     }
 
-    // Where to display the widget in the Elementor interface
-    public function get_categories() {
-        return [ 'theme-elements' ];
-    }
-
     /**
      * List of scripts the widget depends on.
      * Used to set scripts dependencies required to run the widget.
@@ -67,6 +61,8 @@ class NewsBanner extends Widget_Base {
         );
         
         $this->end_controls_section();
+
+        $this->common_controls();
     }
     /**
      * Render the widget output on the frontend.
index 5225308b1f8f5971d0b3769015bc9fa20b5062da..f3fa5c7b6bd64f78753f7c27ea937f75756e6a06 100644 (file)
@@ -2,14 +2,13 @@
 
 namespace Cube\Elementor\Widgets;
 
-use Elementor\Widget_Base;
 use Elementor\Controls_Manager;
 use Elementor\Utils;
 
 use function Roots\view;
 
 
-class PictoGrid extends Widget_Base {
+class PictoGrid extends _Base {
 
     // Widget name / ID
     public function get_name() {
@@ -26,11 +25,6 @@ class PictoGrid extends Widget_Base {
         return 'eicon-posts-grid';
     }
 
-    // Where to display the widget in the Elementor interface
-    public function get_categories() {
-        return [ 'theme-elements' ];
-    }
-
     /**
      * List of scripts the widget depends on.
      * Used to set scripts dependencies required to run the widget.
@@ -87,12 +81,12 @@ class PictoGrid extends Widget_Base {
                         'label_block' => true,
                     ],
                 ],
-                'title_field' => '{{{ title }}}',
+                'title_field' => '{{{ description }}}',
             ]
         );
         $this->end_controls_section();
 
-
+        $this->common_controls();
     }
     /**
      * Render the widget output on the frontend.
index bf4cebdce657c9826916996db336fc3e7f442f60..19b9a285b70827bd00fe8a6b8a882931d4989bff 100644 (file)
@@ -2,11 +2,9 @@
 
 namespace Cube\Elementor\Widgets;
 
-use Elementor\Widget_Base;
 use Elementor\Controls_Manager;
 
-
-class TextBlock extends Widget_Base {
+class TextBlock extends _Base {
 
     // Widget name / ID
     public function get_name() {
@@ -23,11 +21,6 @@ class TextBlock extends Widget_Base {
         return 'eicon-post-title';
     }
 
-    // Where to display the widget in the Elementor interface
-    public function get_categories() {
-        return [ 'theme-elements' ];
-    }
-
     /**
      * List of scripts the widget depends on.
      * Used to set scripts dependencies required to run the widget.
@@ -98,7 +91,6 @@ class TextBlock extends Widget_Base {
        
         $this->end_controls_section();
 
-
         $this->start_controls_section(
             'section_formatting',
             [
@@ -106,28 +98,7 @@ class TextBlock extends Widget_Base {
             ]
         );
 
-        $this->add_control(
-            'padding_top',
-            [
-                'label' => __('Disable padding top', 'cube'),
-                'type' => Controls_Manager::SWITCHER,
-                'default' => '',
-                'return_value' => 'pt-0',
-                'prefix_class' => '',
-            ]
-        );
-
-        $this->add_control(
-            'padding_bottom',
-            [
-                'label' => __('Disable padding bottom', 'cube'),
-                'type' => Controls_Manager::SWITCHER,
-                'default' => '',
-                'return_value' => 'pb-0',
-                'prefix_class' => '',
-            ]
-        );
-
+        /*
         $this->add_control(
                        'title_size',
                        [
@@ -140,6 +111,7 @@ class TextBlock extends Widget_Base {
                 'default' => '',
                        ]
         );
+        */
 
         $this->add_control(
                        'title_color',
@@ -223,6 +195,8 @@ class TextBlock extends Widget_Base {
                );
 
         $this->end_controls_section();
+
+        $this->common_controls();
     }
     /**
      * Render the widget output on the frontend.
diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/_Base.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/_Base.php
new file mode 100644 (file)
index 0000000..d603d82
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+
+namespace Cube\Elementor\Widgets;
+
+use Elementor\Widget_Base;
+use Elementor\Controls_Manager;
+
+abstract class _Base extends Widget_Base {
+
+    // Where to display the widgets in the Elementor interface
+    // Ref: https://developers.elementor.com/widget-categories/
+    public function get_categories() {
+        return [ 'theme-elements' ];
+    }
+
+    // Wrapper for including all common controls
+    // In the future this might be multiple groups of controls
+    // Most widgets will use this but some might selectively include controls as needed.
+    public function common_controls() {
+        $this->spacing_controls();
+    }
+
+    // Common widget spacing controls
+    public function spacing_controls() {
+
+        $this->start_controls_section(
+            'section_spacing',
+            [
+                'label' => __( 'Spacing', 'cube' ),
+            ]
+        );
+
+        $this->add_control(
+            'margin_top',
+            [
+                'label' => __('Disable margin top', 'cube'),
+                'type' => Controls_Manager::SWITCHER,
+                'default' => '',
+                'return_value' => 'mt-0!',
+                'prefix_class' => '',
+            ]
+        );
+
+        $this->add_control(
+            'margin_bottom',
+            [
+                'label' => __('Disable margin bottom', 'cube'),
+                'type' => Controls_Manager::SWITCHER,
+                'default' => '',
+                'return_value' => 'mb-0!',
+                'prefix_class' => '',
+            ]
+        );
+
+        $this->end_controls_section();
+
+    }
+
+}
index 33dab515226e08c1537516f865a278a8cc5c794b..d48d482764b2ca1e0d0457238969fdae7d7b8ac5 100644 (file)
@@ -26,7 +26,9 @@
 
 
 // Override default spacing between widgets
-.elementor-widget:not(:last-child)
+// All widgets get the bottom margin, even the last child because normally
+// this is desired and if it's not, we can add the class `mb-0!` to it...
+.elementor-widget-wrap .elementor-widget //:not(:last-child)
   constrain(margin-bottom, $vertical-gutter) // Set margin bottom to standard gutter
 
 // Get rid of default 10px padding around elements
index c4b3f832539691df8e6296335dd1e45a2687653a..aafad1ef4b87f91597d8648d3b29a568f132cd46 100644 (file)
   .menu-item
     @apply bg-purple-dark text-white font-display uppercase
 
+    &:hover
+      @apply text-pink
+
+      &:before // Submenu arrow
+        @apply border-pink
+
     // Menu item divider
     &:after
       display: none
     &:nth-of-type(odd)
       @apply bg-pink
     &:nth-of-type(even)
-      @apply bg-teal
+      @apply bg-purple
+
+    &:before, &:after
+      display: none
 
   // Language options
   .locales
@@ -73,6 +82,9 @@
       &:not(:last-child)
         margin-right: 1.125em
 
+      &:hover
+        @apply text-pink
+
 
 // Close button
 #close-menu
index 4e80b05f18260ed0fcdac1a119f967afdd9eaf22..9e880337b6bca395a8189cf8e8bac82792ace66b 100644 (file)
@@ -1,8 +1,15 @@
 .picto-grid
   display: grid
-  // Automatic number of columns based on number of children
-  // but with a min-width to stop them getting too small...
-  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr))
+  grid-template-columns: repeat(4, 1fr)
+  constrain(grid-gap, 5vw)
+  horizontal-spacing(5vw, margin)
+
+  +below(900px)
+    grid-template-columns: repeat(3, 1fr)
+  +below(650px)
+    grid-template-columns: repeat(2, 1fr)
+  +below(400px)
+    grid-template-columns: 1fr
 
   &-image-wrapper
     position: relative
@@ -27,9 +34,9 @@
 
   &-image
     flex: 0 0 auto
-    max-width: 60% !important
-    justify-self: end
-    margin-bottom: 1em
+    max-width: 50% !important
+    max-height: 40%
+    margin-bottom: 0.5em
 
   &-title
     flex: 0 0 auto
@@ -39,6 +46,8 @@
 
   &-description
     text-align: center
+    max-width: 320px
+    margin: 0 auto
 
     &:before
       @apply bg-pink
index ca0481efd1e3a888d550d9d16be87842f25781ef..41008d50a73a303f02465890a6310640b0a73caf 100644 (file)
@@ -1,15 +1,17 @@
 // Text block widget (Elementor defaults)
 .elementor-widget-cube-text //.elementor-widget-container
-  vertical-spacing(7.5vw)
-  constrain(padding-left, 10vw)
-  constrain(padding-right, 7.5vw)
+  vertical-spacing(7.5vw, margin)
+  constrain(margin-left, 10vw)
+  constrain(margin-right, 7.5vw)
   width: 100%
   box-sizing: content-box // So padding doesn't influence max-width
 
   +below(500px)
-    horizontal-spacing(5vw)
+    horizontal-spacing(5vw, margin)
 
 .text-block
+  > * + * // Automatic spacing between direct child elements
+    margin-top: 1.5em
 
   &-title
     @apply text-2xl antialiased
       @apply text-xl // Note: also affected by the base HTML font size since it is converted rems
 
     // No bottom margin if it's the last element (ie. no body below)
-    &:last-child
-      margin-bottom: 0
+    //&:last-child
+    //  margin-bottom: 0
 
   &-body
     font-weight: 300
-    margin-top: r(40px)
+    //margin-top: r(40px)
 
     // If the body is the first child, there's no title
     // so we don't want the top margin...
-    &:first-child
-      margin-top: 0
+    //&:first-child
+    //  margin-top: 0
+
+    > * + * // Automatic spacing between direct child elements
+      margin-top: 1.5em
 
     h3
-      @apply font-medium text-lg
+      @apply font-body font-medium text-lg
 
     a
       @apply text-pink
     b, strong
       font-weight: 400
 
+    li
+      position: relative
+
+      &:before
+        content: ''
+        position: absolute
+        top: 0.4em
+        left: -1.3em
+        width: 7px
+        height: 13px
+        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14'%3E%3Cpath stroke='%23ff078b' stroke-width='2' stroke-linecap='round' d='M1 1l6 6M1 13l6-6'/%3E%3C/svg%3E")
+        background-repeat: no-repeat
+        background-size: contain
+
   &-cta
     @apply antialiased
     margin-top: r(30px)
index ba8c6b0c1abcdd1728622f429ad523465913e90e..24a88bb53b0246c48543632413486677fbc51bdd 100644 (file)
       </ul>
 
       @if ($button_1)
-        <a href="{{ $button_1->url }}" class="header-cta btn btn-no-hover flex items-center hover:bg-teal">
+        <a href="{{ $button_1->url }}" class="header-cta btn btn-no-hover flex items-center">
           <img src="@asset('images/teleconsultation.svg')" class="mr-2">
           {{ $button_1->title }}
         </a>
       @endif
 
       @if ($button_2)
-        <a href="{{ $button_2->url }}" class="header-cta btn btn-no-hover flex items-center bg-purple hover:bg-teal">
+        <a href="{{ $button_2->url }}" class="header-cta btn btn-no-hover flex items-center bg-purple">
           <img src="@asset('images/rendezvous.svg')" class="mr-2">
           {{ $button_2->title }}
         </a>
index 99f5b2b1cea3aeb0d6cbc369044eb94acc4b0519..3723b02065be034e90fc36441d941ea23fd89ab9 100644 (file)
@@ -38,8 +38,12 @@ module.exports = {
         '3xl': '3.0909rem', // 68px
       },
       padding: {
+        '0!': '0 !important', // Special overrides
         '100%': '100%', // Used for proportional padding to make a square
       },
+      margin: {
+        '0!': '0 !important',
+      }
     },
   },
   variants: {},