Testimonial, about me styling and other layout

...changes
This commit is contained in:
Oliver Davies 2024-04-04 18:00:00 +01:00
parent a190cc67f7
commit 061a951770
13 changed files with 427 additions and 28 deletions

View file

@ -6,9 +6,15 @@ dependencies:
- block_content.type.about_me
- field.field.block_content.about_me.body
- field.field.block_content.about_me.field_image
- image.style.thumbnail
module:
- image
- layout_builder
- text
third_party_settings:
layout_builder:
enabled: false
allow_custom: false
id: block_content.about_me.default
targetEntityType: block_content
bundle: about_me
@ -26,7 +32,7 @@ content:
label: hidden
settings:
image_link: ''
image_style: ''
image_style: thumbnail
image_loading:
attribute: lazy
third_party_settings: { }

View file

@ -7,7 +7,7 @@ dependencies:
- field.field.node.testimonial.field_image
- field.field.node.testimonial.field_link
- field.field.node.testimonial.field_tagline
- image.style.wide
- image.style.testimonial
- node.type.testimonial
module:
- image
@ -24,14 +24,14 @@ content:
label: hidden
settings: { }
third_party_settings: { }
weight: 1
weight: 0
region: content
field_image:
type: image
label: hidden
settings:
image_link: ''
image_style: wide
image_style: testimonial
image_loading:
attribute: eager
third_party_settings: { }
@ -55,7 +55,7 @@ content:
settings:
link_to_entity: false
third_party_settings: { }
weight: 0
weight: 1
region: content
links:
settings: { }

View file

@ -0,0 +1,15 @@
uuid: 84ebe8ae-635f-4471-a2bd-f41cfb90f932
langcode: en
status: true
dependencies: { }
name: testimonial
label: 'Testimonial image'
effects:
20465a93-a7e6-48b4-90e3-ac74fa68ca29:
uuid: 20465a93-a7e6-48b4-90e3-ac74fa68ca29
id: image_scale_and_crop
weight: 1
data:
width: 100
height: 100
anchor: center-center

View file

@ -0,0 +1,14 @@
<?php
/**
* Implements hook_preprocess_image_style().
*
* @param array{ style_name: string, image: array{ "#attributes": array{ class: string[] }}} $variables
*/
function opdavies_preprocess_image_style(array &$variables): void {
if ($variables['style_name'] === 'testimonial' || $variables['style_name'] === 'thumbnail') {
$variables['image']['#attributes']['class'] = 'size-16 rounded-full ring-[3px] ring-blue-primary dark:ring-white';
}
}
# vim: ft=php

View file

