Skip to content

Commit 3dc93f3

Browse files
author
Julien Bouquillon
committed
fix
1 parent 52f4294 commit 3dc93f3

File tree

2 files changed

+20
-67
lines changed

2 files changed

+20
-67
lines changed

src/Breadcrumb.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { memo, forwardRef, useId } from "react";
22
import { symToStr } from "tsafe/symToStr";
33
import { useLink } from "./lib/routing";
4+
import { fr } from "./lib";
5+
import { cx } from "./lib/tools/cx";
46

57
// We make users import dsfr.css, so we don't need to import the scoped CSS
68
// but in the future if we have a complete component coverage it
@@ -15,6 +17,7 @@ export type BreadcrumbLink = {
1517
};
1618

1719
export type BreadcrumbProps = {
20+
className?: string;
1821
links: BreadcrumbLink[];
1922
};
2023

@@ -30,14 +33,19 @@ const trimLabel = (label: string) => {
3033
/** @see <https://react-dsfr-components.etalab.studio/?path=/docs/components-breadcrumb> */
3134
export const Breadcrumb = memo(
3235
forwardRef<HTMLDivElement, BreadcrumbProps>(props => {
33-
const { links } = props;
36+
const { links, className, ...rest } = props;
3437

38+
<div className={cx(fr.cx("fr-highlight"), className)} {...rest}></div>;
3539
const router = useRouter();
3640
const { Link } = useLink();
3741
const breadcrumbId = useId();
3842

3943
return (
40-
<nav role="navigation" className="fr-breadcrumb" aria-label="vous êtes ici :">
44+
<nav
45+
role="navigation"
46+
className={cx(fr.cx("fr-breadcrumb"), className)}
47+
aria-label="vous êtes ici :"
48+
>
4149
<button
4250
className="fr-breadcrumb__button"
4351
aria-expanded="false"

stories/Breadcrumb.stories.tsx

Lines changed: 10 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -14,71 +14,16 @@ const { meta, getStory } = getStoryFactory({
1414
export default meta;
1515

1616
export const Default = getStory({
17-
label: "io"
18-
// links: [
19-
// { label: "Accueil", href = "/" },
20-
// { label: "Articles", href: "/articles" },
21-
// { label: "Le premier", href: "/articles/first" }
22-
// ]
23-
//...logCallbacks(["onClick"])
17+
links: [
18+
{ label: "Accueil", href: "/" },
19+
{ label: "Page 1", href: "/page1" }
20+
]
2421
});
2522

26-
export const BreadcrumbSecondary = getStory({
27-
//"priority": "secondary",
28-
"label": "Simple button - secondary"
29-
// ...logCallbacks(["onClick"])
23+
export const LongBreadcrumb = getStory({
24+
links: [
25+
{ label: "Accueil", href: "/" },
26+
{ label: "Page 1", href: "/page1" },
27+
{ label: "Article avec un titre très très long", href: "/article1" }
28+
]
3029
});
31-
32-
// export const ButtonTertiary = getStory({
33-
// "priority": "tertiary",
34-
// "label": "Simple button - tertiary",
35-
// ...logCallbacks(["onClick"])
36-
// });
37-
38-
// export const ButtonDisabled = getStory({
39-
// "label": "Simple button - disabled",
40-
// "disabled": true,
41-
// ...logCallbacks(["onClick"])
42-
// });
43-
44-
// export const ButtonWithIconDefault = getStory({
45-
// "label": "Simple button with icon",
46-
// "icon": {
47-
// iconId: "fr-icon-account-circle-fill"
48-
// },
49-
// ...logCallbacks(["onClick"])
50-
// });
51-
52-
// export const ButtonWithIconLeft = getStory({
53-
// "label": "Simple button with icon",
54-
// "icon": {
55-
// "iconId": "fr-icon-account-circle-fill",
56-
// "position": "left"
57-
// },
58-
// ...logCallbacks(["onClick"])
59-
// });
60-
61-
// export const ButtonWithIconRight = getStory({
62-
// "label": "Simple button with icon",
63-
// "icon": {
64-
// "iconId": "fr-icon-account-circle-fill",
65-
// "position": "right"
66-
// },
67-
// ...logCallbacks(["onClick"])
68-
// });
69-
70-
// export const DefaultAnchorButton = getStory({
71-
// "label": "Simple button - with href (anchor)",
72-
// "linkProps": {
73-
// "href": "https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bouton",
74-
// "target": "_blank"
75-
// }
76-
// });
77-
78-
// export const DefaultAnchorButtonWithTargetBlank = getStory({
79-
// "label": "Simple button - with href (anchor) and target _blank",
80-
// "linkProps": {
81-
// "target": "_blank",
82-
// "href": "https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bouton"
83-
// }
84-
// });

0 commit comments

Comments
 (0)