11import { Meta } from " @storybook/addon-docs" ;
22import { Alert } from " ../dist/Alert" ;
33import { Tabs } from " ../dist/Tabs" ;
4- import ReactMarkdown from " react-markdown " ;
4+ import { Markdown } from " ./Markdown " ;
55
66
77<Meta
@@ -19,83 +19,59 @@ import ReactMarkdown from "react-markdown";
1919
2020
2121# 🔧 Initial setup
22-
22+
2323_ Setup ` @codegouvfr/react-dsfr ` in your project_
24-
24+
2525<Alert
2626 severity = " warning"
2727 title = " Warning: If you already had the DSFR installed in your project"
2828 isClosable
29- description = { <ReactMarkdown > {
30- ` * Remove [\` @gouvfr/dsfr\` ](https://www.npmjs.com/package/@gouvfr/dsfr) from your dependencies.
29+ description = { <Markdown > { `
30+ * Remove [\` @gouvfr/dsfr\` ](https://www.npmjs.com/package/@gouvfr/dsfr) from your dependencies.
3131* Remove all imports: \` dsfr.css\` , \` dsfr.module.js\` the favicon and the fonts.
3232* Remove the \` data-fr-scheme\` (and \` data-fr-theme\` ) attribude from your \` <html/>\` tag. `
33- } </ReactMarkdown >}
33+ } </Markdown >}
3434/>
3535
3636``` bash
3737yarn add @codegouvfr/react-dsfr # Or: 'npm install --save @codegouvfr/react-dsfr'
3838```
3939
40- export const craContent =
41- ` # The content
40+ export const craContent = < Markdown > { `
41+ #### package.json
4242
43- \`\`\` diff
43+ \`\`\` diff {0}
4444 "scripts": {
45- + "postinstall": "copy-dsfr-to-public"
46- + "prestart": "only-include-used-icons",
47- + "prebuild": "only-include-used-icons"
45+ + "postinstall": "copy-dsfr-to-public"
46+ + "prestart": "only-include-used-icons",
47+ + "prebuild": "only-include-used-icons"
4848 }
4949\`\`\`
50- \`\`\` tsx
51- const node =(<div>ok</div>);
52- \`\`\`
5350
54- ` ;
55-
56-
57- <Tabs
58- tabs = { [
59- { " label" : " Create React App" , " content" : <ReactMarkdown >{ craContent } </ReactMarkdown > },
60- { " label" : " Tab 2" , " iconId" : " fr-icon-ball-pen-fill" , " content" : <p >Content of tab2</p > },
61- { " label" : " Tab 3" , " content" : <p >Content of tab3</p > }
62- ]}
63- />
64-
65- #### package.json
66-
67- ``` diff
68- "scripts": {
69- + "postinstall": "copy-dsfr-to-public"
70- + "prestart": "only-include-used-icons",
71- + "prebuild": "only-include-used-icons"
72- }
73- ```
74-
75- ` update_dsfr_static_resources ` is a ` bin ` script of ` @codegouvfr/react-dsfr ` that copies ` @gouvfr/dsfr/dist ` into ` public/dsfr `
76-
51+ \` copy-dsfr-to-public\` is a \` bin\` script of \` @codegouvfr/react-dsfr\` that copies \` @gouvfr/dsfr/dist\` into \` public/dsfr\`
52+
7753#### .gitignore
78-
79- `` `diff
54+
55+ \`\`\ ` diff {0}
8056+ /public/dsfr
81- `` `
82-
57+ \`\`\ `
58+
8359#### public/index.html
84-
85- Add the following code in the ` <head /> ` &#x 20 ;
86-
87- `` `ejs
60+
61+ Add the following code in the \ ` <head />\`
62+
63+ \`\`\ ` ejs {0}
8864<link rel="apple-touch-icon" href="%PUBLIC_URL%/dsfr/favicon/apple-touch-icon.png" />
8965<link rel="icon" href="%PUBLIC_URL%/dsfr/favicon/favicon.svg" type="image/svg+xml" />
9066<link rel="shortcut icon" href="%PUBLIC_URL%/dsfr/favicon/favicon.ico" type="image/x-icon" />
9167<link rel="manifest" href="%PUBLIC_URL%/dsfr/favicon/manifest.webmanifest" crossorigin="use-credentials" />
9268<link rel="stylesheet" href="%PUBLIC_URL%/dsfr/dsfr.min.css" />
9369<link rel="stylesheet" href="%PUBLIC_URL%/dsfr/utility/icons/icons.min.css" />
94- `` `
95-
70+ \`\`\ `
71+
9672#### src/index.tsx
97-
98- `` `diff
73+
74+ \`\`\ ` diff {0}
9975 import React from 'react';
10076 import ReactDOM from 'react-dom/client';
10177 import App from './App';
@@ -109,7 +85,17 @@ Add the following code in the `<head />` 
10985 <App />
11086 </React.StrictMode>
11187 );
112- `` `
113-
88+ \`\`\ `
89+
11490You can find an example setup [here](https://github.com/codegouvfr/dsfr-react/tree/main/src/test/frameworks/cra).
91+
92+ ` } </Markdown >;
93+
11594
95+ <Tabs
96+ tabs = { [
97+ { " label" : " Create React App" , " content" : craContent },
98+ { " label" : " Tab 2" , " iconId" : " fr-icon-ball-pen-fill" , " content" : <p >Content of tab2</p > },
99+ { " label" : " Tab 3" , " content" : <p >Content of tab3</p > }
100+ ]}
101+ />
0 commit comments