Skip to content

Commit 148f0af

Browse files
authored
Merge pull request #2221 from tf/teaser-scale-categories
Add scale categories for teaser title and tagline
2 parents cd812a3 + a82d95d commit 148f0af

4 files changed

Lines changed: 94 additions & 46 deletions

File tree

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
EditableInlineText,
77
EditableText,
88
InlineFileRights,
9+
Text,
910
useFileWithInlineRights,
1011
useContentElementConfigurationUpdate,
1112
useContentElementEditorState,
@@ -15,6 +16,12 @@ import {
1516

1617
import {Thumbnail} from './Thumbnail';
1718

19+
const scaleCategorySuffixes = {
20+
small: 'sm',
21+
medium: 'md',
22+
large: 'lg'
23+
};
24+
1825
export function ExternalLink({id, configuration, ...props}) {
1926
const {isEditable, isSelected} = useContentElementEditorState();
2027
const updateConfiguration = useContentElementConfigurationUpdate();
@@ -77,6 +84,8 @@ export function ExternalLink({id, configuration, ...props}) {
7784
const href = itemLinks[id] ? itemLinks[id]?.href : ensureAbsolute(props.url);
7885
const openInNewTab = itemLinks[id] ? itemLinks[id]?.openInNewTab : props.open_in_new_tab;
7986

87+
const scaleCategorySuffix = scaleCategorySuffixes[props.textSize || 'small'];
88+
8089
return (
8190
<li className={classNames(styles.item,
8291
styles[`textPosition-${props.textPosition}`],
@@ -93,7 +102,6 @@ export function ExternalLink({id, configuration, ...props}) {
93102
<div className={classNames(
94103
styles.card,
95104
styles[`thumbnailSize-${props.thumbnailSize}`],
96-
styles[`textSize-${props.textSize}`],
97105
{[styles.invert]: props.invert
98106
})}>
99107
<div className={styles.thumbnail}>
@@ -109,20 +117,20 @@ export function ExternalLink({id, configuration, ...props}) {
109117
<InlineFileRights context="afterElement" items={[{file: thumbnailImageFile, label: 'image'}]} />
110118
<div className={styles.details}>
111119
{presentOrEditing('tagline') &&
112-
<div className={styles.tagline}>
120+
<Text scaleCategory={`teaserTagline-${scaleCategorySuffix}`}>
113121
<EditableInlineText value={itemTexts[id]?.tagline}
114122
placeholder={t('pageflow_scrolled.inline_editing.type_tagline')}
115123
onChange={value => handleTextChange('tagline', value)} />
116-
</div>}
117-
<div className={styles.title}>
124+
</Text>}
125+
<Text scaleCategory={`teaserTitle-${scaleCategorySuffix}`}>
118126
<EditableInlineText value={itemTexts[id]?.title || legacyTexts.title}
119127
placeholder={t('pageflow_scrolled.inline_editing.type_heading')}
120128
onChange={value => handleTextChange('title', value)} />
121-
</div>
129+
</Text>
122130
{presentOrEditing('description') &&
123131
<div className={styles.link_desc}>
124132
<EditableText value={itemTexts[id]?.description || legacyTexts.description}
125-
scaleCategory="teaserDescription"
133+
scaleCategory={`teaserDescription-${scaleCategorySuffix}`}
126134
placeholder={t('pageflow_scrolled.inline_editing.type_text')}
127135
onChange={value => handleTextChange('description', value)} />
128136
</div>}

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

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
opacity: calc(0.9 * var(--overlay-opacity, 0.7));
120120
}
121121

122-
123122
.textPosition-none .background {
124123
display: none;
125124
}
@@ -141,41 +140,7 @@
141140
padding: 10px 10px 10px 15px;
142141
}
143142

144-
.tagline {
145-
composes: typography-externalLinkTagline from global;
146-
line-height: 1.3;
147-
margin: 0 0 0.25rem;
148-
}
149-
150-
.title {
151-
composes: typography-externalLinkTitle from global;
152-
line-height: 1.3;
153-
font-weight: bold;
154-
margin: 0 0 1rem;
155-
}
156-
143+
.details p,
157144
.textPosition-overlay .title:last-child {
158145
margin-bottom: 0;
159146
}
160-
161-
.details p {
162-
margin-bottom: 0;
163-
}
164-
165-
.textSize-medium {
166-
font-size: 18px;
167-
}
168-
169-
.textSize-large {
170-
font-size: 20px;
171-
}
172-
173-
@media screen and breakpoint-sm {
174-
.textSize-small .title {
175-
font-size: 1.2em;
176-
}
177-
178-
.textSize-medium .title {
179-
font-size: 1.1em;
180-
}
181-
}

entry_types/scrolled/package/src/frontend/Text.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ import styles from './Text.module.css';
2020
* `'counterNumber-xs'`, `'counterDescription`'.
2121
* `'infoTableLabel'`, `'infoTableValue`'.
2222
* `'hotspotsTooltipTitle'`, `'hotspotsTooltipDescription`', `'hotspotsTooltipLink`',
23-
* `'teaserDescription'`.
23+
* `'teaserTitle-lg'`, `'teaserTitle-md'`, `'teaserTitle-sm'`,
24+
* `'teaserTagline-lg'`, `'teaserTagline-md'`, `'teaserTagline-sm'`,
25+
* `'teaserDescription-lg'`, `'teaserDescription-md'`, `'teaserDescription-sm'`.
2426
* @param {string} [props.typographyVariant] - Suffix for variant class name.
2527
* @param {string} [props.typographySize] - Suffix for size class name.
2628
* @param {string} [props.inline] - Render a span instread of a div.
@@ -54,7 +56,9 @@ Text.propTypes = {
5456
'quoteText-lg', 'quoteText-md', 'quoteText-sm', 'quoteText-xs',
5557
'quoteAttribution-lg', 'quoteAttribution-md', 'quoteAttribution-sm', 'quoteAttribution-xs',
5658
'hotspotsTooltipTitle', 'hotspotsTooltipDescription', 'hotspotsTooltipLink',
57-
'teaserDescription',
59+
'teaserTitle-lg', 'teaserTitle-md', 'teaserTitle-sm',
60+
'teaserTagline-lg', 'teaserTagline-md', 'teaserTagline-sm',
61+
'teaserDescription-lg', 'teaserDescription-md', 'teaserDescription-sm',
5862
'counterNumber-lg', 'counterNumber-md', 'counterNumber-sm', 'counterNumber-xs',
5963
'counterDescription',
6064
'infoTableLabel', 'infoTableValue',

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

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,73 @@
218218
font-weight: bold;
219219
}
220220

221-
.teaserDescription {
221+
.teaserTitle-lg {
222+
composes: typography-externalLinkTitle from global;
223+
composes: typography-externalLinkTitleLg from global;
224+
line-height: 1.3;
225+
font-weight: bold;
226+
font-size: text-s;
227+
margin-bottom: 1rem;
228+
}
229+
230+
.teaserTitle-md {
231+
composes: typography-externalLinkTitle from global;
232+
composes: typography-externalLinkTitleMd from global;
233+
line-height: 1.3;
234+
font-weight: bold;
235+
font-size: 19.8px;
236+
margin-bottom: 1rem;
237+
}
238+
239+
.teaserTitle-sm {
240+
composes: typography-externalLinkTitle from global;
241+
composes: typography-externalLinkTitleSm from global;
242+
line-height: 1.3;
243+
font-weight: bold;
244+
font-size: 19.2px;
245+
margin-bottom: 1rem;
246+
}
247+
248+
.teaserTagline-lg {
249+
composes: typography-externalLinkTagline from global;
250+
composes: typography-externalLinkTaglineLg from global;
251+
line-height: 1.3;
252+
font-size: text-s;
253+
margin-bottom: 0.25rem;
254+
}
255+
256+
.teaserTagline-md {
257+
composes: typography-externalLinkTagline from global;
258+
composes: typography-externalLinkTaglineMd from global;
259+
line-height: 1.3;
260+
font-size: text-xs;
261+
margin-bottom: 0.25rem;
262+
}
263+
264+
.teaserTagline-sm {
265+
composes: typography-externalLinkTagline from global;
266+
composes: typography-externalLinkTaglineSm from global;
267+
line-height: 1.3;
268+
font-size: text-2xs;
269+
margin-bottom: 0.25rem;
270+
}
271+
272+
.teaserDescription-lg {
273+
composes: typography-externalLinkDescription from global;
274+
line-height: 1.3;
275+
font-size: text-s;
276+
}
277+
278+
.teaserDescription-md {
279+
composes: typography-externalLinkDescription from global;
280+
line-height: 1.3;
281+
font-size: text-xs;
282+
}
283+
284+
.teaserDescription-sm {
222285
composes: typography-externalLinkDescription from global;
223286
line-height: 1.3;
287+
font-size: text-2xs;
224288
}
225289

226290
.infoTableLabel {
@@ -251,7 +315,6 @@
251315
font-size: text-l;
252316
}
253317

254-
255318
.headingTagline-lg {
256319
font-size: 26px;
257320
line-height: 1.2;
@@ -310,4 +373,12 @@
310373
font-size: text-l;
311374
line-height: 1.1;
312375
}
376+
377+
.teaserTitle-md {
378+
font-size: text-xs;
379+
}
380+
381+
.teaserTitle-sm {
382+
font-size: text-2xs;
383+
}
313384
}

0 commit comments

Comments
 (0)