Skip to content

Commit c03d6bf

Browse files
committed
Use icon
1 parent 17a8425 commit c03d6bf

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codegouvfr/react-dsfr",
3-
"version": "0.0.19",
3+
"version": "0.0.20",
44
"description": "French State Design System React component library",
55
"repository": {
66
"type": "git",

src/bin/css_to_ts/icons.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import type { Icon } from "./css_to_ts";
33
import { parseCss } from "./parseCss";
44
import * as css from "css";
55
import { exclude } from "tsafe/exclude";
6-
import { assert } from "tsafe/assert";
76

87
type IconLike = Icon.Dsfr | Omit<Icon.Remixicon, "rawSvgCode">;
98

@@ -70,11 +69,11 @@ export const getPatchedRawCssCodeForCompatWithRemixIcon = memoize((rawCssCode: s
7069
(parsedCss as any).stylesheet.rules = (parsedCss as any).stylesheet.rules
7170
.map((rule: any) => {
7271
if (rule.type === "media") {
73-
//TODO
74-
7572
rule.rules = rule.rules
7673
.map((rule: any) => {
77-
assert(rule.type === "rule");
74+
if (rule.type !== "rule") {
75+
return undefined;
76+
}
7877

7978
if (prefixRegExp.test(rule.selectors.join(", "))) {
8079
return rule;
@@ -91,7 +90,9 @@ export const getPatchedRawCssCodeForCompatWithRemixIcon = memoize((rawCssCode: s
9190
return rule;
9291
}
9392

94-
assert(rule.type === "rule");
93+
if (rule.type !== "rule") {
94+
return undefined;
95+
}
9596

9697
if (prefixRegExp.test(rule.selectors.join(", "))) {
9798
return rule;

test/frameworks/vite/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<!--<link rel="preload" href="/dsfr/fonts/Spectral-ExtraBold.woff2" as="font" crossorigin="anonymous" />-->
2222

2323
<link rel="stylesheet" href="/dsfr/dsfr.min.css" />
24+
<link rel="stylesheet" href="/dsfr/utility/icons/icons.min.css" />
2425

2526
<title>Vite + React + TS</title>
2627
</head>

test/frameworks/vite/src/App.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
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-amazon-fill", "fr-btn--icon-left")}>
19+
Download
20+
</button>
21+
22+
1123
<h1>Color Scheme: {isDark ? "dark" : "light"}</h1>
1224
<button onClick={() => setIsDark(true)}>Set color scheme to dark</button>
1325
<button onClick={() => setIsDark(false)}>Set color scheme to light</button>

0 commit comments

Comments
 (0)