]> _ Git - ccv-wordpress.git/commitdiff
Done #3498 @9.5
authorStephen Cameron <stephen@cubedesigners.com>
Wed, 15 Apr 2020 17:06:16 +0000 (19:06 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Wed, 15 Apr 2020 17:06:16 +0000 (19:06 +0200)
15 files changed:
wp-content/mu-plugins/cube/src/Elementor/Setup.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/DynamicTable.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/FancyList.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/JustifiedList.php [new file with mode: 0644]
wp-content/themes/CCV/app/setup.php
wp-content/themes/CCV/resources/assets/images/table-tick.svg
wp-content/themes/CCV/resources/assets/styles/common/global.styl
wp-content/themes/CCV/resources/assets/styles/common/layout.styl
wp-content/themes/CCV/resources/assets/styles/components/headings.styl
wp-content/themes/CCV/resources/assets/styles/widgets/fancy-list.styl [new file with mode: 0644]
wp-content/themes/CCV/resources/assets/styles/widgets/justified-list.styl [new file with mode: 0644]
wp-content/themes/CCV/resources/views/widgets/fancy-list.blade.php
wp-content/themes/CCV/resources/views/widgets/justified-list.blade.php [new file with mode: 0644]
wp-content/themes/CCV/tailwind.config.js
wp-content/themes/CCV/webpack.mix.js

index 11e02b03a395094a06dc761c7b9e0a3e767f03c1..273d259200018f9e47b386a1a9e005e2d1b08f5a 100644 (file)
@@ -43,6 +43,7 @@ class Setup {
         $elementor->widgets_manager->register_widget_type( new Widgets\ScientificNews() );
         $elementor->widgets_manager->register_widget_type( new Widgets\DynamicTable() );
         $elementor->widgets_manager->register_widget_type( new Widgets\FancyList() );
+        $elementor->widgets_manager->register_widget_type( new Widgets\JustifiedList() );
     }
 
     protected function _customise_sections() {
index 31ea24b18ea31f2153bf3e6940e03cea42fe461a..befdb74a95fef98be73a316d01aa2e64f5f7f732 100644 (file)
@@ -87,27 +87,28 @@ class DynamicTable extends Widget_Base {
                         'type' => Controls_Manager::SELECT,
                         'options' => [
                             '' => __( 'Défaut', 'cube' ),
+                            'bg-white' => __( 'Blanc', 'cube' ),
                             'bg-light' => __( 'Gris clair', 'cube' ),
                         ],
                     ],
                     [
-                        'name' => 'text_align',
-                        'label' => __( 'Alignement du texte', 'cube' ),
+                        'name' => 'font_style',
+                        'label' => __( 'Style de police', 'cube' ),
                         'type' => Controls_Manager::SELECT,
                         'options' => [
                             '' => __( 'Défaut', 'cube' ),
-                            'text-left' => __( 'Gauche', 'cube' ),
-                            'text-center' => __( 'Centré', 'cube' ),
-                            'text-right' => __( 'Droit', 'cube' ),
+                            'font-bold' => __( 'Gras', 'cube' ),
                         ],
                     ],
                     [
-                        'name' => 'font_style',
-                        'label' => __( 'Style de police', 'cube' ),
+                        'name' => 'text_align',
+                        'label' => __( 'Alignement du texte', 'cube' ),
                         'type' => Controls_Manager::SELECT,
                         'options' => [
                             '' => __( 'Défaut', 'cube' ),
-                            'font-bold' => __( 'Gras', 'cube' ),
+                            'text-left' => __( 'Gauche', 'cube' ),
+                            'text-center' => __( 'Centré', 'cube' ),
+                            'text-right' => __( 'Droit', 'cube' ),
                         ],
                     ],
                 ],
index 90925d4a0da53b1fffa933b8305aad6424e03741..dbd64a814d8f23c07a2ac1362512ca795108309e 100644 (file)
@@ -4,6 +4,7 @@ namespace Cube\Elementor\Widgets;
 
 use Elementor\Widget_Base;
 use Elementor\Controls_Manager;
+use Elementor\Core\Schemes;
 
 use function Roots\view;
 
@@ -53,6 +54,7 @@ class FancyList extends Widget_Base {
             'section_content',
             [
                 'label' => __( 'Liste formatée', 'cube' ),
+                'tab' => Controls_Manager::TAB_CONTENT
             ]
         );
 
@@ -84,6 +86,50 @@ class FancyList extends Widget_Base {
         );
 
         $this->end_controls_section();
+
+        $this->start_controls_section(
+            'section_style',
+            [
+                'label' => __( 'Liste formatée', 'cube' ),
+                'tab' => Controls_Manager::TAB_STYLE,
+            ]
+        );
+
+        $this->add_control(
+            'bg_color',
+            [
+                'label' => __( 'Couleur de fond', 'cube' ),
+                'type' => Controls_Manager::COLOR,
+                'default' => '',
+                'selectors' => [
+                    '{{WRAPPER}}' => 'background-color: {{VALUE}};',
+                ],
+                'scheme' => [
+                    'type' => Schemes\Color::get_type(),
+                    'value' => Schemes\Color::COLOR_3,
+                ],
+            ]
+        );
+
+        $this->add_control(
+            'text_color',
+            [
+                'label' => __( 'Couleur de texte', 'cube' ),
+                'type' => Controls_Manager::COLOR,
+                'default' => '',
+                'selectors' => [
+                    '{{WRAPPER}}' => 'color: {{VALUE}};',
+                ],
+                'scheme' => [
+                    'type' => Schemes\Color::get_type(),
+                    'value' => Schemes\Color::COLOR_3,
+                ],
+            ]
+        );
+
+        $this->end_controls_section();
+
+
     }
     /**
      * Render the widget output on the frontend.
diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/JustifiedList.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/JustifiedList.php
new file mode 100644 (file)
index 0000000..57f1dff
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+
+namespace Cube\Elementor\Widgets;
+
+use Elementor\Widget_Base;
+use Elementor\Controls_Manager;
+
+use function Roots\view;
+
+
+class JustifiedList extends Widget_Base {
+
+    // Widget name / ID
+    public function get_name() {
+        return 'cube-justified-list';
+    }
+
+    // Elementor widget title
+    public function get_title() {
+        return __( 'Données Justifiées', 'cube' );
+    }
+
+    // Elementor interface icon
+    public function get_icon() {
+        return 'eicon-columns';
+    }
+
+    // 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.
+     *
+     * @since 1.0.0
+     * @access public
+     * @return array Widget scripts dependencies.
+     */
+    public function get_script_depends() {
+        return [];
+    }
+    /**
+     * Register the widget controls.
+     * Adds different input fields to allow the user to change and customize the widget settings.
+     *
+     * @since 1.0.0
+     * @access protected
+     */
+    protected function _register_controls() {
+
+        $this->start_controls_section(
+            'section_content',
+            [
+                'label' => __( 'Données Justifiées', 'cube' ),
+            ]
+        );
+
+        $this->add_control(
+            'items',
+            [
+                'label' => __( 'Éléments', 'cube' ),
+                'type' => Controls_Manager::REPEATER,
+                'fields' => [
+                    [
+                        'name' => 'title',
+                        'label' => __( 'Titre', 'cube' ),
+                        'type' => Controls_Manager::WYSIWYG,
+                        'default' => '',
+                        'label_block' => true,
+                    ],
+                    [
+                        'name' => 'value',
+                        'label' => __( 'Valeur', 'cube' ),
+                        'type' => Controls_Manager::WYSIWYG,
+                        'default' => '',
+                        'label_block' => true,
+                    ],
+                    [
+                        'name' => 'bg_color',
+                        'label' => __( 'Couleur de fond', 'cube' ),
+                        'type' => Controls_Manager::SELECT,
+                        'options' => [
+                            '' => __( 'Défaut', 'cube' ),
+                            'bg-white' => __( 'Blanc', 'cube' ),
+                            'bg-light' => __( 'Gris clair', 'cube' ),
+                        ],
+                    ],
+                ],
+                'title_field' => '{{{ title }}}',
+            ]
+        );
+
+
+        $this->end_controls_section();
+    }
+    /**
+     * Render the widget output on the frontend.
+     * Written in PHP and used to generate the final HTML.
+     *
+     * @since 1.0.0
+     * @access protected
+     */
+    protected function render() {
+
+        $items = $this->get_settings('items');
+
+        echo view('widgets/justified-list', compact('items'));
+    }
+
+}
index ba18817be5f8f9063fd04685b4a4226b081eecd4..84108c1a01ec0f074d1c896e36682608e2ec2701 100755 (executable)
@@ -169,17 +169,21 @@ add_filter( 'mce_buttons_2', function($buttons) {
 
 // Add format classes to
 add_filter( 'tiny_mce_before_init', function($init_array) {
+
+    // Text size styles
     $sizes = [
-        'xs',
-        'sm',
-        'lg',
-        'xl',
+        'xs' => 'Extra Small',
+        'sm' => 'Small',
+        'base' => 'Normal',
+        'lg' => 'Large',
+        'xl' => 'Extra Large',
     ];
 
-    // Text size styles
-    foreach ($sizes as $size) {
-        $style_formats[] = [
-            'title' => 'Text '. strtoupper($size),
+    $size_formats = [];
+
+    foreach ($sizes as $size => $size_label) {
+        $size_formats[] = [
+            'title' => $size_label,
             'inline' => 'span',
             'selector' => 'h1, h2, h3, h4, h5, p, div',
             'classes' => 'text-'. $size,
@@ -187,6 +191,38 @@ add_filter( 'tiny_mce_before_init', function($init_array) {
         ];
     }
 
+    // Add submenu for font sizes
+    $style_formats[] = [
+        'title' => 'Font Size',
+        'items' => $size_formats,
+    ];
+
+    // Font weights
+    $weights = [
+        'light',
+        'normal',
+        'medium',
+        'bold',
+    ];
+
+    $weight_formats = [];
+
+    foreach ($weights as $weight) {
+        $weight_formats[] = [
+            'title' => ucfirst($weight),
+            'inline' => 'span',
+            'selector' => 'h1, h2, h3, h4, h5, p, div, li',
+            'classes' => 'font-'. $weight,
+            'wrapper' => false,
+        ];
+    }
+
+    // Add submenu for font weights
+    $style_formats[] = [
+        'title' => 'Font Weight',
+        'items' => $weight_formats,
+    ];
+
     // Insert the array, JSON ENCODED, into 'style_formats'
     $init_array['style_formats'] = json_encode( $style_formats );
 
index 446d0b01098e377e3fda710c408fe12a4eb951a0..2b8aea04391ae04ca953f43995c5f4f7cd4b3afa 100644 (file)
@@ -1,5 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="39.071" height="24.097" viewBox="0 0 39.071 24.097">
-  <g transform="translate(2.828 2.828)">
-    <path d="M556,228.366l14.146,14.146,19.268-19.268" transform="translate(-556 -223.244)" fill="none" stroke="#ff078b" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"/>
-  </g>
-</svg>
+<svg xmlns="http://www.w3.org/2000/svg" width="39" height="25"><path d="M3.028 8.028l14 13.9 19-19" fill="none" stroke="#ff078b" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>
index 402c8740ba6ee2730d606254ca00b36e71bf60d8..fec93e3dbc2e6c45319724069390e97fc63be04d 100644 (file)
@@ -14,13 +14,9 @@ body
   min-width: 320px
   background-color: #FBFBFB
 
-p:not(:last-child)
-  margin-bottom: 1.5em
+* + p
+  margin-top: 1.5em
 
 .wrapper
   @apply mx-auto
   max-width: $content-max-width
-
-// VueJS styling to hide elements until they're ready
-[v-cloak]
-  visibility: hidden
index 53c08a7801c7003e0d469a975ab566f825260beb..c80a5649c29cae678a4dbba8c7c2bf111f215fc7 100644 (file)
 .elementor-column-gap-default > .elementor-row > .elementor-column > .elementor-element-populated
   padding: 0
 
+.elementor-section-boxed > .elementor-column-gap-extended
+  horizontal-spacing(-1.5vw, margin) // Negative margins to pull back horizontal padding added to child columns below
+  > .elementor-row > .elementor-column > .elementor-element-populated
+    horizontal-spacing(1.5vw)
+    padding-top: 0
+    padding-bottom: 0
+
 .elementor-section-boxed > .elementor-column-gap-wide
   horizontal-spacing(-2.5vw, margin) // Negative margins to pull back horizontal padding added to child columns below
   > .elementor-row > .elementor-column > .elementor-element-populated
     horizontal-spacing(2.5vw)
     padding-top: 0
     padding-bottom: 0
-  //+below(450px)
-  //  padding-left: 0
-  //  padding-right: 0
+
+// Once columns have wrapped, remove padding for all
++below($breakpoint-columns)
+  .elementor-container > .elementor-row > .elementor-column > .elementor-element-populated
+    padding: 0 !important
index e4df31b93215c3afc85af6c0e62a4a1add1f2f78..e47277949fdc238bf709d5c7ae010b6b33d95c70 100644 (file)
@@ -31,8 +31,8 @@ h1, .h1, h2, .h2, .decorated
       background: theme('colors.pink')
 
       +below(1150px)
-        width: 0.9em
-        left: -1.3em
+        width: 0.8em
+        left: -1.15em
         height: 4px
 
       +below($breakpoint-columns)
diff --git a/wp-content/themes/CCV/resources/assets/styles/widgets/fancy-list.styl b/wp-content/themes/CCV/resources/assets/styles/widgets/fancy-list.styl
new file mode 100644 (file)
index 0000000..59cbc41
--- /dev/null
@@ -0,0 +1,61 @@
+.fancy-list
+
+  &-wrapper
+    @apply px-6 py-8
+
+  &-title:not(.plain)
+    .fancy-list-wrapper & // Adds some specificity so these rules override others from the headings
+      @apply uppercase text-2xl text-center
+      padding-bottom: 0.75em
+      margin-bottom: @padding-bottom
+      margin-left: 0
+
+    &:before
+      top: auto
+      bottom: 0
+      left: 50%
+      transform: translateX(-50%)
+
+  // Top level list
+  &-items
+    > * + *
+      margin-top: 1.5em
+
+  // Top level individual list item
+  &-item
+    @apply relative pl-6
+
+    &:before
+      content: ''
+      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='39' height='25'%3E%3Cpath d='M3.028 8.028l14 13.9 19-19' fill='none' stroke='%23ff078b' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
+      background-size: contain
+      background-repeat: no-repeat
+      position: absolute
+      width: 1.5rem
+      height: 0.91rem
+      left: -0.6em
+      top: 0.4em
+
+    &-content
+      p:not(:last-child) // Mostly for the p + ul elements
+        margin-bottom: 0.5em
+
+      p.text-lg // Tighten up larger text
+        line-height: 1.25
+
+      ul
+        @apply pl-4
+
+      li
+        position: relative
+
+        &:before
+          content: ''
+          position: absolute
+          top: 0.45em
+          left: -0.8em
+          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
diff --git a/wp-content/themes/CCV/resources/assets/styles/widgets/justified-list.styl b/wp-content/themes/CCV/resources/assets/styles/widgets/justified-list.styl
new file mode 100644 (file)
index 0000000..37d4349
--- /dev/null
@@ -0,0 +1,65 @@
+.justified-list
+
+  &-wrapper
+    @apply -mx-4 // Offsets the padding on items
+
+    .compact-prices &
+      @apply flex flex-wrap
+
+      > *
+        flex-basis: 50%
+
+        // Out of every 4 children, the first two get a grey background
+        // This is needed for the zebra stripes and the two column view
+        &:nth-child(4n-2), &:nth-child(4n-3)
+          @apply bg-light
+
+        // Create extra space between the two columns
+        &:nth-child(odd)
+          constrain(padding-right, 3vw)
+        &:nth-child(even)
+          constrain(padding-left, 3vw)
+
+        // On small screens, columns stack and zebra stripes are changed to odd/even
+        +below('medium')
+          flex-basis: 100%
+
+          &:nth-child(odd)
+            @apply bg-light pr-4
+          &:nth-child(even)
+            @apply bg-transparent pl-4
+
+
+
+  &-item
+    @apply flex items-center justify-between
+    @apply py-6 px-4
+
+    // Tighten up vertical spacing
+    .compact-prices &
+      @apply py-1
+
+
+    &-title
+
+      // > Arrow before titles
+      .compact-prices &
+        position: relative
+        padding-left: 1em // Space for arrow
+
+        &:before
+          content: ''
+          position: absolute
+          top: 0.4em
+          left: 0
+          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
+
+    &-value
+      flex: 0 0 15% // Normally the value should fit within 15% width but it's ok if it doesn't
+      constrain(margin-left, 2.5vw) // Make sure title doesn't touch the value
+      white-space: nowrap
+      text-align: right
index b9d40cfcec92ca0729301cbc6bfc334186ee6996..08701afeda554ddeccf7d269c455d6dfca6deadf 100644 (file)
@@ -1,5 +1,5 @@
 <div class="fancy-list-wrapper">
-  <h3 class="fancy-list-title">{{ $title }}</h3>
+  <h3 class="h2 fancy-list-title">{{ $title }}</h3>
   <ul class="fancy-list-items">
     @foreach ($items as $item)
       <li class="fancy-list-item">
diff --git a/wp-content/themes/CCV/resources/views/widgets/justified-list.blade.php b/wp-content/themes/CCV/resources/views/widgets/justified-list.blade.php
new file mode 100644 (file)
index 0000000..e4c9f9c
--- /dev/null
@@ -0,0 +1,15 @@
+<div class="justified-list-wrapper">
+  @foreach ($items as $item)
+    <div class="justified-list-item {{ $item['bg_color'] }}">
+
+      @if ($item['title'])
+        <div class="justified-list-item-title">{!! $item['title'] !!}</div>
+      @endif
+
+      @if ($item['value'])
+        <div class="justified-list-item-value">{!! $item['value'] !!}</div>
+      @endif
+
+    </div>
+  @endforeach
+</div>
index 1ebdd7fd0778c50363bc0bc0e0246da881b00432..dcd11588422e6584a9abdcc1959f9c0e382774e6 100644 (file)
@@ -71,7 +71,6 @@ module.exports = {
   ],
   corePlugins: {
     container: false,
-    float: false,
     objectFit: false,
     objectPosition: false,
   },
index 06dec8512b912300033ef75b486d52dc9fa32394..b1e562e988774bddd9108a065c79acebfec03c2b 100644 (file)
@@ -93,6 +93,7 @@ mix.purgeCss({
    */
   whitelist: [
     ...whitelist,
+    'antialiased',
     'font-body',
     'font-light',
     'text-dark',
@@ -105,6 +106,14 @@ mix.purgeCss({
     'text-3xl',
     'italic',
     'mt-2',
+    'mb-6',
+    'mr-6',
+    'float-left',
+    'xs:block',
+    'xs:float-none',
+    'xs:mx-auto',
+    'sm:text-base',
+    'sm:mx-2v',
   ],
   whitelistPatterns: [
     ...whitelistPatterns,