@ -0,0 +1,49 @@
{#
/**
* @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 }}>
{{ title_prefix }}
{% if label %}
<h2{{ title_attributes.addClass('mb-4 text-xl font-bold') }}>{{ label }}</h2>
{% endif %}
{{ title_suffix }}
{% block content %}
<div class="mt-4">
<div class="flex space-x-4">
<div class="flex flex-col flex-shrink-0 justify-start">
{{ content.field_image }}
</div>
{{ content.body }}
</div>
</div>
{{ content|without('body')|without('field_image') }}
{% endblock %}
</div>

View file

@ -29,7 +29,7 @@
<div{{ attributes }}>
{{ title_prefix }}
{% if label %}
<h2{{ title_attributes.addClass('text-xl font-bold') }}>{{ label }}</h2>
<h2{{ title_attributes.addClass('mb-4 text-xl font-bold') }}>{{ label }}</h2>
{% endif %}
{{ title_suffix }}

View file

@ -0,0 +1,98 @@
{#
/**
* @file
* Theme override to display a node.
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - node.getCreatedTime() will return the node creation timestamp.
* - node.hasField('field_example') returns TRUE if the node bundle includes
* field_example. (This does not indicate the presence of a value in this
* field.)
* - node.isPublished() will return whether the node is published or not.
* Calling other methods, such as node.delete(), will result in an exception.
* See \Drupal\node\Entity\Node for a full list of public properties and
* methods for the node object.
* - label: (optional) The title of the node.
* - content: All node items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - author_picture: The node author user entity, rendered using the "compact"
* view mode.
* - metadata: Metadata for this node.
* - date: (optional) Themed creation date field.
* - author_name: (optional) Themed author name field.
* - url: Direct URL of the current node.
* - display_submitted: Whether submission information should be displayed.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - node: The current template type (also known as a "theming hook").
* - node--type-[type]: The current node type. For example, if the node is an
* "Article" it would result in "node--type-article". Note that the machine
* name will often be in a short form of the human readable label.
* - node--view-mode-[view_mode]: The View Mode of the node; for example, a
* teaser would result in: "node--view-mode-teaser", and
* full: "node--view-mode-full".
* The following are controlled through the node publishing options.
* - node--promoted: Appears on nodes promoted to the front page.
* - node--sticky: Appears on nodes ordered above other non-sticky nodes in
* teaser listings.
* - node--unpublished: Appears on unpublished nodes visible only to site
* admins.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - content_attributes: Same as attributes, except applied to the main
* content tag that appears in the template.
* - author_attributes: Same as attributes, except applied to the author of
* the node 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.
* - view_mode: View mode; for example, "teaser" or "full".
* - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
* - page: Flag for the full page state. Will be true if view_mode is 'full'.
* - readmore: Flag for more state. Will be true if the teaser content of the
* node cannot hold the main body content.
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* @see template_preprocess_node()
*
*/
#}
<article{{ attributes }}>
{% if display_submitted %}
<footer>
{{ author_picture }}
<div{{ author_attributes }}>
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
<div{{ content_attributes.addClass("prose prose-p:text-black prose-a:font-light prose-a:text-blue-primary prose-p:text-lg prose-blockquote:border-blue-primary dark:marker:text-white prose-li:my-1 prose-li:text-lg prose-figcaption:text-white prose-li:text-black marker:text-black dark:prose-p:text-white dark:prose-invert dark:prose-a:text-blue-400 dark:prose-blockquote:border-blue-400 dark:prose-li:text-white hover:prose-a:no-underline prose-h2:text-xl prose-code:font-normal prose-h2:mb-4 prose-ul:my-3 dark:prose-hr:border-grey-400 prose-code:before:content-[''] prose-code:after:content-['']") }}>
{{ content.body }}
<footer class="mt-8 flex items-center space-x-4 space-x-reverse">
<span class="text-base">
{{ content.field_link ? link(label, content.field_link.0['#url'], create_attribute({ style: 'display: inline-block;' })) : label }}
- {{ content.field_tagline.0 }}
</span>
<span class="not-prose order-first flex-shrink-0">
{{ content.field_image }}
</span>
</footer>
{{ content|without('body')|without('field_image')|without('field_link')|without('field_tagline') }}
</div>
</article>

View file

@ -47,17 +47,17 @@
"prose prose-p:text-black prose-a:font-light prose-a:text-blue-primary prose-p:text-lg prose-blockquote:border-blue-primary dark:marker:text-white prose-li:my-1 prose-li:text-lg prose-figcaption:text-white prose-li:text-black marker:text-black dark:prose-p:text-white dark:prose-invert dark:prose-a:text-blue-400 dark:prose-blockquote:border-blue-400 dark:prose-li:text-white hover:prose-a:no-underline prose-h2:text-xl prose-code:font-normal prose-h2:mb-4 prose-ul:my-3 dark:prose-hr:border-grey-400 prose-code:before:content-[''] prose-code:after:content-['']",
]
%}
<div class="{{ prose_classes|join(' ') }}">
<div>
{% if label_hidden %}
{% if multiple %}
<div{{ attributes }}>
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
<div{{ item.attributes.addClass(prose_classes) }}>{{ item.content }}</div>
{% endfor %}
</div>
{% else %}
{% for item in items %}
<div{{ attributes }}>{{ item.content }}</div>
<div{{ attributes.addClass(prose_classes) }}>{{ item.content }}</div>
{% endfor %}
{% endif %}
{% else %}
@ -67,7 +67,7 @@
<div>
{% endif %}
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
<div{{ item.attributes.addClass(prose_classes) }}>{{ item.content }}</div>
{% endfor %}
{% if multiple %}
</div>

View file

