Skip to content

Commit bcf7b60

Browse files
committed
Don't allow line breaks in author names
1 parent 0916811 commit bcf7b60

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

.changeset/tall-socks-train.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@cloudfour/patterns': minor
3+
---
4+
5+
Don't allow line breaks in author names

src/components/author/author.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@
77
.c-author {
88
color: var(--theme-color-text-muted);
99
}
10+
11+
/**
12+
* 1. Prevent breaking inside author names
13+
*/
14+
.c-author__author {
15+
display: inline-block; /* 1 */
16+
}

src/components/author/author.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,16 @@
6262
{# Author content #}
6363
<div class="c-author__content-container o-media__content">
6464
{# Author links #}
65-
<p class="c-author__author">
65+
<p>
6666
<span class="u-hidden-visually">{{ author_prefix|default("By") }}</span>
6767
{% block authors %}
6868
{% for author in authors %}
6969
{% if loop.last and loop.length > 1 %}and {% endif %}
70-
{%- if author.link and not unlink -%}
71-
<a href="{{ author.link }}">{{ author.name }}</a>
72-
{%- else -%}
73-
<span>{{ author.name }}</span>
74-
{%- endif -%}
70+
{%- if author.link and not unlink -%}
71+
<a class="c-author__author" href="{{ author.link }}">{{ author.name }}</a>
72+
{%- else -%}
73+
<span class="c-author__author">{{ author.name }}</span>
74+
{%- endif -%}
7575
{%- if not loop.last and loop.length > 2 %},{% endif %}
7676
{% endfor %}
7777
{% endblock %}

0 commit comments

Comments
 (0)