From f3ff716a0877e0f453dfd4af0d445eb78739fdd7 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 13 Apr 2024 15:51:19 +0100 Subject: [PATCH] Fix layout pages with Tailwind CSS dark mode --- .../block/block--layout-builder.html.twig | 39 +++++++++++++++++++ .../templates/forms/container.html.twig | 29 ++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 web/themes/custom/opdavies/templates/block/block--layout-builder.html.twig create mode 100644 web/themes/custom/opdavies/templates/forms/container.html.twig diff --git a/web/themes/custom/opdavies/templates/block/block--layout-builder.html.twig b/web/themes/custom/opdavies/templates/block/block--layout-builder.html.twig new file mode 100644 index 0000000..1f5f7d5 --- /dev/null +++ b/web/themes/custom/opdavies/templates/block/block--layout-builder.html.twig @@ -0,0 +1,39 @@ +{# +/** + * @file + * Theme override to display a block. + * + * Available variables: + * - plugin_id: The ID of the block implementation. + * - label: The configured label of the block if visible. + * - configuration: A list of the block's configuration values. + * - label: The configured label for the block. + * - label_display: The display settings for the label. + * - provider: The module or other provider that provided this block plugin. + * - Block plugin specific settings will also be stored here. + * - in_preview: Whether the plugin is being rendered in preview mode. + * - content: The content of this block. + * - attributes: array of HTML attributes populated by modules, intended to + * be added to the main container tag of this template. + * - id: A valid HTML ID and guaranteed unique. + * - title_attributes: Same as attributes, except applied to the main title + * tag that appears in the template. + * - title_prefix: Additional output populated by modules, intended to be + * displayed in front of the main title tag that appears in the template. + * - title_suffix: Additional output populated by modules, intended to be + * displayed after the main title tag that appears in the template. + * + * @see template_preprocess_block() + */ +#} + + {{ title_prefix }} + {% if label %} + {{ label }} + {% endif %} + {{ title_suffix }} + + {% block content %} + {{ content }} + {% endblock %} + diff --git a/web/themes/custom/opdavies/templates/forms/container.html.twig b/web/themes/custom/opdavies/templates/forms/container.html.twig new file mode 100644 index 0000000..a904de5 --- /dev/null +++ b/web/themes/custom/opdavies/templates/forms/container.html.twig @@ -0,0 +1,29 @@ +{# +/** + * @file + * Theme override of a container used to wrap child elements. + * + * Used for grouped form items. Can also be used as a theme wrapper for any + * renderable element, to surround it with a
and HTML attributes. + * See \Drupal\Core\Render\Element\RenderElement for more + * information on the #theme_wrappers render array property, and + * \Drupal\Core\Render\Element\container for usage of the container render + * element. + * + * Available variables: + * - attributes: HTML attributes for the containing element. + * - children: The rendered child elements of the container. + * - has_parent: A flag to indicate that the container has one or more parent + containers. + * + * @see template_preprocess_container() + */ +#} +{% + set classes = [ + 'dark:bg-gray-900 [&>a]:text-white', + has_parent ? 'js-form-wrapper', + has_parent ? 'form-wrapper', + ] +%} +{{ children }}