Skip to content

Commit c126606

Browse files
authored
Merge pull request #1371 from undp/post-sb8-upgrade-fixes
Post SB8 upgrade fixes
2 parents 69df0db + e47cf0c commit c126606

File tree

23 files changed

+565
-504
lines changed

23 files changed

+565
-504
lines changed

.storybook/renderToHTML.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { renderToStaticMarkup } from 'react-dom/server'
22
import { decode } from 'html-entities'
3-
import prettier from 'prettier'
4-
import HTMLParser from 'prettier/parser-html'
3+
import * as prettier from 'prettier'
4+
import * as HTMLParser from 'prettier/parser-html'
55

66
export default (story) => {
77
let html = prettier.format(decode(renderToStaticMarkup(story)), {

stories/Atom/BaseTypography/BaseTypography.stories.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Canvas, Meta, Story, Source, Anchor } from "@storybook/addon-docs";
2+
import React from "react";
23

34
import { Heading } from "../Typography/Heading/Heading";
45
import { Abbreviation } from "./Abbr/Abbr";
@@ -24,7 +25,6 @@ export default {
2425
<section>
2526
<h1>Base Typography</h1>
2627
<p>Basic elements which the design system has some styling listed here, you can use the elements as it is, without any specific CSS classes.</p>
27-
<Anchor storyId="foundation-typography-basetypography--abbreviation"></Anchor>
2828
<h3>Abbreviation</h3>
2929
<p>Abbreviation component defines an abbreviation or an acronym, like "HTML", "CSS", "Mr.", "Dr.", "ASAP", "ATM".</p>
3030
<ul>
@@ -34,7 +34,6 @@ export default {
3434

3535
<Canvas of={AbbreviationComponent} />
3636

37-
<Anchor storyId="foundation-typography-basetypography--blockquote"></Anchor>
3837
<h3>Blockquote</h3>
3938
<p>The blockquote component is used to define a section that is quoted from another source.</p>
4039
<ul>
@@ -44,7 +43,6 @@ export default {
4443

4544
<Canvas of={BlockquoteComponent} />
4645

47-
<Anchor storyId="foundation-typography-basetypography--cite"></Anchor>
4846
<h3>Cite</h3>
4947
<p>The Cite component defines the title of a creative work (e.g. a book, a poem, a song, a movie, a painting, a sculpture, etc.).</p>
5048
<ul>
@@ -54,7 +52,6 @@ export default {
5452

5553
<Canvas of={CiteComponent} />
5654

57-
<Anchor storyId="foundation-typography-basetypography--code"></Anchor>
5855
<h3>Code</h3>
5956
<p>The code component is used to define a piece of computer code. The content inside is displayed in the browser's default monospace font.</p>
6057
<ul>
@@ -64,7 +61,6 @@ export default {
6461

6562
<Canvas of={CodeComponent} />
6663

67-
<Anchor storyId="foundation-typography-basetypography--description-list"></Anchor>
6864
<h3>Description List</h3>
6965
<p>A description list is a list of terms, with a description of each term.</p>
7066
<ul>
@@ -73,26 +69,22 @@ export default {
7369

7470
<Canvas of={DescriptionlistComponent} />
7571

76-
<Anchor storyId="foundation-typography-basetypography--details"></Anchor>
7772
<h3>Details</h3>
7873
<p>The details tag creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. A summary or label must be provided using the summary element.</p>
7974

8075
<Canvas of={DetailsTagComponent} />
8176

82-
<Anchor storyId="foundation-typography-basetypography--figcaption"></Anchor>
8377
<h3>Figcaption</h3>
8478
<p>The <code>figcaption</code> tag is used to caption the image. The <code>figcaption</code> tag is used with the <code>figure</code> tag.</p>
8579

8680
<Canvas of={FigcaptionComponent} />
8781

88-
<Anchor storyId="foundation-typography-basetypography--headings"></Anchor>
8982
<h3>Headings</h3>
9083
<p>We can use the <code>h1/h2/h3/h4/h5/h6 tags</code> in any component to display the headings. h1 for most important heading to h6 for least important heading.</p>
9184
<p>Typographic scale when using headings in text component:</p>
9285

9386
<Canvas of={HeadingComponent} />
9487

95-
<Anchor storyId="foundation-typography-basetypography--hr"></Anchor>
9688
<h3>Horizontal Rule</h3>
9789
<p>The <code>hr tag</code> defines a thematic break in an HTML page, and is most often displayed as a horizontal rule.</p>
9890
<ul>
@@ -102,7 +94,6 @@ export default {
10294

10395
<Canvas of={HrComponent} />
10496

105-
<Anchor storyId="foundation-typography-basetypography--mark"></Anchor>
10697
<h3>Mark</h3>
10798
<p>The <code>mark tag</code> defines marked or highlighted text.</p>
10899
<ul>
@@ -112,7 +103,6 @@ export default {
112103

113104
<Canvas of={MarkComponent} />
114105

115-
<Anchor storyId="foundation-typography-basetypography--ordered-list"></Anchor>
116106
<h3>Ordered List</h3>
117107
<p>The <code>ol tag</code> defines an ordered list. An ordered list can be numerical or alphabetical.</p>
118108
<ul>
@@ -121,7 +111,6 @@ export default {
121111

122112
<Canvas of={ListComponent} />
123113

124-
<Anchor storyId="foundation-typography-basetypography--p"></Anchor>
125114
<h3>Paragraph</h3>
126115
<p>The <code>p tag</code> defines a paragraph.</p>
127116
<ul>
@@ -131,7 +120,6 @@ export default {
131120

132121
<Canvas of={PComponent} />
133122

134-
<Anchor storyId="foundation-typography-basetypography--quotation"></Anchor>
135123
<h3>Quotation</h3>
136124
<p>The <code>q tag</code> defines a short quotation.</p>
137125
<ul>
@@ -141,8 +129,6 @@ export default {
141129

142130
<Canvas of={QuotationComponent} />
143131

144-
<Anchor storyId="foundation-typography-basetypography--small"></Anchor>
145-
146132
<h3>Small</h3>
147133

148134
<p>The <code>small tag</code> defines smaller text.</p>
@@ -151,10 +137,7 @@ export default {
151137
</ul>
152138
<p>Typographic scale when using small in text component:</p>
153139

154-
<Canvas of={SmallComponent} />
155-
156-
<Anchor storyId="foundation-typography-basetypography--unordered-list"></Anchor>
157-
140+
<Canvas of={SmallComponent} />
158141

159142
<h3>Unordered List</h3>
160143

@@ -163,8 +146,6 @@ export default {
163146
<li>We can use the <code>ul tag</code> in any component to render the text found within the <code>ul tag</code> in a bulleted list.</li>
164147
</ul>
165148

166-
<Anchor storyId="foundation-typography-basetypography--unordered-list"></Anchor>
167-
168149
<Canvas of={ListComponent} />
169150

170151
<h3>Usage</h3>

stories/Atom/Images/AuthorImage/AuthorImages.stories.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default {
4848
<Story
4949
name="Author Image"
5050
>
51-
{args => <Authorimg image={user} alt="Headshot of XYZ" {...args} />}
51+
{args => <Authorimg image={user} alt="Headshot of XYZ" title="Headshot of XYZ" {...args} />}
5252
</Story>
5353
</Canvas>
5454
<h3>CSS and JS References</h3>
@@ -68,7 +68,7 @@ export default {
6868
},
6969
};
7070

71-
const Template = (args) => <Authorimg image={user} {...args} />;
71+
const Template = (args) => <Authorimg image={user} alt="Headshot of XYZ" title="Headshot of XYZ" {...args} />;
7272

7373
export const AuthorImage = Template.bind({});
7474
AuthorImage.args = {

stories/Atom/Logo/Logo.stories.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export default {
1212

1313

1414
parameters: {
15+
args: {
16+
src: logo,
17+
alt: 'UNDP Logo',
18+
},
1519
backgrounds: {
1620
default: 'white',
1721
values: [
@@ -56,29 +60,21 @@ export default {
5660
<h4>States</h4>
5761
<p>The UNDP and PNUD logos are available in blue or white and used as per the page background.</p>
5862

59-
<Anchor storyId="foundation-logos--pnud-logo-blue"></Anchor>
60-
6163
<h4>1. PNUD logo - Blue <a href="images/pnud-logo-blue.svg" download>Download</a></h4>
6264

6365

64-
<Canvas of={PNUDLogoBlue} />
65-
66-
<Anchor storyId="foundation-logos--pnud-logo-white"></Anchor>
66+
<Canvas of={PNUDLogoBlue} />
6767

6868
<h4>2. PNUD logo - White <a href="images/pnud-logo-white.svg" download>Download</a></h4>
6969

7070

7171
<Canvas of={PNUDLogoWhite} />
7272

73-
<Anchor storyId="foundation-logos--undp-logo-blue"></Anchor>
74-
7573
<h4>3. UNDP Logo - Blue</h4>
7674

7775

7876
<Canvas of={UNDPLogoBlue} />
7977

80-
<Anchor storyId="foundation-logos--undp-logo-white"></Anchor>
81-
8278
<h4>4. UNDP Logo - White</h4>
8379

8480

@@ -92,13 +88,17 @@ export default {
9288
},
9389
};
9490

95-
const Template = (args, src) => <Logo src={src} {...args} />;
91+
const Template = (args) => <Logo {...args} />;
9692

9793
export const PNUDLogoBlue = Template.bind({});
9894
PNUDLogoBlue.args = {
9995
src: pnud,
10096
alt: 'PNUD Logo - Blue',
10197
};
98+
PNUDLogoBlue.argTypes = {
99+
src: { table: { disable: true } },
100+
alt: { table: { disable: true } },
101+
};
102102
PNUDLogoBlue.parameters = {
103103
docs: {
104104
story: {
@@ -113,6 +113,10 @@ PNUDLogoWhite.args = {
113113
src: pnudwhite,
114114
alt: 'PNUD Logo - White',
115115
};
116+
PNUDLogoWhite.argTypes = {
117+
src: { table: { disable: true } },
118+
alt: { table: { disable: true } },
119+
};
116120
PNUDLogoWhite.parameters = {
117121
backgrounds: { default: 'gray' },
118122
docs: {
@@ -128,6 +132,10 @@ UNDPLogoBlue.args = {
128132
src: logo,
129133
alt: 'UNDP Logo - Blue',
130134
};
135+
UNDPLogoBlue.argTypes = {
136+
src: { table: { disable: true } },
137+
alt: { table: { disable: true } },
138+
};
131139
UNDPLogoBlue.parameters = {
132140
docs: {
133141
story: {
@@ -142,6 +150,11 @@ UNDPLogoWhite.args = {
142150
src: logowhite,
143151
alt: 'UNDP Logo - White',
144152
};
153+
UNDPLogoWhite.argTypes = {
154+
src: { table: { disable: true } },
155+
alt: { table: { disable: true } },
156+
157+
};
145158
UNDPLogoWhite.parameters = {
146159
backgrounds: { default: 'gray' },
147160
docs: {
@@ -150,4 +163,5 @@ UNDPLogoWhite.parameters = {
150163
iframeHeight: '100%',
151164
},
152165
},
166+
153167
};

stories/Atom/Typography/Links/Links.stories.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,7 @@ const Template = (args, { globals: { locale } }) => {
9393
}
9494

9595
export const LinkStory = Template.bind({});
96-
LinkStory.storyName = 'Link';
96+
LinkStory.storyName = 'Link';
97+
LinkStory.argTypes = {
98+
variant: { table: { disable: true } },
99+
};

stories/Components/Forms/Checkbox/Checkbox.stories.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,7 @@ const Template = (args, { globals: { locale } }) => {
118118
};
119119

120120
export const CheckboxStory = Template.bind({});
121-
122-
CheckboxStory.storyName = 'Checkbox';
121+
CheckboxStory.storyName = 'Checkbox';
122+
CheckboxStory.argTypes = {
123+
label_pos: {table : {disable: true}},
124+
};
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
import React, { useEffect } from 'react';
1+
import React, { useEffect, useRef } from 'react';
22
import './search-expand.scss';
33
import img from 'icons/search-black.svg';
44
import img_close from 'icons/times.svg';
55
import { expandSearch } from '../../../assets/js/expand-search';
66

77
export const SearchExpand = () => {
8+
const expandContainerRef = useRef(null);
9+
810
useEffect(() => {
9-
expandSearch();
11+
if (expandContainerRef.current) {
12+
expandSearch(jQuery(expandContainerRef.current));
13+
}
1014
}, []);
15+
1116
return (
12-
<div className="expand-search">
13-
<button className='expand-button'><img src={img} alt="search expand" /></button>
17+
<div className="expand-search" ref={expandContainerRef}>
18+
<button className='expand-button'>
19+
<img src={img} alt="search expand" />
20+
</button>
1421
<input type="text" aria-label="expand-search" />
15-
<button className='close-button'><img src={img_close} alt="search close" /></button>
22+
<button className='close-button'>
23+
<img src={img_close} alt="close search" />
24+
</button>
1625
</div>
1726
);
18-
};
27+
};

0 commit comments

Comments
 (0)