Skip to content

Commit 58ed41e

Browse files
author
Julien Bouquillon
committed
fix
1 parent 56d10ea commit 58ed41e

File tree

2 files changed

+51
-8
lines changed

2 files changed

+51
-8
lines changed

src/Quote.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,30 @@ export type QuoteProps = {
1818
source?: ReactNode;
1919
sourceUrl?: string;
2020
image?: string;
21+
size?: "md" | "lg" | "xl";
2122
};
2223

2324
/** @see <https://react-dsfr-components.etalab.studio/?path=/docs/components-quote> */
2425
export const Quote = memo(
2526
forwardRef<HTMLDivElement, QuoteProps>((props, ref) => {
26-
const { className, text, author, source, sourceUrl, image, ...rest } = props;
27+
const { className, text, author, source, sourceUrl, image, size, ...rest } = props;
2728

2829
assert<Equals<keyof typeof rest, never>>();
2930

3031
return (
3132
<figure
32-
className={cx(fr.cx("fr-quote"), fr.cx("fr-quote--column"), className)}
33+
className={cx(fr.cx("fr-quote"), image && fr.cx("fr-quote--column"), className)}
3334
ref={ref}
3435
>
3536
<blockquote cite={sourceUrl}>
36-
<p>« {text} »</p>
37+
<p
38+
className={cx(
39+
size === "lg" && fr.cx("fr-text--lg"),
40+
size === "md" && fr.cx("fr-text--md")
41+
)}
42+
>
43+
« {text} »
44+
</p>
3745
</blockquote>
3846
<figcaption>
3947
{author && <p className="fr-quote__author">{author}</p>}

stories/Quote.stories.tsx

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const { meta, getStory } = getStoryFactory({
77
sectionName,
88
"wrappedComponent": { Quote },
99
"description": `
10-
- [See DSFR documentation](https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/citation)
11-
- [See source code](https://github.com/codegouvfr/react-dsfr/blob/main/src/Quote.tsx)`,
10+
- [See DSFR documentation](//www.systeme-de-design.gouv.fr/elements-d-interface/composants/citation)
11+
- [See source code](//github.com/codegouvfr/react-dsfr/blob/main/src/Quote.tsx)`,
1212
"disabledProps": ["lang"]
1313
});
1414

@@ -35,18 +35,46 @@ export const Default = getStory({
3535
</li>
3636
</>
3737
),
38-
image: "https://www.systeme-de-design.gouv.fr/img/placeholder.1x1.png"
38+
image: "//www.systeme-de-design.gouv.fr/img/placeholder.1x1.png",
39+
size: "xl",
40+
className: ""
41+
});
42+
43+
export const QuoteMediumAndAccent = getStory({
44+
text: "Lorem [...] elit ut. ",
45+
author: "Auteur",
46+
source: (
47+
<>
48+
<li>
49+
<cite>Ouvrage</cite>
50+
</li>
51+
<li>Détail 1</li>
52+
<li>Détail 2</li>
53+
<li>Détail 3</li>
54+
<li>
55+
<a
56+
target="_blank"
57+
href="[À MODIFIER | Lien vers la sources ou des infos complémentaires]"
58+
>
59+
Détail 4
60+
</a>
61+
</li>
62+
</>
63+
),
64+
image: "//www.systeme-de-design.gouv.fr/img/placeholder.1x1.png",
65+
size: "md",
66+
className: "fr-quote--green-emeraude"
3967
});
4068

4169
export const QuoteWithoutDetails = getStory({
4270
text: "Lorem [...] elit ut. ",
4371
author: "Auteur",
44-
image: "https://www.systeme-de-design.gouv.fr/img/placeholder.1x1.png"
72+
image: "//www.systeme-de-design.gouv.fr/img/placeholder.1x1.png"
4573
});
4674

4775
export const QuoteWithoutSource = getStory({
4876
text: "Lorem [...] elit ut. ",
49-
image: "https://www.systeme-de-design.gouv.fr/img/placeholder.1x1.png"
77+
image: "//www.systeme-de-design.gouv.fr/img/placeholder.1x1.png"
5078
});
5179

5280
export const QuoteWithoutIllustration = getStory({
@@ -71,3 +99,10 @@ export const QuoteWithoutIllustration = getStory({
7199
</>
72100
)
73101
});
102+
103+
export const QuoteWithAccent = getStory({
104+
text: "Lorem [...] elit ut. ",
105+
image: "//www.systeme-de-design.gouv.fr/img/placeholder.1x1.png",
106+
className: "fr-quote--green-emeraude",
107+
author: "Someone"
108+
});

0 commit comments

Comments
 (0)