From eedc2c7b84c8bf0d613c39fe757dc07c022a40ca Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Mon, 7 Oct 2019 17:39:01 +0200 Subject: [PATCH] WIP #3053 @8 --- .../mu-plugins/cube/src/Elementor/Setup.php | 1 + .../cube/src/Elementor/Widgets/NewsBanner.php | 100 ++++++++++++++++++ wp-content/themes/CCV/app/setup.php | 1 + wp-content/themes/CCV/composer.lock | 43 ++++---- wp-content/themes/CCV/config/svg.php | 32 ++++++ wp-content/themes/CCV/package.json | 2 +- .../CCV/resources/assets/images/arrow.svg | 1 + .../assets/styles/components/headings.styl | 46 ++++---- .../assets/styles/components/news.styl | 10 ++ .../CCV/resources/views/index.blade.php | 31 ++++-- .../views/partials/content.blade.php | 23 ++-- .../views/partials/entry-meta.blade.php | 2 + wp-content/themes/CCV/tailwind.config.js | 5 +- wp-content/themes/CCV/yarn.lock | 24 +++-- 14 files changed, 253 insertions(+), 68 deletions(-) create mode 100644 wp-content/mu-plugins/cube/src/Elementor/Widgets/NewsBanner.php create mode 100644 wp-content/themes/CCV/config/svg.php create mode 100644 wp-content/themes/CCV/resources/assets/images/arrow.svg create mode 100644 wp-content/themes/CCV/resources/assets/styles/components/news.styl diff --git a/wp-content/mu-plugins/cube/src/Elementor/Setup.php b/wp-content/mu-plugins/cube/src/Elementor/Setup.php index 0243899..4b66eea 100644 --- a/wp-content/mu-plugins/cube/src/Elementor/Setup.php +++ b/wp-content/mu-plugins/cube/src/Elementor/Setup.php @@ -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 index 0000000..25a232a --- /dev/null +++ b/wp-content/mu-plugins/cube/src/Elementor/Widgets/NewsBanner.php @@ -0,0 +1,100 @@ +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 '
'; + echo ''. $post[0]['post_title'] .''; + echo ''. __("Voir toute l'actualité", 'cube') .''; + echo '
'; + + } + + + } +} diff --git a/wp-content/themes/CCV/app/setup.php b/wp-content/themes/CCV/app/setup.php index 93f553a..7e49840 100755 --- a/wp-content/themes/CCV/app/setup.php +++ b/wp-content/themes/CCV/app/setup.php @@ -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 diff --git a/wp-content/themes/CCV/composer.lock b/wp-content/themes/CCV/composer.lock index 089a3cf..e64fee8 100644 --- a/wp-content/themes/CCV/composer.lock +++ b/wp-content/themes/CCV/composer.lock @@ -756,21 +756,24 @@ }, { "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": { @@ -803,7 +806,7 @@ "svg", "wordpress" ], - "time": "2019-07-20T20:37:25+00:00" + "time": "2019-09-25T10:12:58+00:00" }, { "name": "monolog/monolog", @@ -885,16 +888,16 @@ }, { "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": { @@ -941,14 +944,14 @@ "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", @@ -1100,12 +1103,12 @@ "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": { @@ -1157,7 +1160,7 @@ "sage", "wordpress" ], - "time": "2019-09-21T06:19:33+00:00" + "time": "2019-10-01T11:24:39+00:00" }, { "name": "roots/support", @@ -1871,16 +1874,16 @@ "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": { @@ -1918,7 +1921,7 @@ "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 index 0000000..f853d0d --- /dev/null +++ b/wp-content/themes/CCV/config/svg.php @@ -0,0 +1,32 @@ + 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', +]; diff --git a/wp-content/themes/CCV/package.json b/wp-content/themes/CCV/package.json index 8ae0b50..88767d7 100644 --- a/wp-content/themes/CCV/package.json +++ b/wp-content/themes/CCV/package.json @@ -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 index 0000000..93276e3 --- /dev/null +++ b/wp-content/themes/CCV/resources/assets/images/arrow.svg @@ -0,0 +1 @@ + diff --git a/wp-content/themes/CCV/resources/assets/styles/components/headings.styl b/wp-content/themes/CCV/resources/assets/styles/components/headings.styl index 3400b28..ef15456 100644 --- a/wp-content/themes/CCV/resources/assets/styles/components/headings.styl +++ b/wp-content/themes/CCV/resources/assets/styles/components/headings.styl @@ -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 index 0000000..29904f8 --- /dev/null +++ b/wp-content/themes/CCV/resources/assets/styles/components/news.styl @@ -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% diff --git a/wp-content/themes/CCV/resources/views/index.blade.php b/wp-content/themes/CCV/resources/views/index.blade.php index a9760d1..e87293b 100644 --- a/wp-content/themes/CCV/resources/views/index.blade.php +++ b/wp-content/themes/CCV/resources/views/index.blade.php @@ -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 +
- {!! get_search_form(false) !!} - @endif +

{!! get_the_title(get_option('page_for_posts', true)) !!}

- @while (have_posts()) @php(the_post()) - @includeFirst(['partials.content-'.get_post_type(), 'partials.content']) - @endwhile +
- {!! 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() !!} + +
+ +
@endsection @section('sidebar') diff --git a/wp-content/themes/CCV/resources/views/partials/content.blade.php b/wp-content/themes/CCV/resources/views/partials/content.blade.php index c6b5bff..bc12184 100644 --- a/wp-content/themes/CCV/resources/views/partials/content.blade.php +++ b/wp-content/themes/CCV/resources/views/partials/content.blade.php @@ -1,15 +1,26 @@ -
+ diff --git a/wp-content/themes/CCV/resources/views/partials/entry-meta.blade.php b/wp-content/themes/CCV/resources/views/partials/entry-meta.blade.php index f218893..aeb8de2 100644 --- a/wp-content/themes/CCV/resources/views/partials/entry-meta.blade.php +++ b/wp-content/themes/CCV/resources/views/partials/entry-meta.blade.php @@ -2,9 +2,11 @@ {{ get_the_date() }} +{{-- +--}} diff --git a/wp-content/themes/CCV/tailwind.config.js b/wp-content/themes/CCV/tailwind.config.js index 1bbc389..5607fb2 100644 --- a/wp-content/themes/CCV/tailwind.config.js +++ b/wp-content/themes/CCV/tailwind.config.js @@ -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: {}, diff --git a/wp-content/themes/CCV/yarn.lock b/wp-content/themes/CCV/yarn.lock index e6237e4..f0e34d8 100644 --- a/wp-content/themes/CCV/yarn.lock +++ b/wp-content/themes/CCV/yarn.lock @@ -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" -- 2.39.5