From c3965c027f37ce2ee013bf4f1aed0c06725bab34 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 29 May 2025 15:40:03 +0100 Subject: [PATCH] Style local tasks Based on https://flowbite.com/docs/components/tabs. --- .../block--local-tasks-block.html.twig | 43 +++++++++++++++++++ .../templates/menu-local-task.html.twig | 19 ++++++++ .../templates/menu-local-tasks.html.twig | 28 ++++++++++++ todo.txt | 1 - 4 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 themes/opdavies/templates/block--local-tasks-block.html.twig create mode 100644 themes/opdavies/templates/menu-local-task.html.twig create mode 100644 themes/opdavies/templates/menu-local-tasks.html.twig diff --git a/themes/opdavies/templates/block--local-tasks-block.html.twig b/themes/opdavies/templates/block--local-tasks-block.html.twig new file mode 100644 index 000000000..38a719835 --- /dev/null +++ b/themes/opdavies/templates/block--local-tasks-block.html.twig @@ -0,0 +1,43 @@ +{# +/** + * @file + * Default theme implementation 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() + * + * @ingroup themeable + */ +#} + + {{ title_prefix }} + + {% if label %} + {{ label }} + {% endif %} + + {{ title_suffix }} + + {% block content %} + {{ content }} + {% endblock %} + diff --git a/themes/opdavies/templates/menu-local-task.html.twig b/themes/opdavies/templates/menu-local-task.html.twig new file mode 100644 index 000000000..5517db09d --- /dev/null +++ b/themes/opdavies/templates/menu-local-task.html.twig @@ -0,0 +1,19 @@ +{# +/** + * @file + * Default theme implementation for a local task link. + * + * Available variables: + * - attributes: HTML attributes for the wrapper element. + * - is_active: Whether the task item is an active tab. + * - link: A rendered link element. + * + * Note: This template renders the content for each task item in + * menu-local-tasks.html.twig. + * + * @see template_preprocess_menu_local_task() + * + * @ingroup themeable + */ +#} +{{ link|add_class('inline-block p-4 border-b-2 border-transparent rounded-t-lg hover:text-blue-primary hover:border-blue-primary dark:hover:text-gray-300') }} diff --git a/themes/opdavies/templates/menu-local-tasks.html.twig b/themes/opdavies/templates/menu-local-tasks.html.twig new file mode 100644 index 000000000..e2ccab128 --- /dev/null +++ b/themes/opdavies/templates/menu-local-tasks.html.twig @@ -0,0 +1,28 @@ +{# +/** + * @file + * Default theme implementation to display primary and secondary local tasks. + * + * Available variables: + * - primary: HTML list items representing primary tasks. + * - secondary: HTML list items representing secondary tasks. + * + * Each item in these variables (primary and secondary) can be individually + * themed in menu-local-task.html.twig. + * + * @ingroup themeable + */ +#} +{% if primary %} +
+

{{ 'Primary tabs'|t }}

+
    {{ primary }}
+
+{% endif %} + +{% if secondary %} +
+

{{ 'Secondary tabs'|t }}

+
    {{ secondary }}
+
+{% endif %} diff --git a/todo.txt b/todo.txt index 7987ed6f7..d709a8438 100644 --- a/todo.txt +++ b/todo.txt @@ -36,7 +36,6 @@ General: - Recreate the "About me" block in Drupal. - Migrate redirects to be managed by the Redirect module. -- Style local actions links (View, Edit, etc). - Make the "Years of experience" dynamic. - Add PHPStan. - Add phpcs.