From bcf7b60e09c9e248295e22cd018ce6fe6e42661d Mon Sep 17 00:00:00 2001 From: Caleb Eby Date: Mon, 25 Jul 2022 09:34:29 -0700 Subject: [PATCH] Don't allow line breaks in author names --- .changeset/tall-socks-train.md | 5 +++++ src/components/author/author.scss | 7 +++++++ src/components/author/author.twig | 12 ++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 .changeset/tall-socks-train.md diff --git a/.changeset/tall-socks-train.md b/.changeset/tall-socks-train.md new file mode 100644 index 000000000..11c9b6d6d --- /dev/null +++ b/.changeset/tall-socks-train.md @@ -0,0 +1,5 @@ +--- +'@cloudfour/patterns': minor +--- + +Don't allow line breaks in author names diff --git a/src/components/author/author.scss b/src/components/author/author.scss index 8188a5357..2207b4efd 100644 --- a/src/components/author/author.scss +++ b/src/components/author/author.scss @@ -7,3 +7,10 @@ .c-author { color: var(--theme-color-text-muted); } + +/** + * 1. Prevent breaking inside author names + */ +.c-author__author { + display: inline-block; /* 1 */ +} diff --git a/src/components/author/author.twig b/src/components/author/author.twig index 4a5386eb3..b16ed66f2 100644 --- a/src/components/author/author.twig +++ b/src/components/author/author.twig @@ -62,16 +62,16 @@ {# Author content #}
{# Author links #} -

+

{{ author_prefix|default("By") }} {% block authors %} {% for author in authors %} {% if loop.last and loop.length > 1 %}and {% endif %} - {%- if author.link and not unlink -%} - {{ author.name }} - {%- else -%} - {{ author.name }} - {%- endif -%} + {%- if author.link and not unlink -%} + {{ author.name }} + {%- else -%} + {{ author.name }} + {%- endif -%} {%- if not loop.last and loop.length > 2 %},{% endif %} {% endfor %} {% endblock %}