Skip to content

Allow changing text alignment in teaser links #2224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ de:
small: Klein
medium: Mittel
large: Groß
textAlign:
label: Textausrichtung
inline_help: Ausrichtung des Texts innerhalb der Links.
values:
left: Links
center: Zentriert
right: Rechts
displayButtons:
label: "Buttons anzeigen"
inline_help: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ en:
small: Small
medium: Medium
large: Large
textAlign:
label: Text alignment
inline_help: Align the text in the links.
values:
left: Left
center: Center
right: Right
displayButtons:
label: "Display buttons"
inline_help: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ editor.contentElementTypes.register('externalLinkList', {
this.input('textSize', SelectInputView, {
values: ['small', 'medium', 'large']
});
this.input('textAlign', SelectInputView, {
values: ['left', 'right', 'center']
});
this.input('displayButtons', CheckBoxInputView);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export function ExternalLink({id, configuration, ...props}) {
</Thumbnail>
</div>
<div className={classNames(styles.background,
styles[`align-${configuration.textAlign}`],
props.darkBackground ? styles.light : styles.dark)}
style={{pointerEvents: !isEditable || isSelected ? undefined : 'none'}}>
<InlineFileRights context="afterElement" items={[{file: thumbnailImageFile, label: 'image'}]} />
Expand All @@ -137,7 +138,8 @@ export function ExternalLink({id, configuration, ...props}) {
onChange={value => handleTextChange('description', value)} />
</div>}
{configuration.displayButtons && presentOrEditing('link') &&
<LinkButton href={href}
<LinkButton className={styles.link}
href={href}
openInNewTab={openInNewTab}
value={itemTexts[id]?.link}
linkPreviewDisabled={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
position: absolute;
bottom: 0;
width: 100%;
box-sizing: border-box;
background: transparent;
z-index: 1;
}
Expand Down Expand Up @@ -149,3 +150,15 @@
.textPosition-overlay .title:last-child {
margin-bottom: 0;
}

.link {
margin-bottom: -5px;
}

.align-center {
text-align: center;
}

.align-right {
text-align: right;
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ storiesOfContentElement(module, {
textSize: 'large',
}
},
{
name: 'With text alignment',
configuration: {
textAlign: 'center',
}
},
{
name: 'With inverted content colors',
configuration: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
}

.button {
display: flex;
width: var(--theme-link-button-width);
display: inline-flex;
min-width: var(--theme-link-button-width, 100%);
box-sizing: border-box;
justify-content: center;
gap: 0.5em;
border-radius: var(--theme-link-button-border-radius, 5px);
Expand Down
Loading