Skip to content

Commit

Permalink
Update: Set item title as strapline default (fixes #251) (#285)
Browse files Browse the repository at this point in the history
* set item title as strapline default

* remove example strapline

* Update README strapline instruction

* add strapline schema help text and remove required

* add strapline schema description
  • Loading branch information
kirsty-hames authored Nov 22, 2023
1 parent 2b31480 commit 60b9907
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The attributes listed below are used in *components.json* to configure **Narrati

>>**attribution** (string): Optional text to be displayed as an [attribution](https://wiki.creativecommons.org/Best_practices_for_attribution). By default it is displayed below the image. Adjust positioning by modifying CSS. Text can contain HTML tags, e.g., `Copyright © 2015 by Lukasz 'Severiaan' Grela`.

>**strapline** (string): This text is displayed as a title above the image when `device.screenSize` is `small` (i.e., when viewed on mobile devices). When using `_isStackedOnMobile: true`, this attribute will be ignored.
>**strapline** (string): Optional if a succinct title is required for strapline mobile layout. The title is displayed above the image in the strapline button. Leave empty to default to **title** text. When using `_isStackedOnMobile: true`, this attribute will be ignored.

### Accessibility

Expand Down
6 changes: 3 additions & 3 deletions example.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"alt": "",
"attribution": "Copyright © 2019"
},
"strapline": "Narrative item 1 strapline"
"strapline": ""
},
{
"title": "Narrative item 2 title",
Expand All @@ -35,7 +35,7 @@
"alt": "",
"attribution": ""
},
"strapline": "Narrative item 2 strapline"
"strapline": ""
},
{
"title": "Narrative item 3 title",
Expand All @@ -45,7 +45,7 @@
"alt": "",
"attribution": ""
},
"strapline": "Narrative item 3 strapline"
"strapline": ""
}
],
"_pageLevelProgress": {
Expand Down
6 changes: 3 additions & 3 deletions properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@
},
"strapline": {
"type": "string",
"required": true,
"required": false,
"default": "",
"title": "Narrative strapline",
"inputType": "Text",
"validators": ["required"],
"help": "",
"validators": [],
"help": "Optional if a succinct title is required for the strapline mobile layout. Leave empty to default to title text",
"translatable": true
}
}
Expand Down
1 change: 1 addition & 0 deletions schema/component.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"strapline": {
"type": "string",
"title": "Strapline",
"description": "Optional if a succinct title is required for the strapline mobile layout. Leave empty to default to title text",
"default": "",
"_adapt": {
"translatable": true
Expand Down
4 changes: 2 additions & 2 deletions templates/narrativeStrapline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function NarrativeStrapline(props) {
}}
>

{_items.map(({ _index, _isActive, _isVisited, strapline }) =>
{_items.map(({ _index, _isActive, _isVisited, strapline, title }) =>

<button
className={classes([
Expand All @@ -48,7 +48,7 @@ export default function NarrativeStrapline(props) {
<span className="narrative__strapline-title">
<span
className="narrative__strapline-title-inner"
dangerouslySetInnerHTML={{ __html: compile(strapline, props) }}
dangerouslySetInnerHTML={{ __html: compile(strapline || title, props) }}
/>
</span>

Expand Down

0 comments on commit 60b9907

Please sign in to comment.