From 11427aa4afbf616cbfe524dc000ec516050108d5 Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Wed, 25 Nov 2020 19:25:33 +0100 Subject: [PATCH] WIP #4064 @8 --- .gitignore | 1 + web/app/mu-plugins/cube-loader.php | 30 ++++++ web/app/mu-plugins/cube/.gitignore | 1 + web/app/mu-plugins/cube/composer.json | 10 ++ web/app/mu-plugins/cube/src/Common/Setup.php | 14 +++ .../mu-plugins/cube/src/Elementor/Setup.php | 34 +++++++ .../cube/src/Elementor/Widgets/_Base.php | 97 +++++++++++++++++++ web/app/mu-plugins/cube/src/Init.php | 42 ++++++++ web/app/themes/Usines/app/helpers.php | 4 +- web/app/themes/Usines/app/setup.php | 28 ++++-- web/app/themes/Usines/index.php | 2 +- .../resources/assets/images/icons/email.svg | 1 + .../assets/images/icons/facebook.svg | 1 + .../assets/images/icons/instagram.svg | 1 + .../assets/images/icons/linkedin.svg | 1 + .../assets/images/icons/phone-circle.svg | 1 + .../resources/assets/images/icons/phone.svg | 1 + .../Usines/resources/assets/images/logo.svg | 51 +--------- .../Usines/resources/assets/styles/app.styl | 2 +- .../resources/assets/styles/common/setup.styl | 2 +- .../assets/styles/components/footer.styl | 5 + .../assets/styles/components/navigation.styl | 46 +++++++++ .../resources/views/partials/footer.blade.php | 30 +++++- .../resources/views/partials/header.blade.php | 53 +++++++--- .../views/partials/page-header.blade.php | 2 + .../views/partials/social-networks.blade.php | 5 + web/app/themes/Usines/webpack.mix.js | 2 +- 27 files changed, 389 insertions(+), 78 deletions(-) create mode 100644 web/app/mu-plugins/cube-loader.php create mode 100644 web/app/mu-plugins/cube/.gitignore create mode 100644 web/app/mu-plugins/cube/composer.json create mode 100644 web/app/mu-plugins/cube/src/Common/Setup.php create mode 100644 web/app/mu-plugins/cube/src/Elementor/Setup.php create mode 100644 web/app/mu-plugins/cube/src/Elementor/Widgets/_Base.php create mode 100644 web/app/mu-plugins/cube/src/Init.php create mode 100644 web/app/themes/Usines/resources/assets/images/icons/email.svg create mode 100644 web/app/themes/Usines/resources/assets/images/icons/facebook.svg create mode 100644 web/app/themes/Usines/resources/assets/images/icons/instagram.svg create mode 100644 web/app/themes/Usines/resources/assets/images/icons/linkedin.svg create mode 100644 web/app/themes/Usines/resources/assets/images/icons/phone-circle.svg create mode 100644 web/app/themes/Usines/resources/assets/images/icons/phone.svg create mode 100644 web/app/themes/Usines/resources/assets/styles/components/footer.styl create mode 100644 web/app/themes/Usines/resources/assets/styles/components/navigation.styl create mode 100644 web/app/themes/Usines/resources/views/partials/social-networks.blade.php diff --git a/.gitignore b/.gitignore index 9a5e483..6086587 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ _doc web/app/plugins/* !web/app/plugins/.gitkeep web/app/mu-plugins/*/ +!web/app/mu-plugins/cube web/app/upgrade web/app/uploads/* !web/app/uploads/.gitkeep diff --git a/web/app/mu-plugins/cube-loader.php b/web/app/mu-plugins/cube-loader.php new file mode 100644 index 0000000..ede46dd --- /dev/null +++ b/web/app/mu-plugins/cube-loader.php @@ -0,0 +1,30 @@ +widgets_manager->register_widget_type( new Widgets\SolutionGrid() ); + } + + + // Ref: https://developers.elementor.com/widget-categories/ + /* @var $manager \Elementor\Elements_Manager */ + public function register_widgets_category($manager) { + $manager->add_category('cube', ['title' => 'Cubedesigners']); + } + +} diff --git a/web/app/mu-plugins/cube/src/Elementor/Widgets/_Base.php b/web/app/mu-plugins/cube/src/Elementor/Widgets/_Base.php new file mode 100644 index 0000000..8ec94b3 --- /dev/null +++ b/web/app/mu-plugins/cube/src/Elementor/Widgets/_Base.php @@ -0,0 +1,97 @@ +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->add_control( + 'padding_top', + [ + 'label' => __('Top Padding', 'cube'), + 'type' => Controls_Manager::SELECT, + 'options' => [ + '' => __( 'Défaut', 'cube' ), + 'pt-0' => '0', + 'pt-1v' => '2.5%', + 'pt-2v' => '5%', + 'pt-3v' => '7.5%', + 'pt-4v' => '10%', + ], + 'default' => '', + 'prefix_class' => '', // Use the full value as the classname + 'separator' => 'before', + ] + ); + + $this->add_control( + 'padding_bottom', + [ + 'label' => __('Bottom Padding', 'cube'), + 'type' => Controls_Manager::SELECT, + 'options' => [ + '' => __( 'Défaut', 'cube' ), + 'pb-0' => '0', + 'pb-1v' => '2.5%', + 'pb-2v' => '5%', + 'pb-3v' => '7.5%', + 'pb-4v' => '10%', + ], + 'default' => '', + 'prefix_class' => '', // Use the full value as the classname + ] + ); + + $this->end_controls_section(); + + } + +} diff --git a/web/app/mu-plugins/cube/src/Init.php b/web/app/mu-plugins/cube/src/Init.php new file mode 100644 index 0000000..e93ae26 --- /dev/null +++ b/web/app/mu-plugins/cube/src/Init.php @@ -0,0 +1,42 @@ +register(); + } + } + } + + /** + * @param class $class Class from the services array + * @return class instance New instance of the class + */ + private static function instantiate($class) { + return new $class(); + } +} diff --git a/web/app/themes/Usines/app/helpers.php b/web/app/themes/Usines/app/helpers.php index 29abe33..0583e0d 100644 --- a/web/app/themes/Usines/app/helpers.php +++ b/web/app/themes/Usines/app/helpers.php @@ -7,7 +7,7 @@ namespace App; // Grid overlay helper, activated when DEBUG_GRID is defined as true -if (env('DEBUG_GRID')) { +if (env('DEBUG_GRID') || isset($_GET['debug-grid'])) { add_action('wp_footer', function () { $css = 'background-size: 2.5vw 2.5vw;'; $css .= 'background-image: linear-gradient(to right, grey 1px, transparent 1px), linear-gradient(to bottom, grey 1px, transparent 1px);'; @@ -18,7 +18,7 @@ if (env('DEBUG_GRID')) { } // Draw centre line on layout -if (env('DEBUG_CENTER')) { +if (env('DEBUG_CENTER') || isset($_GET['debug-center'])) { add_action('wp_footer', function () { $css = 'width: 1px;'; $css .= 'background-color: #fc0;'; // Base line colour diff --git a/web/app/themes/Usines/app/setup.php b/web/app/themes/Usines/app/setup.php index ec09cc6..0544797 100755 --- a/web/app/themes/Usines/app/setup.php +++ b/web/app/themes/Usines/app/setup.php @@ -87,7 +87,8 @@ add_action('after_setup_theme', function () { * @link https://developer.wordpress.org/reference/functions/register_nav_menus/ */ register_nav_menus([ - 'primary_navigation' => __('Primary Navigation', 'sage') + 'primary_navigation_left' => __('Navigation Primaire (gauche)', 'usines'), + 'primary_navigation_right' => __('Navigation Primaire (droite)', 'usines'), ]); /** @@ -156,12 +157,23 @@ add_action('widgets_init', function () { ]; register_sidebar([ - 'name' => __('Primary', 'sage'), - 'id' => 'sidebar-primary' - ] + $config); - + 'name' => __('Footer Column 1', 'usines'), + 'id' => 'sidebar-footer-1' + ] + $config); + register_sidebar([ + 'name' => __('Footer Column 2', 'usines'), + 'id' => 'sidebar-footer-2' + ] + $config); + register_sidebar([ + 'name' => __('Footer Column 3', 'usines'), + 'id' => 'sidebar-footer-3' + ] + $config); + register_sidebar([ + 'name' => __('Footer Column 4', 'usines'), + 'id' => 'sidebar-footer-4' + ] + $config); register_sidebar([ - 'name' => __('Footer', 'sage'), - 'id' => 'sidebar-footer' - ] + $config); + 'name' => __('Footer Copyright', 'usines'), + 'id' => 'sidebar-footer-copyright' + ] + $config); }); diff --git a/web/app/themes/Usines/index.php b/web/app/themes/Usines/index.php index 4c4f282..5028d8f 100644 --- a/web/app/themes/Usines/index.php +++ b/web/app/themes/Usines/index.php @@ -10,7 +10,7 @@ - > + > diff --git a/web/app/themes/Usines/resources/assets/images/icons/email.svg b/web/app/themes/Usines/resources/assets/images/icons/email.svg new file mode 100644 index 0000000..c47fdf1 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/images/icons/email.svg @@ -0,0 +1 @@ + diff --git a/web/app/themes/Usines/resources/assets/images/icons/facebook.svg b/web/app/themes/Usines/resources/assets/images/icons/facebook.svg new file mode 100644 index 0000000..d6ea8fe --- /dev/null +++ b/web/app/themes/Usines/resources/assets/images/icons/facebook.svg @@ -0,0 +1 @@ + diff --git a/web/app/themes/Usines/resources/assets/images/icons/instagram.svg b/web/app/themes/Usines/resources/assets/images/icons/instagram.svg new file mode 100644 index 0000000..2876e1c --- /dev/null +++ b/web/app/themes/Usines/resources/assets/images/icons/instagram.svg @@ -0,0 +1 @@ + diff --git a/web/app/themes/Usines/resources/assets/images/icons/linkedin.svg b/web/app/themes/Usines/resources/assets/images/icons/linkedin.svg new file mode 100644 index 0000000..faaf8d3 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/images/icons/linkedin.svg @@ -0,0 +1 @@ + diff --git a/web/app/themes/Usines/resources/assets/images/icons/phone-circle.svg b/web/app/themes/Usines/resources/assets/images/icons/phone-circle.svg new file mode 100644 index 0000000..6ec4ff4 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/images/icons/phone-circle.svg @@ -0,0 +1 @@ + diff --git a/web/app/themes/Usines/resources/assets/images/icons/phone.svg b/web/app/themes/Usines/resources/assets/images/icons/phone.svg new file mode 100644 index 0000000..f93fa84 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/images/icons/phone.svg @@ -0,0 +1 @@ + diff --git a/web/app/themes/Usines/resources/assets/images/logo.svg b/web/app/themes/Usines/resources/assets/images/logo.svg index 5c2c229..bad5d9b 100644 --- a/web/app/themes/Usines/resources/assets/images/logo.svg +++ b/web/app/themes/Usines/resources/assets/images/logo.svg @@ -1,50 +1 @@ - - - - - - + diff --git a/web/app/themes/Usines/resources/assets/styles/app.styl b/web/app/themes/Usines/resources/assets/styles/app.styl index 2094ce8..083b7b7 100644 --- a/web/app/themes/Usines/resources/assets/styles/app.styl +++ b/web/app/themes/Usines/resources/assets/styles/app.styl @@ -9,7 +9,7 @@ // Extracted components or custom styles that can't be done with utilities @import 'common/global' -//@import 'components/*' +@import 'components/*' //@import 'pages/*' // Allow spacing classes to override others defined here diff --git a/web/app/themes/Usines/resources/assets/styles/common/setup.styl b/web/app/themes/Usines/resources/assets/styles/common/setup.styl index 505286d..7699ebf 100644 --- a/web/app/themes/Usines/resources/assets/styles/common/setup.styl +++ b/web/app/themes/Usines/resources/assets/styles/common/setup.styl @@ -14,7 +14,7 @@ $vertical-gutter = 5vw // Breakpoints in Rupture (https://github.com/jescalan/rupture) $breakpoint-columns = 768px // NOTE: this should align with the 'sm' screen value in tailwind.config.js -$breakpoint-menu = 1024px // This needs to match the MMenu activation setting in menu.js +$breakpoint-menu = 1180px // This needs to match the MMenu activation setting in menu.js rupture.scale = 0 400px 768px 1024px rupture.scale-names = 'small' 'medium' 'large' rupture.anti-overlap = -1px // Results in +below(1000px) being max-width: 999px and +above(1000px) being min-width: 1000px diff --git a/web/app/themes/Usines/resources/assets/styles/components/footer.styl b/web/app/themes/Usines/resources/assets/styles/components/footer.styl new file mode 100644 index 0000000..9a2e532 --- /dev/null +++ b/web/app/themes/Usines/resources/assets/styles/components/footer.styl @@ -0,0 +1,5 @@ +.footer-logo + max-width: 156px + + path + fill: currentColor diff --git a/web/app/themes/Usines/resources/assets/styles/components/navigation.styl b/web/app/themes/Usines/resources/assets/styles/components/navigation.styl new file mode 100644 index 0000000..bd3239f --- /dev/null +++ b/web/app/themes/Usines/resources/assets/styles/components/navigation.styl @@ -0,0 +1,46 @@ +.nav-logo + @apply mx-20 + max-width: 156px + + +below(1600px) + @apply mx-16 + +below(1500px) + @apply mx-12 + max-width: 140px + +below(1380px) + @apply mx-10 + max-width: 120px + +.nav-primary + + +below($breakpoint-menu) + display: none !important + + .menu-list + @apply flex + + .menu-item + @apply text-lg font-medium + @apply mx-8 + + +below(1600px) + @apply mx-6 + +below(1500px) + @apply mx-4 + +below(1380px) + @apply text-base + + &.current-menu-item, &.current-menu-parent + @apply text-red + + &:first-child + @apply ml-0 + &:last-child + @apply mr-0 + + a + @apply whitespace-no-wrap + transition: color 0.2s + + &:hover + @apply text-red diff --git a/web/app/themes/Usines/resources/views/partials/footer.blade.php b/web/app/themes/Usines/resources/views/partials/footer.blade.php index ee9095c..c63f4cd 100644 --- a/web/app/themes/Usines/resources/views/partials/footer.blade.php +++ b/web/app/themes/Usines/resources/views/partials/footer.blade.php @@ -1,5 +1,29 @@ -