Skip to content

Commit 32fdc01

Browse files
authored
Merge pull request #2224 from tf/teaser-text-align
Allow changing text alignment in teaser links
2 parents 8275ffe + 4bab5e1 commit 32fdc01

File tree

7 files changed

+42
-3
lines changed

7 files changed

+42
-3
lines changed

entry_types/scrolled/config/locales/new/ext-link-options.de.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ de:
6868
small: Klein
6969
medium: Mittel
7070
large: Groß
71+
textAlign:
72+
label: Textausrichtung
73+
inline_help: Ausrichtung des Texts innerhalb der Links.
74+
values:
75+
left: Links
76+
center: Zentriert
77+
right: Rechts
7178
displayButtons:
7279
label: "Buttons anzeigen"
7380
inline_help: |-

entry_types/scrolled/config/locales/new/ext-link-options.en.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ en:
6666
small: Small
6767
medium: Medium
6868
large: Large
69+
textAlign:
70+
label: Text alignment
71+
inline_help: Align the text in the links.
72+
values:
73+
left: Left
74+
center: Center
75+
right: Right
6976
displayButtons:
7077
label: "Display buttons"
7178
inline_help: |-

entry_types/scrolled/package/src/contentElements/externalLinkList/editor/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ editor.contentElementTypes.register('externalLinkList', {
8181
this.input('textSize', SelectInputView, {
8282
values: ['small', 'medium', 'large']
8383
});
84+
this.input('textAlign', SelectInputView, {
85+
values: ['left', 'right', 'center']
86+
});
8487
this.input('displayButtons', CheckBoxInputView);
8588
});
8689
}

entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export function ExternalLink({id, configuration, ...props}) {
114114
</Thumbnail>
115115
</div>
116116
<div className={classNames(styles.background,
117+
styles[`align-${configuration.textAlign}`],
117118
props.darkBackground ? styles.light : styles.dark)}
118119
style={{pointerEvents: !isEditable || isSelected ? undefined : 'none'}}>
119120
<InlineFileRights context="afterElement" items={[{file: thumbnailImageFile, label: 'image'}]} />
@@ -137,7 +138,8 @@ export function ExternalLink({id, configuration, ...props}) {
137138
onChange={value => handleTextChange('description', value)} />
138139
</div>}
139140
{configuration.displayButtons && presentOrEditing('link') &&
140-
<LinkButton href={href}
141+
<LinkButton className={styles.link}
142+
href={href}
141143
openInNewTab={openInNewTab}
142144
value={itemTexts[id]?.link}
143145
linkPreviewDisabled={true}

entry_types/scrolled/package/src/contentElements/externalLinkList/frontend/ExternalLink.module.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
position: absolute;
109109
bottom: 0;
110110
width: 100%;
111+
box-sizing: border-box;
111112
background: transparent;
112113
z-index: 1;
113114
}
@@ -149,3 +150,15 @@
149150
.textPosition-overlay .title:last-child {
150151
margin-bottom: 0;
151152
}
153+
154+
.link {
155+
margin-bottom: -5px;
156+
}
157+
158+
.align-center {
159+
text-align: center;
160+
}
161+
162+
.align-right {
163+
text-align: right;
164+
}

entry_types/scrolled/package/src/contentElements/externalLinkList/stories.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ storiesOfContentElement(module, {
9898
textSize: 'large',
9999
}
100100
},
101+
{
102+
name: 'With text alignment',
103+
configuration: {
104+
textAlign: 'center',
105+
}
106+
},
101107
{
102108
name: 'With inverted content colors',
103109
configuration: {

entry_types/scrolled/package/src/frontend/LinkButton.module.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
}
1212

1313
.button {
14-
display: flex;
15-
width: var(--theme-link-button-width);
14+
display: inline-flex;
15+
min-width: var(--theme-link-button-width, 100%);
16+
box-sizing: border-box;
1617
justify-content: center;
1718
gap: 0.5em;
1819
border-radius: var(--theme-link-button-border-radius, 5px);

0 commit comments

Comments
 (0)