@ -0,0 +1,61 @@
{#
/**
* @file
* Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override
* theming for a subset of fields using
* @link themeable Theme hook suggestions. @endlink For example,
* here are some theme hook suggestions that can be used for a field_foo field
* on an article node type:
* - field--node--field-foo--article.html.twig
* - field--node--field-foo.html.twig
* - field--node--article.html.twig
* - field--field-foo.html.twig
* - field--text-with-summary.html.twig
* - field.html.twig
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
* @see template_preprocess_field()
*/
#}
{%
set title_classes = [
label_display == 'visually_hidden' ? 'visually-hidden',
]
%}
{% if label_hidden %}
<div{{ attributes.addClass('space-y-12') }}>
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
</div>
{% else %}
<div{{ attributes }}>
<div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
<div class="space-y-12">
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
</div>
</div>
{% endif %}

View file

@ -0,0 +1,56 @@
{#
/**
* @file
* Theme override for a field.
*
* To override output, copy the "field.html.twig" from the templates directory
* to your theme's directory and customize it, just like customizing other
* Drupal templates such as page.html.twig or node.html.twig.
*
* Instead of overriding the theming for all fields, you can also just override
* theming for a subset of fields using
* @link themeable Theme hook suggestions. @endlink For example,
* here are some theme hook suggestions that can be used for a field_foo field
* on an article node type:
* - field--node--field-foo--article.html.twig
* - field--node--field-foo.html.twig
* - field--node--article.html.twig
* - field--field-foo.html.twig
* - field--text-with-summary.html.twig
* - field.html.twig
*
* Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
* - attributes: List of HTML attributes for each item.
* - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.
*
* @see template_preprocess_field()
*/
#}
{%
set title_classes = [
label_display == 'visually_hidden' ? 'visually-hidden',
]
%}
{% if label_hidden %}
{% for item in items %}
<div{{ attributes }}>{{ item.content|add_class('banana') }}</div>
{% endfor %}
{% else %}
<div{{ attributes }}>
<div{{ title_attributes.addClass(title_classes) }}>{{ label }}</div>
{% for item in items %}
<div{{ item.attributes }}>{{ item.content }}</div>
{% endfor %}
</div>
{% endif %}

View file

@ -0,0 +1,63 @@
{#
/**
* @file
* Theme override for the basic structure of a single Drupal page.
*
* Variables:
* - logged_in: A flag indicating if user is logged in.
* - root_path: The root path of the current page (e.g., node, admin, user).
* - node_type: The content type for the current node, if the page is a node.
* - head_title: List of text elements that make up the head_title variable.
* May contain one or more of the following:
* - title: The title of the page.
* - name: The name of the site.
* - slogan: The slogan of the site.
* - page_top: Initial rendered markup. This should be printed before 'page'.
* - page: The rendered page markup.
* - page_bottom: Closing rendered markup. This variable should be printed after
* 'page'.
* - db_offline: A flag indicating if the database is offline.
* - placeholder_token: The token for generating head, css, js and js-bottom
* placeholders.
*
* @see template_preprocess_html()
*/
#}
<!DOCTYPE html>
<html{{ html_attributes }}>
<head>
<head-placeholder token="{{ placeholder_token }}">
<title>{{ head_title|safe_join(' | ') }}</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="preconnect" href="https://fonts.gstatic.com" />
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,300;0,400;0,700;1,300&display=swap" rel="stylesheet" />
<meta name="author" content="Oliver Davies" />
<meta name="keywords" content="Drupal Developer, Drupal Consultant, Drupal Architect, Drupal Strategist, Drupal Trainer, Triple Certified Drupal Expert, Public Speaker, Workshop Trainer, Technical Lead, Technical Coach, Software Development Coach, Automated Testing, Test-Driven Development" />
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@opdavies">
<meta name="twitter:image" content="{{ site.assets.url }}/assets/images/od-logo.jpg" />
<meta name="twitter:site" content="@opdavies">
<meta property="og:image" name="image" content="{{ site.assets.url }}/assets/images/od-logo.jpg" />
<meta property="og:site_name" content="Oliver Davies" />
<meta property="og:type" content="website" />
<!-- <meta property="og:url" content="{{ site.url }}{{ page.url|trim('/', 'right') }}" /> -->
<css-placeholder token="{{ placeholder_token }}">
<js-placeholder token="{{ placeholder_token }}">
</head>
<body{{ attributes }}>
{#
Keyboard navigation/accessibility link to main content section in
page.html.twig.
#}
<a href="#main-content" class="visually-hidden focusable">
{{ 'Skip to main content'|t }}
</a>
{{ page_top }}
{{ page }}
{{ page_bottom }}
<js-bottom-placeholder token="{{ placeholder_token }}">
</body>
</html>

View file

@ -45,7 +45,6 @@
#}
<div class="min-h-screen font-sans text-base font-light md:text-xl dark:text-white text-grey-900 selection:bg-blue-primary selection:text-white dark:bg-grey-900 dark:selection:bg-blue-primary dark:selection:text-white">
<div class="py-4 px-4 mx-auto max-w-xl">
<div class="py-10 px-6 mx-auto max-w-xl md:py-10">
<header class="flex flex-col justify-between items-center md:flex-row">
<div class="flex flex-col justify-between items-center md:flex-row">
<div>
@ -60,6 +59,7 @@
</div>
</header>
<div class="py-10 px-6 mx-auto max-w-xl md:py-10">
{{ page.highlighted }}
{{ page.help }}
@ -73,11 +73,29 @@
{{ page.primary_menu }}
{% if page.footer %}
<footer role="contentinfo">
<footer class="mt-16 mb-6">
<nav class="flex flex-wrap justify-center -mb-3">
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/">
About
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/press">
Press Info
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/pricing">
Services
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/talks">
Talks and Workshops
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/podcast">
Podcast
</a>
<a class="mx-3 mb-3 text-base underline md:text-lg dark:text-white hover:no-underline link dark:hover:text-blue-400 hover:text-gray-900" href="/daily">
Daily list
</a>
</nav>
{{ page.footer }}
</footer>
{% endif %}
</div>
</div>
</div>

View file

@ -0,0 +1,19 @@
{#
/**
* @file
* Theme override to display a region.
*
* Available variables:
* - content: The content for this region, typically blocks.
* - attributes: HTML attributes for the region <div>.
* - region: The name of the region variable as defined in the theme's
* .info.yml file.
*
* @see template_preprocess_region()
*/
#}
{% if content %}
<div{{ attributes.addClass('space-y-10') }}>
{{ content }}
</div>
{% endif %}