]> _ Git - ccv-wordpress.git/commitdiff
WIP #3053 @8
authorStephen Cameron <stephen@cubedesigners.com>
Mon, 7 Oct 2019 15:39:01 +0000 (17:39 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Mon, 7 Oct 2019 15:39:01 +0000 (17:39 +0200)
14 files changed:
wp-content/mu-plugins/cube/src/Elementor/Setup.php
wp-content/mu-plugins/cube/src/Elementor/Widgets/NewsBanner.php [new file with mode: 0644]
wp-content/themes/CCV/app/setup.php
wp-content/themes/CCV/composer.lock
wp-content/themes/CCV/config/svg.php [new file with mode: 0644]
wp-content/themes/CCV/package.json
wp-content/themes/CCV/resources/assets/images/arrow.svg [new file with mode: 0644]
wp-content/themes/CCV/resources/assets/styles/components/headings.styl
wp-content/themes/CCV/resources/assets/styles/components/news.styl [new file with mode: 0644]
wp-content/themes/CCV/resources/views/index.blade.php
wp-content/themes/CCV/resources/views/partials/content.blade.php
wp-content/themes/CCV/resources/views/partials/entry-meta.blade.php
wp-content/themes/CCV/tailwind.config.js
wp-content/themes/CCV/yarn.lock

index 0243899c31ab2b4449c1ca9224db6e6f1e5b1369..4b66eea8f5211b1cbcd810d876ab04e1844fd7a6 100644 (file)
@@ -33,6 +33,7 @@ class Setup {
         $elementor->widgets_manager->register_widget_type( new Widgets\BackgroundImage() );
         $elementor->widgets_manager->register_widget_type( new Widgets\TextBlock() );
         $elementor->widgets_manager->register_widget_type( new Widgets\HeaderSlideshow() );
+        $elementor->widgets_manager->register_widget_type( new Widgets\NewsBanner() );
     }
 
     protected function _customise_sections() {
diff --git a/wp-content/mu-plugins/cube/src/Elementor/Widgets/NewsBanner.php b/wp-content/mu-plugins/cube/src/Elementor/Widgets/NewsBanner.php
new file mode 100644 (file)
index 0000000..25a232a
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+
+namespace Cube\Elementor\Widgets;
+
+use Elementor\Widget_Base;
+use Elementor\Controls_Manager;
+
+
+class NewsBanner extends Widget_Base {
+
+    protected $_has_template_content = false; // Tell Elementor that content is all rendered dynamically
+
+    // Widget name / ID
+    public function get_name() {
+        return 'cube-news-banner';
+    }
+
+    // Elementor widget title
+    public function get_title() {
+        return __( 'News Banner', 'cube' );
+    }
+
+    // Elementor interface icon
+    public function get_icon() {
+        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.
+     *
+     * @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' => __( 'Latest News Banner', 'cube' ),
+            ]
+        );
+
+        $this->add_control(
+            'widget_description',
+            [
+                'raw' => __( 'This widget will display the most recent news post. If no published news posts are available, nothing will be shown.', 'cube' ),
+                'type' => Controls_Manager::RAW_HTML,
+                'content_classes' => 'elementor-descriptor',
+            ]
+        );
+        
+        $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() {
+
+        $post = wp_get_recent_posts([
+            'numberposts' => 1,
+            'orderby' => 'post_date',
+            'order' => 'DESC',
+            'post_type' => 'post',
+            'post_status' => 'publish',
+            'suppress_filters' => true
+        ]);
+
+        if ($post && isset($post[0]['post_title'])) {
+
+            echo '<div class="bg-purple-dark text-white px-2v py-4 flex items-center justify-between">';
+            echo '<a href="'. get_permalink($post[0]['ID']) .'">'. $post[0]['post_title'] .'</a>';
+            echo '<a href="'. get_permalink(get_option('page_for_posts')) .'" class="btn ml-2">'. __("Voir toute l'actualité", 'cube') .'</a>';
+            echo '</div>';
+
+        }
+
+
+    }
+}
index 93f553a33da79ece1fa2cb262f1843a9b96b1f65..7e49840b97fa2d497037e55231a00d1e6526cc46 100755 (executable)
@@ -62,6 +62,7 @@ add_action('after_setup_theme', function () {
      * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
      */
     add_theme_support('post-thumbnails');
+    set_post_thumbnail_size(336, 336, true); // Square featured images cropped
 
     /**
      * Enable HTML5 markup support
index 089a3cf193a4458d21a1122f4d707f050ed97608..e64fee86fcd3f525ffbe751646c2ff6d6ac85efc 100644 (file)
         },
         {
             "name": "log1x/sage-svg",
-            "version": "v1.0.1",
+            "version": "v1.0.2",
             "source": {
                 "type": "git",
                 "url": "https://github.com/Log1x/sage-svg.git",
-                "reference": "c7b459191b416e64a31a9a782a962b9a6ef565c9"
+                "reference": "2b6722da8a393dbaa07b5aecbc2a916bf0752145"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/Log1x/sage-svg/zipball/c7b459191b416e64a31a9a782a962b9a6ef565c9",
-                "reference": "c7b459191b416e64a31a9a782a962b9a6ef565c9",
+                "url": "https://api.github.com/repos/Log1x/sage-svg/zipball/2b6722da8a393dbaa07b5aecbc2a916bf0752145",
+                "reference": "2b6722da8a393dbaa07b5aecbc2a916bf0752145",
                 "shasum": ""
             },
             "require": {
                 "php": ">=7.1.3"
             },
+            "require-dev": {
+                "squizlabs/php_codesniffer": "^3.4"
+            },
             "type": "package",
             "extra": {
                 "acorn": {
                 "svg",
                 "wordpress"
             ],
-            "time": "2019-07-20T20:37:25+00:00"
+            "time": "2019-09-25T10:12:58+00:00"
         },
         {
             "name": "monolog/monolog",
         },
         {
             "name": "nesbot/carbon",
-            "version": "2.24.0",
+            "version": "2.25.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/briannesbitt/Carbon.git",
-                "reference": "934459c5ac0658bc765ad1e53512c7c77adcac29"
+                "reference": "d59c6cea9c4a3547bb6c0dfec451319abdaa4fb1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/934459c5ac0658bc765ad1e53512c7c77adcac29",
-                "reference": "934459c5ac0658bc765ad1e53512c7c77adcac29",
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d59c6cea9c4a3547bb6c0dfec451319abdaa4fb1",
+                "reference": "d59c6cea9c4a3547bb6c0dfec451319abdaa4fb1",
                 "shasum": ""
             },
             "require": {
                     "homepage": "http://github.com/kylekatarnls"
                 }
             ],
-            "description": "A API extension for DateTime that supports 281 different languages.",
+            "description": "An API extension for DateTime that supports 281 different languages.",
             "homepage": "http://carbon.nesbot.com",
             "keywords": [
                 "date",
                 "datetime",
                 "time"
             ],
-            "time": "2019-08-31T16:37:55+00:00"
+            "time": "2019-10-05T15:52:23+00:00"
         },
         {
             "name": "psr/container",
             "source": {
                 "type": "git",
                 "url": "https://github.com/roots/acorn.git",
-                "reference": "ef9bd3d4f6beb874c996f9214c9a9f8626c8448d"
+                "reference": "d1f8b68151c9931f97fe0e2e1ceef6e5c17be9f4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/roots/acorn/zipball/ef9bd3d4f6beb874c996f9214c9a9f8626c8448d",
-                "reference": "ef9bd3d4f6beb874c996f9214c9a9f8626c8448d",
+                "url": "https://api.github.com/repos/roots/acorn/zipball/d1f8b68151c9931f97fe0e2e1ceef6e5c17be9f4",
+                "reference": "d1f8b68151c9931f97fe0e2e1ceef6e5c17be9f4",
                 "shasum": ""
             },
             "require": {
                 "sage",
                 "wordpress"
             ],
-            "time": "2019-09-21T06:19:33+00:00"
+            "time": "2019-10-01T11:24:39+00:00"
         },
         {
             "name": "roots/support",
     "packages-dev": [
         {
             "name": "squizlabs/php_codesniffer",
-            "version": "3.4.2",
+            "version": "3.5.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
-                "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8"
+                "reference": "0afebf16a2e7f1e434920fa976253576151effe9"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
-                "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8",
+                "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/0afebf16a2e7f1e434920fa976253576151effe9",
+                "reference": "0afebf16a2e7f1e434920fa976253576151effe9",
                 "shasum": ""
             },
             "require": {
                 "phpcs",
                 "standards"
             ],
-            "time": "2019-04-10T23:49:02+00:00"
+            "time": "2019-09-26T23:12:26+00:00"
         }
     ],
     "aliases": [],
diff --git a/wp-content/themes/CCV/config/svg.php b/wp-content/themes/CCV/config/svg.php
new file mode 100644 (file)
index 0000000..f853d0d
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+use function Roots\base_path;
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Path
+    |--------------------------------------------------------------------------
+    |
+    | This value is the default path used by SageSVG for finding SVG files.
+    | This path is then resolved internally if an absolute path is not being
+    | used.
+    |
+    */
+
+    'path' => base_path('dist/images'),
+
+    /*
+    |--------------------------------------------------------------------------
+    | Class
+    |--------------------------------------------------------------------------
+    |
+    | Here you can specify a default class to be added on all inlined SVGs.
+    | Much like how you would define multiple classes in an HTML attribute,
+    | you may separate each class using a space.
+    |
+    */
+
+    'class' => 'svg',
+];
index 8ae0b50ef24a223e6df8422baef81ba9ab75a3dc..88767d754cadc7ec8ec5ae5ab86056338a3595c1 100644 (file)
@@ -33,7 +33,7 @@
     "rupture": "^0.7.1",
     "stylelint": "^10.1",
     "stylelint-config-standard": "^18.2",
-    "stylus": "github:acidjazz/stylus#dev",
+    "stylus": "^0.54.7",
     "stylus-loader": "^3.0.2",
     "tailwindcss": "^1.0",
     "tailwindcss-wordpress": "^0.1",
diff --git a/wp-content/themes/CCV/resources/assets/images/arrow.svg b/wp-content/themes/CCV/resources/assets/images/arrow.svg
new file mode 100644 (file)
index 0000000..93276e3
--- /dev/null
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 32"><path d="M3.1 31c-.5 0-1.1-.2-1.5-.6-.8-.8-.8-2.1 0-2.9L13.8 16 1.6 4.4c-.8-.8-.8-2.1 0-2.9s2.2-.8 3 0l13.7 13c.5.5.7 1 .7 1.5s-.2 1-.6 1.4l-13.7 13c-.5.4-1 .6-1.6.6z" /></svg>
index 3400b285fac0a31e446844602f75ac5b0038195a..ef154566b58399d8e69a150be890b4387fab91cb 100644 (file)
@@ -1,6 +1,9 @@
 h1, .h1, h2, .h2
-  @apply font-display font-medium mb-2 uppercase
   line-height: 1.1
+  font-weight: 400
+
+  &:not(.plain)
+    @apply font-display font-medium mb-2 uppercase
 
 h1, .h1
   @apply text-3xl
@@ -10,28 +13,29 @@ h2, .h2
 
 // Pink dash
 h1, .h1, h2, .h2, .decorated
-  @apply relative
-
-  +below($breakpoint-columns)
-    margin-left: 0.9em
-
-  &:before
-    content: ''
-    display: block
-    position: absolute
-    top: 0.55em
-    constrain(left, -5vw)
-    constrain(width, 2.5vw)
-    height: 5px
-    background: theme('colors.pink')
-
-    +below(1150px)
-      width: 0.9em
-      left: -1.3em
-      height: 4px
+  &:not(.plain)
+    @apply relative
 
     +below($breakpoint-columns)
-      height: 3px
+      margin-left: 0.9em
+
+    &:before
+      content: ''
+      display: block
+      position: absolute
+      top: 0.55em
+      constrain(left, -5vw)
+      constrain(width, 2.5vw)
+      height: 5px
+      background: theme('colors.pink')
+
+      +below(1150px)
+        width: 0.9em
+        left: -1.3em
+        height: 4px
+
+      +below($breakpoint-columns)
+        height: 3px
 
 
 h3, .h3, h4, .h4
diff --git a/wp-content/themes/CCV/resources/assets/styles/components/news.styl b/wp-content/themes/CCV/resources/assets/styles/components/news.styl
new file mode 100644 (file)
index 0000000..29904f8
--- /dev/null
@@ -0,0 +1,10 @@
+.post
+
+  &-featured-image
+    @apply bg-gray-300 bg-cover bg-center
+    @apply w-full
+    constrain(margin-right, 5vw)
+    max-width: 336px
+
+    &-sizer
+      padding-bottom: 100%
index a9760d1c06b62b22ad3f684f16822a8290a4262a..e87293b28a107e229394117e1371bff19e341dc3 100644 (file)
@@ -1,21 +1,30 @@
 @extends('layouts.app')
 
 @section('content')
-  @include('partials.page-header')
 
-  @if (! have_posts())
-    @alert(['type' => 'warning'])
-      {{ __('Sorry, no results were found.', 'sage') }}
-    @endalert
+  <div class="bg-light py-2v px-4v">
 
-    {!! get_search_form(false) !!}
-  @endif
+    <h1 class="h2">{!! get_the_title(get_option('page_for_posts', true)) !!}</h1>
 
-  @while (have_posts()) @php(the_post())
-    @includeFirst(['partials.content-'.get_post_type(), 'partials.content'])
-  @endwhile
+    <div class="mt-1v">
 
-  {!! get_the_posts_navigation() !!}
+      @if (! have_posts())
+        @alert(['type' => 'warning'])
+          {{ __('Sorry, no results were found.', 'sage') }}
+        @endalert
+
+        {!! get_search_form(false) !!}
+      @endif
+
+      @while (have_posts()) @php(the_post())
+        @includeFirst(['partials.content-'.get_post_type(), 'partials.content'])
+      @endwhile
+
+      {!! get_the_posts_navigation() !!}
+
+    </div>
+
+  </div>
 @endsection
 
 @section('sidebar')
index c6b5bffdf06b3990fea79ed4ee7c57c1b4d4e43d..bc12184672f759b367dc1c34cb2f89355cff72f6 100644 (file)
@@ -1,15 +1,26 @@
-<article @php(post_class())>
+<article @php(post_class('flex items-start'))>
+
+  <div class="post-featured-image" style="background-image: url({{ get_the_post_thumbnail_url() }})">
+    <div class="post-featured-image-sizer">{{-- Just here as a proportional sizer thanks to the padding --}}</div>
+  </div>
+
   <header>
-    <h2 class="entry-title">
+    @include('partials/entry-meta')
+
+    <h2 class="plain my-4">
       <a href="{{ get_permalink() }}">
         {!! $title !!}
       </a>
     </h2>
 
-    @include('partials/entry-meta')
+    <div class="entry-summary">
+      @php(the_excerpt())
+    </div>
+
+    <p class="mt-6">
+      <a class="uppercase text-pink inline-flex items-center" href="{{ get_permalink() }}">@svg('arrow', 'h-3 mr-2 fill-current') Lire la suite</a>
+    </p>
+
   </header>
 
-  <div class="entry-summary">
-    @php(the_excerpt())
-  </div>
 </article>
index f218893c8d24d45161d602b86d335157f46feef6..aeb8de21485503e3af725702092998c4ff502fd9 100644 (file)
@@ -2,9 +2,11 @@
   {{ get_the_date() }}
 </time>
 
+{{--
 <p class="byline author vcard">
   <span>{{ __('By', 'sage') }}</span>
   <a href="{{ get_author_posts_url(get_the_author_meta('ID')) }}" rel="author" class="fn">
     {{ get_the_author() }}
   </a>
 </p>
+--}}
index 1bbc3891707ffad30477afc7fcfb9a351491d3a3..5607fb2c32c439c300d78d79e5fa91a375e6303e 100644 (file)
@@ -34,7 +34,10 @@ module.exports = {
         'xl': '1.9091rem', // 42px
         '2xl': '2.4545rem', // 54px
         '3xl': '3.0909rem', // 68px
-      }
+      },
+      padding: {
+        '100%': '100%', // Used for proportional padding to make a square
+      },
     },
   },
   variants: {},
