Fix layout pages with Tailwind CSS dark mode

This commit is contained in:
Oliver Davies 2024-04-13 15:51:19 +01:00
parent c50bd8e32c
commit f3ff716a08
2 changed files with 68 additions and 0 deletions

View file

@ -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()
*/
#}
<div{{ attributes.addClass('dark:bg-gray-900') }}>
{{ title_prefix }}
{% if label %}
<h2{{ title_attributes.addClass('mb-4 text-xl font-bold') }}>{{ label }}</h2>
{% endif %}
{{ title_suffix }}
{% block content %}
{{ content }}
{% endblock %}
</div>

View file

@ -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 <div> 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',
]
%}
<div{{ attributes.addClass(classes) }}>{{ children }}</div>