diff --git a/composer.json b/composer.json index 0d260c0..92c67b3 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,8 @@ "wpackagist-plugin/contact-form-7": "^6.1", "wpackagist-plugin/flamingo": "^2.6", "wpackagist-plugin/resizable-editor-sidebar": "^1.02", - "wpengine/advanced-custom-fields-pro": "^6.5" + "wpengine/advanced-custom-fields-pro": "^6.5", + "ourcodeworld/name-that-color": "dev-master" }, "require-dev": { "roave/security-advisories": "dev-latest", diff --git a/composer.lock b/composer.lock index 95ccdc1..a96c4e0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "104ea3d29e936d8eff7dbc4db90cafe2", + "content-hash": "a99bd1262162472206d7c77290fa770a", "packages": [ { "name": "badegguk/bad-egg-digital-login-page", @@ -3484,6 +3484,55 @@ }, "time": "2024-12-03T01:02:28+00:00" }, + { + "name": "ourcodeworld/name-that-color", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/ourcodeworld/name-that-color.git", + "reference": "758b1f9b4b521da63f0ae4226e80cae620b0f648" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ourcodeworld/name-that-color/zipball/758b1f9b4b521da63f0ae4226e80cae620b0f648", + "reference": "758b1f9b4b521da63f0ae4226e80cae620b0f648", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "ourcodeworld\\NameThatColor\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "mit" + ], + "authors": [ + { + "name": "Carlos Delgado", + "email": "dev@ourcodeworld.com", + "homepage": "https://ourcodeworld.com" + } + ], + "description": "A non-official PHP port of the NTC JS library to find out the name of the closest matching color.", + "keywords": [ + "color converted", + "hex", + "hsl", + "name that color", + "rgb" + ], + "support": { + "issues": "https://github.com/ourcodeworld/name-that-color/issues", + "source": "https://github.com/ourcodeworld/name-that-color/tree/master" + }, + "time": "2018-08-03T18:14:49+00:00" + }, { "name": "phpoption/phpoption", "version": "1.9.3", @@ -7436,6 +7485,7 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { + "ourcodeworld/name-that-color": 20, "roave/security-advisories": 20 }, "prefer-stable": true, diff --git a/web/app/themes/badegg/app/ACF/Dynamic.php b/web/app/themes/badegg/app/ACF/Dynamic.php index 92b14f5..c9c9aac 100644 --- a/web/app/themes/badegg/app/ACF/Dynamic.php +++ b/web/app/themes/badegg/app/ACF/Dynamic.php @@ -33,12 +33,6 @@ class Dynamic $field['choices'][$slug] = ' ' . @$NameThatColour->name($hex)['name']; endforeach; - $field['choices']['quaternary-white'] = ' ' . @$NameThatColour->name($colour->name2hex('quaternary'))['name'] . ' to White'; - $field['choices']['quinary-white'] = ' ' . @$NameThatColour->name($colour->name2hex('quinary'))['name'] . ' to White'; - - $field['choices']['white-quaternary'] = ' White to ' . @$NameThatColour->name($colour->name2hex('quaternary'))['name']; - $field['choices']['white-quinary'] = ' White to ' . @$NameThatColour->name($colour->name2hex('quinary'))['name']; - return $field; } diff --git a/web/app/themes/badegg/app/PostTypes/Driver.php b/web/app/themes/badegg/app/PostTypes/Driver.php deleted file mode 100644 index a60ebb4..0000000 --- a/web/app/themes/badegg/app/PostTypes/Driver.php +++ /dev/null @@ -1,71 +0,0 @@ - [ - 'featured_image' => __('Portrait', $td), - ], - 'menu_position' => 40, - 'supports' => [ - 'title', - 'excerpt', - 'thumbnail', - 'page-attributes', - ], - 'menu_icon' => 'dashicons-car', - 'rewrite' => false, - 'has_archive' => false, - 'publicly_queryable' => false, - 'exclude_from_search' => true, - 'capability_type' => 'page', - 'show_in_nav_menus' => false, - 'admin_cols' => [ - 'credentials' =>[ - 'title' => __('Credentials', $td), - 'meta_key' => 'badegg_driver_credentials', - ], - 'driver_category' => [ - 'title' => __('Category', $td), - 'taxonomy' => 'driver_category', - ], - 'portrait' => [ - 'title' => __('Portrait', $td), - 'featured_image' => 'thumbnail', - 'width' => 48, - // 'height' => 48, - ], - ], - ], - ); - - register_extended_taxonomy( - 'driver_category', - $postType, - [ - // 'meta_box' => 'radio', - 'rewrite' => false, - 'publicly_queryable' => false, - 'show_in_nav_menus' => false, - ], - [ - 'singular' => __('Category', $td), - 'plural' => __('Categories', $td), - ] - ); - } -} diff --git a/web/app/themes/badegg/composer.json b/web/app/themes/badegg/composer.json index 97e64d1..790cd18 100644 --- a/web/app/themes/badegg/composer.json +++ b/web/app/themes/badegg/composer.json @@ -35,7 +35,8 @@ }, "autoload": { "psr-4": { - "App\\": "app/" + "App\\": "app/", + "Blocks\\": "resources/views/blocks" } }, "require": { diff --git a/web/app/themes/badegg/functions.php b/web/app/themes/badegg/functions.php index 6078344..7847f51 100644 --- a/web/app/themes/badegg/functions.php +++ b/web/app/themes/badegg/functions.php @@ -59,11 +59,7 @@ function autoload_psr4($name) { } function autoload_psr4_blocks() { - $blockDir = __dir__ . '/resources/views/blocks'; - - if(!is_dir($blockDir)) return; - - $path = $blockDir . '/*'; + $path = __dir__ . '/resources/views/blocks/*'; $namespace = 'Blocks\\'; foreach(glob($path, GLOB_ONLYDIR) as $directory) { diff --git a/web/app/themes/badegg/resources/acf/group_block_wysiwyg.json b/web/app/themes/badegg/resources/acf/group_block_wysiwyg.json new file mode 100644 index 0000000..a69df4b --- /dev/null +++ b/web/app/themes/badegg/resources/acf/group_block_wysiwyg.json @@ -0,0 +1,156 @@ +{ + "key": "group_block_wysiwyg", + "title": "Block: WYSIWYG", + "fields": [ + { + "key": "field_68334c31c5faf", + "label": "Introduction", + "name": "introduction", + "aria-label": "", + "type": "clone", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "clone": [ + "group_clone_block_intro" + ], + "display": "seamless", + "layout": "block", + "prefix_label": 0, + "prefix_name": 0 + }, + { + "key": "field_68334c31c63fc", + "label": "Content", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 1, + "multi_expand": 0, + "endpoint": 0 + }, + { + "key": "field_68334c31c6fab", + "label": "", + "name": "wysiwyg", + "aria-label": "", + "type": "wysiwyg", + "instructions": "All drivers will be displayed if no category is selected.", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_68334c31c67cb", + "operator": "==", + "value": "local" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "allow_in_bindings": 0, + "tabs": "all", + "toolbar": "basic", + "media_upload": 0, + "delay": 0 + }, + { + "key": "field_68334c31c738b", + "label": "Content", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 1 + }, + { + "key": "field_68334c31c7775", + "label": "Footer", + "name": "footer", + "aria-label": "", + "type": "clone", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "clone": [ + "group_clone_block_footer" + ], + "display": "seamless", + "layout": "block", + "prefix_label": 0, + "prefix_name": 0 + }, + { + "key": "field_68334c31c7b66", + "label": "Settings", + "name": "settings", + "aria-label": "", + "type": "clone", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "clone": [ + "group_clone_block_settings" + ], + "display": "seamless", + "layout": "block", + "prefix_label": 0, + "prefix_name": 0 + } + ], + "location": [ + [ + { + "param": "block", + "operator": "==", + "value": "acf\/badegg-wysiwyg" + } + ] + ], + "menu_order": 0, + "position": "normal", + "style": "default", + "label_placement": "top", + "instruction_placement": "label", + "hide_on_screen": "", + "active": true, + "description": "", + "show_in_rest": 0, + "modified": 1748193022 +} diff --git a/web/app/themes/badegg/resources/acf/group_clone_background_settings.json b/web/app/themes/badegg/resources/acf/group_clone_background_settings.json new file mode 100644 index 0000000..7b63f06 --- /dev/null +++ b/web/app/themes/badegg/resources/acf/group_clone_background_settings.json @@ -0,0 +1,126 @@ +{ + "key": "group_clone_background_settings", + "title": "Clone: Background Settings", + "fields": [ + { + "key": "field_67325dd23234e", + "label": "Background Colour", + "name": "bg_colour", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "50", + "class": "", + "id": "" + }, + "choices": { + "primary": "<\/i> Prussian Blue", + "secondary": "<\/i> Sunset Orange", + "tertiary": "<\/i> Gold", + "quaternary": "<\/i> Moody Blue", + "quinary": "<\/i> Frangipani", + "0": "<\/i> White", + "black": "<\/i> Black", + "quaternary-white": "<\/i> Moody Blue to White", + "quinary-white": "<\/i> Frangipani to White", + "white-quaternary": "<\/i> White to Moody Blue", + "white-quinary": "<\/i> White to Frangipani" + }, + "default_value": 0, + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, + "ui": 1, + "ajax": 0, + "placeholder": "", + "create_options": 0, + "save_options": 0 + }, + { + "key": "field_67325e213234f", + "label": "Background Tint", + "name": "bg_tint", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "50", + "class": "", + "id": "" + }, + "choices": { + "lightest": "Lightest", + "lighter": "Lighter", + "light": "Light", + "0": "None", + "dark": "Dark", + "darker": "Darker", + "darkest": "Darkest" + }, + "default_value": 0, + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, + "ui": 1, + "ajax": 0, + "placeholder": "", + "create_options": 0, + "save_options": 0 + }, + { + "key": "field_67350f526abf1", + "label": "Text Contrast", + "name": "contrast", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "choices": { + "0": "Auto", + "dark": "Force dark text", + "light": "Force light text" + }, + "default_value": 0, + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "ui": 0, + "ajax": 0, + "placeholder": "", + "create_options": 0, + "save_options": 0 + } + ], + "location": [ + [ + { + "param": "widget", + "operator": "==", + "value": "rss" + } + ] + ], + "menu_order": 0, + "position": "normal", + "style": "default", + "label_placement": "top", + "instruction_placement": "label", + "hide_on_screen": "", + "active": true, + "description": "", + "show_in_rest": 0, + "modified": 1748194684 +} diff --git a/web/app/themes/badegg/resources/acf/group_clone_block_footer.json b/web/app/themes/badegg/resources/acf/group_clone_block_footer.json new file mode 100644 index 0000000..aa0605d --- /dev/null +++ b/web/app/themes/badegg/resources/acf/group_clone_block_footer.json @@ -0,0 +1,158 @@ +{ + "key": "group_clone_block_footer", + "title": "Clone: Block Footer", + "fields": [ + { + "key": "field_67659b49a6db2", + "label": "Footer", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 0 + }, + { + "key": "field_67659b49a754a", + "label": "Blurb", + "name": "blurb_footer", + "aria-label": "", + "type": "textarea", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "maxlength": "", + "rows": 3, + "placeholder": "", + "new_lines": "" + }, + { + "key": "field_67659b7502137", + "label": "Links", + "name": "links", + "aria-label": "", + "type": "repeater", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "layout": "block", + "pagination": 0, + "min": 0, + "max": 2, + "collapsed": "", + "button_label": "Add Button", + "rows_per_page": 20, + "sub_fields": [ + { + "key": "field_67659b8702138", + "label": "Button", + "name": "button", + "aria-label": "", + "type": "clone", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "clone": [ + "group_clone_button" + ], + "display": "seamless", + "layout": "block", + "prefix_label": 0, + "prefix_name": 0, + "parent_repeater": "field_67659b7502137" + } + ] + }, + { + "key": "field_682fb9ff58080", + "label": "Alignment", + "name": "footer_alignment", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "choices": { + "centre": "Centre", + "left": "Left", + "right": "Right" + }, + "default_value": "centre", + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 0, + "ui": 0, + "ajax": 0, + "placeholder": "", + "create_options": 0, + "save_options": 0 + }, + { + "key": "field_6828dac95eb68", + "label": "Footer (end)", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 1 + } + ], + "location": [ + [ + { + "param": "widget", + "operator": "==", + "value": "rss" + } + ] + ], + "menu_order": 0, + "position": "normal", + "style": "default", + "label_placement": "top", + "instruction_placement": "label", + "hide_on_screen": "", + "active": true, + "description": "", + "show_in_rest": 0, + "modified": 1747958307 +} diff --git a/web/app/themes/badegg/resources/acf/group_clone_block_intro.json b/web/app/themes/badegg/resources/acf/group_clone_block_intro.json new file mode 100644 index 0000000..fb9ab40 --- /dev/null +++ b/web/app/themes/badegg/resources/acf/group_clone_block_intro.json @@ -0,0 +1,153 @@ +{ + "key": "group_clone_block_intro", + "title": "Clone: Block Intro", + "fields": [ + { + "key": "field_67659970db415", + "label": "Introduction", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 0 + }, + { + "key": "field_682fb8d9f6f3f", + "label": "Overline", + "name": "overline", + "aria-label": "", + "type": "text", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "maxlength": "", + "allow_in_bindings": 0, + "placeholder": "", + "prepend": "", + "append": "" + }, + { + "key": "field_676599964d3cc", + "label": "Heading", + "name": "heading", + "aria-label": "", + "type": "textarea", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "hfont", + "id": "" + }, + "default_value": "", + "maxlength": "", + "allow_in_bindings": 0, + "rows": 2, + "placeholder": "", + "new_lines": "br" + }, + { + "key": "field_6765999d4d3cd", + "label": "Blurb", + "name": "blurb", + "aria-label": "", + "type": "textarea", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "maxlength": "", + "rows": 3, + "placeholder": "", + "new_lines": "" + }, + { + "key": "field_682fb9add5a3b", + "label": "Alignment", + "name": "intro_alignment", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "choices": { + "centre": "Centre", + "left": "Left", + "right": "Right" + }, + "default_value": "centre", + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 0, + "ui": 0, + "ajax": 0, + "placeholder": "", + "create_options": 0, + "save_options": 0 + }, + { + "key": "field_6828dae1d1bb0", + "label": "Intro (end)", + "name": "", + "aria-label": "", + "type": "accordion", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "open": 0, + "multi_expand": 0, + "endpoint": 1 + } + ], + "location": [ + [ + { + "param": "widget", + "operator": "==", + "value": "rss" + } + ] + ], + "menu_order": 0, + "position": "normal", + "style": "default", + "label_placement": "top", + "instruction_placement": "label", + "hide_on_screen": "", + "active": true, + "description": "", + "show_in_rest": 0, + "modified": 1747958910 +} diff --git a/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.blade.php b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.blade.php new file mode 100644 index 0000000..df8453e --- /dev/null +++ b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.blade.php @@ -0,0 +1,13 @@ +@extends('layouts.block', [ + 'block' => $block, + 'data' => $data, +]) + +@section('block-content') + @if(@$data['wysiwyg']) +
+ {!! @$data['wysiwyg'] !!} +
+ @endif +@overwrite + diff --git a/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.jpg b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.jpg new file mode 100644 index 0000000..5141cda Binary files /dev/null and b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.jpg differ diff --git a/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.php b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.php new file mode 100644 index 0000000..ed45393 --- /dev/null +++ b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.php @@ -0,0 +1,74 @@ + 'badegg/wysiwyg', + 'title' => __('Basic Content'), + 'description' => __('Basic text editor '), + 'render_callback' => [ $this, 'render'], + 'category' => 'badegg', + 'icon' => 'editor-paragraph', + 'supports' => [ + 'align' => false, + ], + 'example' => [ + 'attributes' => [ + 'mode' => 'preview', + 'data' => [ + 'inserter' => true, + ], + ], + ], + ]); + } + + public function render($block, $content = '', $is_preview = false) + { + $name = basename(__FILE__, '.php'); + $themeURL = get_template_directory_uri(); + + if($is_preview && @$block['data']['inserter']): + echo ''; + return; + endif; + + $CssClasses = new Utilities\CssClasses; + $Colour = new Utilities\Colour; + $CloneGroup = new ACF\CloneGroup; + + $data = []; + + $fields = [ + 'wysiwyg', + ]; + $fields = array_merge($fields, $CloneGroup->block_all()); + + foreach($fields as $field): + $data[$field] = get_field($field); + endforeach; + + unset($block['data']); + $block['name'] = str_replace('acf/', '', $block['name']); + + $data = array_merge($data, $block); + $data['section_classes'] = $CssClasses->section($data); + $data['block'] = $block; + + echo \Roots\view("blocks.$name.$name", [ + 'data' => $data, + 'block' => $block, + ])->render(); + } +} diff --git a/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.scss b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.scss new file mode 100644 index 0000000..ef53f17 --- /dev/null +++ b/web/app/themes/badegg/resources/views/blocks/WYSIWYG/WYSIWYG.scss @@ -0,0 +1,13 @@ +.section-badegg-wysiwyg { + container-name: WYSIWYG; + container-type: inline-size; + + .main-wysiwyg { + @container WYSIWYG (min-width: #{$screen-lg}) { + font-size: 1.25em; + } + } + + .section-intro { padding-bottom: $sectionSmall; } + .section-footer { padding-top: $sectionSmall; } +} diff --git a/web/app/themes/badegg/resources/views/layouts/block.blade.php b/web/app/themes/badegg/resources/views/layouts/block.blade.php new file mode 100644 index 0000000..67edc95 --- /dev/null +++ b/web/app/themes/badegg/resources/views/layouts/block.blade.php @@ -0,0 +1,73 @@ +@if(@$data['section_anchor_id']) +
+@endif + +
+ +
+ @if(@$data['heading'] || @$data['blurb']) +
+
+ @if(@$data['overline'])

{{ $data['overline'] }}

@endif +

{{ @$data['heading'] }}

+

{{ @$data['blurb'] }}

+
+
+ @endif + +
+ @yield('block-content') +
+ + @if(@$data['links'] || @$data['blurb_footer']) + + @endif + + @if(@$data['bg_image']) +
+ {!! $ImageSrcset->render([ + 'image' => $data['bg_image'], + 'name' => 'hero', + 'lazy' => true, + ]) !!} +
+ @endif +
+ + @if(@$data['angle_status']) + @if(@$data['angle_position'] == 'both') + @foreach(['top', 'bottom'] as $position) + @include('partials.angle', [ + 'position' => $position, + 'direction' => @$data['angle_direction'], + 'tint' => @$data['angle_tint'], + 'colour' => @$data['angle_colour'] ?: 'white', + ]) + @endforeach + @else + @include('partials.angle', [ + 'position' => @$data['angle_position'], + 'direction' => @$data['angle_direction'], + 'tint' => @$data['angle_tint'], + 'colour' => @$data['angle_colour'] ?: 'white', + ]) + @endif + @endif + +