index e6237e4ace25e61890d26ef563018d25c4863fea..f0e34d86a4a73973158f0a64ad56090e80434426 100644 (file)
@@ -3519,7 +3519,7 @@ glob-to-regexp@^0.3.0:
   resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab"
   integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=
 
-glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@~7.1.2:
+glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3:
   version "7.1.4"
   resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255"
   integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==
@@ -7060,7 +7060,7 @@ safe-regex@^1.1.0:
   dependencies:
     ret "~0.1.10"
 
-"safer-buffer@>= 2.1.2 < 3":
+"safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.1.2:
   version "2.1.2"
   resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
   integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
@@ -7104,6 +7104,11 @@ selfsigned@^1.10.4:
   resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b"
   integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==
 
+semver@^6.0.0:
+  version "6.3.0"
+  resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
+  integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
+
 semver@^6.1.0, semver@^6.1.1:
   version "6.1.1"
   resolved "https://registry.yarnpkg.com/semver/-/semver-6.1.1.tgz#53f53da9b30b2103cd4f15eab3a18ecbcb210c9b"
@@ -7465,7 +7470,7 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
   resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
   integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
 
-source-map@~0.7.2:
+source-map@^0.7.3:
   version "0.7.3"
   resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
   integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==
