Skip to content

Commit a75d626

Browse files
committed
Try to find a way to get storybook working as well as gitbook
1 parent 33f84f0 commit a75d626

File tree

3 files changed

+84
-5
lines changed

3 files changed

+84
-5
lines changed

.storybook/customTheme.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const fontCode= "monospace";
88

99
export const darkTheme = create({
1010
"base": "dark",
11-
"appBg": "#161616",
12-
"appContentBg": "#1E1E1E",
13-
"barBg": "#1E1E1E",
11+
"appBg": "#1E1E1E",
12+
"appContentBg": "#161616",
13+
"barBg": "#161616",
1414
"colorSecondary": "#8585F6",
1515
"textColor": "#FFFFFF",
1616
brandImage,
@@ -22,8 +22,8 @@ export const darkTheme = create({
2222

2323
export const lightTheme = create({
2424
"base": "light",
25-
"appBg": "#FFFFFF",
26-
"appContentBg": "#F6F6F6",
25+
"appBg": "#F6F6F6",
26+
"appContentBg": "#FFFFFF",
2727
"barBg": "#FFFFFF",
2828
"colorSecondary": "#000091",
2929
"textColor": "#212121",

docs/intro.stories.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ import { useDarkMode } from "storybook-dark-mode";
2121

2222
This module is a React integration layer for [@gouvfr/dsfr](https://github.com/GouvernementFR/dsfr), the vanilla JS/CSS implementation of the DSFR.
2323
Comes with very precise type definitions. (But works fine in vanilla JavaScript projects.)
24+
<br/>
25+
This is <a href="https://github.com/codegouvfr/react-dsfr">@codegouvfr/react-dsfr</a>
2426
</div>

docs/quick-start.stories.mdx

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Meta } from "@storybook/addon-docs";
22
import { Alert } from "../dist/Alert";
3+
import { Tabs } from "../dist/Tabs";
34
import ReactMarkdown from "react-markdown";
45

56

@@ -36,3 +37,79 @@ _Setup `@codegouvfr/react-dsfr` in your project_
3637
yarn add @codegouvfr/react-dsfr # Or: 'npm install --save @codegouvfr/react-dsfr'
3738
```
3839

40+
export const craContent =
41+
`# The content
42+
43+
\`\`\`diff
44+
"scripts": {
45+
+ "postinstall": "copy-dsfr-to-public"
46+
+ "prestart": "only-include-used-icons",
47+
+ "prebuild": "only-include-used-icons"
48+
}
49+
\`\`\`
50+
\`\`\`tsx
51+
const node =(<div>ok</div>);
52+
\`\`\`
53+
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+
77+
#### .gitignore
78+
79+
```diff
80+
+ /public/dsfr
81+
```
82+
83+
#### public/index.html
84+
85+
Add the following code in the `<head />`&#x20;
86+
87+
```ejs
88+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/dsfr/favicon/apple-touch-icon.png" />
89+
<link rel="icon" href="%PUBLIC_URL%/dsfr/favicon/favicon.svg" type="image/svg+xml" />
90+
<link rel="shortcut icon" href="%PUBLIC_URL%/dsfr/favicon/favicon.ico" type="image/x-icon" />
91+
<link rel="manifest" href="%PUBLIC_URL%/dsfr/favicon/manifest.webmanifest" crossorigin="use-credentials" />
92+
<link rel="stylesheet" href="%PUBLIC_URL%/dsfr/dsfr.min.css" />
93+
<link rel="stylesheet" href="%PUBLIC_URL%/dsfr/utility/icons/icons.min.css" />
94+
```
95+
96+
#### src/index.tsx
97+
98+
```diff
99+
import React from 'react';
100+
import ReactDOM from 'react-dom/client';
101+
import App from './App';
102+
+import { startDsfrReact } from "@codegouvfr/react-dsfr";
103+
+startDsfrReact({ "defaultColorScheme": "system" });
104+
const root = ReactDOM.createRoot(
105+
document.getElementById('root') as HTMLElement
106+
);
107+
root.render(
108+
<React.StrictMode>
109+
<App />
110+
</React.StrictMode>
111+
);
112+
```
113+
114+
You can find an example setup [here](https://github.com/codegouvfr/dsfr-react/tree/main/src/test/frameworks/cra).
115+

0 commit comments

Comments
 (0)