Skip to content

Commit 84a271b

Browse files
committed
Setup icon in cra
1 parent 8af1b75 commit 84a271b

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

test/integration/cra/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
"test": "react-scripts test",
2121
"eject": "react-scripts eject",
2222
"copy_dsfr_dist_to_public": "node node_modules/@codegouvfr/react-dsfr/bin/copy_dsfr_dist_to_public.js",
23-
"prestart": "yarn copy_dsfr_dist_to_public",
24-
"prebuild": "yarn copy_dsfr_dist_to_public"
23+
"only_include_used_icons": "node node_modules/@codegouvfr/react-dsfr/bin/only_include_used_icons.js",
24+
"prestart": "yarn copy_dsfr_dist_to_public && yarn only_include_used_icons",
25+
"prebuild": "yarn copy_dsfr_dist_to_public && yarn only_include_used_icons"
2526
},
2627
"eslintConfig": {
2728
"extends": [

test/integration/cra/public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<% }); %>
2929

3030
<link rel="stylesheet" href="%PUBLIC_URL%/dsfr/dsfr.min.css" />
31+
<link rel="stylesheet" href="%PUBLIC_URL%/dsfr/utility/icons/icons.min.css" />
3132

3233
<!--
3334
Notice the use of %PUBLIC_URL% in the tags above.

test/integration/cra/src/App.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
import artworkLightSvgUrl from "@codegouvfr/react-dsfr/dsfr/artwork/light.svg";
22
import artworkDarkSvgUrl from "@codegouvfr/react-dsfr/dsfr/artwork/dark.svg";
33
import artworkSystemSvgUrl from "@codegouvfr/react-dsfr/dsfr/artwork/system.svg";
4-
import { useIsDark } from "@codegouvfr/react-dsfr";
4+
import { useIsDark, fr } from "@codegouvfr/react-dsfr";
55

66
export function App() {
77
const { isDark, setIsDark } = useIsDark();
88

99
return (
1010
<>
11+
12+
<button className={fr.cx("fr-btn", "fr-icon-checkbox-circle-line", "fr-btn--icon-left")}>
13+
Label bouton MD
14+
</button>
15+
<span className="fr-icon-ancient-gate-fill" aria-hidden="true"></span>
16+
<i className="fr-icon-ancient-gate-fill" aria-hidden="true"/>
17+
18+
<button className={fr.cx("fr-btn", "ri-24-hours-fill", "fr-btn--icon-left")}>
19+
Download
20+
</button>
21+
1122
<h1>Color Scheme: {isDark ? "dark" : "light"}</h1>
1223
<button onClick={() => setIsDark(true)}>Set color scheme to dark</button>
1324
<button onClick={() => setIsDark(false)}>Set color scheme to light</button>

0 commit comments

Comments
 (0)