@@ -7834,16 +7839,19 @@ stylus-loader@^3.0.2:
     lodash.clonedeep "^4.5.0"
     when "~3.6.x"
 
-"stylus@github:acidjazz/stylus#dev":
-  version "0.54.5"
-  resolved "https://codeload.github.com/acidjazz/stylus/tar.gz/f6d39f350166e15db4b662f287d1cdbdf88103e1"
+stylus@^0.54.7:
+  version "0.54.7"
+  resolved "https://registry.yarnpkg.com/stylus/-/stylus-0.54.7.tgz#c6ce4793965ee538bcebe50f31537bfc04d88cd2"
+  integrity sha512-Yw3WMTzVwevT6ZTrLCYNHAFmanMxdylelL3hkWNgPMeTCpMwpV3nXjpOHuBXtFv7aiO2xRuQS6OoAdgkNcSNug==
   dependencies:
     css-parse "~2.0.0"
     debug "~3.1.0"
-    glob "~7.1.2"
+    glob "^7.1.3"
     mkdirp "~0.5.x"
+    safer-buffer "^2.1.2"
     sax "~1.2.4"
-    source-map "~0.7.2"
+    semver "^6.0.0"
+    source-map "^0.7.3"
 
 sugarss@^2.0.0:
   version "2.0.0"