Skip to content

Commit 0d39666

Browse files
authored
Merge pull request #8682 from guardian/mxdvl/island-descriptions
Improve Islands descriptions
2 parents 141b51e + dd7a7fd commit 0d39666

32 files changed

+144
-51
lines changed

dotcom-rendering/scripts/islands/island-descriptions.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const getRegExForIsland = (name) =>
2424
'\n/\\*\\*\n?' +
2525
'((?: \\*.*\n)+)' +
2626
' \\*\\/' +
27-
`\nexport const ${name} =`,
27+
`\\s+export const ${name} =`,
2828
'm',
2929
);
3030

@@ -112,10 +112,11 @@ const getIslands = async (report) => {
112112
: '';
113113

114114
const description =
115-
matched?.[1]
115+
`# ${name.replaceAll(/([A-Z])/g, ' $1')}\n` +
116+
(matched?.[1]
116117
?.split('\n')
117118
.map((jsdoc_line) => jsdoc_line.slice(3))
118-
.join('\n') ?? `# ${name} \n No description yet… 😢`;
119+
.join('\n') ?? `No description yet… 😢`);
119120

120121
const html = await processor.process(description);
121122

dotcom-rendering/src/components/AlreadyVisited.importable.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ import { useEffect } from 'react';
22
import { incrementAlreadyVisited } from '../lib/alreadyVisited';
33

44
/**
5-
* # AlreadyVisited
6-
*
75
* Increment the already visited count.
86
*
9-
* @returns {} _No visual or DOM output_
7+
* ## Why does this need to be an Island?
8+
*
9+
* This modifies local storage values.
10+
*
11+
* ---
12+
*
13+
* Does not render **anything**.
1014
*/
1115
export const AlreadyVisited = () => {
1216
useEffect(() => {

dotcom-rendering/src/components/AudioAtomWrapper.importable.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ type Props = {
1919
};
2020

2121
/**
22-
* # AudioAtomWrapper
22+
* ## Why does this need to be an Island?
2323
*
24+
* The audio atom is interactive.
25+
* Requires consent to use audio ads.
26+
*
27+
* ---
28+
*
29+
* (No visual story exists)
2430
*/
2531
export const AudioAtomWrapper = ({
2632
id,

dotcom-rendering/src/components/AustralianTerritorySwitcher.importable.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ const labelStyles = css`
4040
type Props = {
4141
targetedTerritory: AustralianTerritory;
4242
};
43+
44+
/**
45+
* Allows containers targetted to a specific territory to be changed
46+
* to a different territory. E.g New South Wales to Victoria
47+
*
48+
* ## Why does this need to be an Island?
49+
*
50+
* We use cookies to set the user’s territory.
51+
*
52+
* ---
53+
*
54+
* [`AustralianTerritorySwitcher` on Chromatic](https://www.chromatic.com/component?appId=63e251470cfbe61776b0ef19&csfId=components-australianterritoryswitcher--victoria&buildNumber=2967)
55+
*/
4356
export const AustralianTerritorySwitcher = ({ targetedTerritory }: Props) => {
4457
const [expanded, setExpanded] = useState(false);
4558

dotcom-rendering/src/components/Branding.importable.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ type Props = {
163163
};
164164

165165
/**
166-
* # Branding
167-
*
168166
* Wrapper around the logo and link for sponsored or paid for content.
169167
*
170168
* ## Why does this need to be an Island?

dotcom-rendering/src/components/BrazeMessaging.importable.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ type Props = {
88
/**
99
* This component ensures we call buildBrazeMessaging at least once
1010
* on every page
11+
*
12+
* ## Why does this need to be an Island?
13+
*
14+
* All behaviour is client-side.
15+
*
16+
* ---
17+
*
18+
* Does not render **anything**.
1119
*/
1220
export const BrazeMessaging = ({ idApiUrl }: Props) => {
1321
const { brazeMessages, brazeCards } = useBraze(idApiUrl);

dotcom-rendering/src/components/CalloutBlockComponent.importable.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const collapsibleCalloutStyle = css`
1111
`;
1212

1313
/**
14-
* # Callout Block Component
15-
*
1614
* A callout to readers to share their stories.
1715
* This is the updated version of the CalloutEmbedBlockComponent.
1816
*

dotcom-rendering/src/components/CalloutEmbedBlockComponent.importable.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ let hasFormBeenOpened = true;
130130
type FormDataType = { [key in string]: unknown };
131131

132132
/**
133-
* # Callout Embed Block Component
134-
*
135133
* A callout to readers to share their stories.
136134
*
137135
* ## Why does this need to be an Island?

dotcom-rendering/src/components/Carousel.importable.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,6 @@ const decideCarouselColours = (
843843
};
844844

845845
/**
846-
* # Carousel
847-
*
848846
* A carousel of cards, mainly used in onward journeys,
849847
* at the bottom of articles
850848
*

dotcom-rendering/src/components/CommentCount.importable.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ const linkStyles = css`
7272
`;
7373

7474
/**
75-
* # CommentCount
76-
*
7775
* Shows the number of comments at the top of an article.
76+
*
77+
* ## Why does this need to be an Island?
78+
*
7879
* Fetches the count from the discussion API.
7980
*
80-
* [Storybook `Count`](https://637e40d1bc73bf3f604394b9-rzazjyrwhc.chromatic.com/?path=/story/components-counts)
81+
* ---
82+
*
83+
* [`Count` on Chromatic](https://www.chromatic.com/component?appId=63e251470cfbe61776b0ef19&csfId=components-counts&buildNumber=2967)
8184
*/
8285
export const CommentCount = ({
8386
discussionApiUrl,

0 commit comments

Comments
 (0)