Skip to content

Commit 4752e86

Browse files
committed
Move stories into the docs directory
1 parent cb8a35e commit 4752e86

File tree

7 files changed

+9
-19
lines changed

7 files changed

+9
-19
lines changed

.storybook/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
"stories": [
3-
"../test/stories/**/*.stories.mdx",
4-
"../test/stories/**/*.stories.@(ts|tsx)",
3+
"../docs/*.stories.mdx",
4+
"../docs/*.stories.@(ts|tsx)",
55
],
66
"addons": [
77
"@storybook/addon-links",

README.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ Here are instructions for contributing, if you are looking to **use** `@codegouv
5656
git clone https://github.com/codegouvfr/react-dsfr
5757
cd react-dsfr
5858
yarn
59-
yarn build
60-
npx tsc -p src/bin -w & npx tsc -p src -w
61-
# Open another Terminal
6259
yarn start-cra # For testing in in a Create React App setup
6360
yarn start-next # For testing in a Next.js setup
6461
yarn start_vite # For testing in a Vite setup
@@ -69,14 +66,8 @@ yarn test
6966
npx vitest -t "Resolution of CSS variables"
7067

7168
# Debugging while unit testing
72-
73-
7469
```
7570

76-
> When you want to import assets from the `./dsfr/` directory
77-
> you must assume it's located in `./src/dsfr` because it's where
78-
> it's going to be relative to the transpiled JS files.
79-
8071
## How to publish a new version on NPM, how to release a beta version
8172

8273
This repo was bootstrapped form [garronej/ts-ci](https://github.com/garronej/ts-ci) have a look at the

test/stories/Alert.stories.tsx renamed to docs/Alert.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Alert } from "../../dist/Alert";
1+
import { Alert } from "../dist/Alert";
22
import { sectionName } from "./sectionName";
33
import { getStoryFactory } from "./getStory";
44

@@ -12,6 +12,6 @@ export default meta;
1212

1313
export const Success = getStory({
1414
"severity": "success",
15-
"title": "Message sucessfuly sent",
15+
"title": "Message successfully sent",
1616
"description": "Everything went well"
1717
});

test/stories/getStory.tsx renamed to docs/getStory.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import React, { useEffect } from "react";
22
import type { Meta, Story } from "@storybook/react";
33
import type { ArgType } from "@storybook/addons";
44
import { symToStr } from "tsafe/symToStr";
5-
import { startDsfrReact, useIsDark, useColors } from "../../dist";
65
import { id } from "tsafe/id";
7-
import { GlobalStyles } from "tss-react/compat";
8-
9-
import "../../dist/dsfr/dsfr.css";
6+
import { GlobalStyles } from "tss-react";
7+
import "../dist/dsfr/dsfr.css";
8+
import { startDsfrReact, useIsDark, useColors } from "../dist";
109

1110
startDsfrReact({ "defaultColorScheme": "system" });
1211

@@ -68,7 +67,7 @@ export function getStoryFactory<Props extends Record<string, any>>(params: {
6867
const out = Template.bind({});
6968

7069
out.args = {
71-
"darkMode": false,
70+
"darkMode": window.matchMedia("(prefers-color-scheme: dark)").matches,
7271
"width": defaultWidth ?? 0,
7372
...props
7473
};
File renamed without changes.
File renamed without changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"format": "yarn _format --write",
2222
"format:check": "yarn _format --list-different",
2323
"grant_exec_perms": "node dist/bin/tools/grant_exec_perms",
24-
"storybook": "yarn build -w && start-storybook -p 6006",
24+
"storybook": "yarn build && ((tsc -w -p src) & start-storybook -p 6006)",
2525
"build-storybook": "yarn build && build-storybook"
2626
},
2727
"bin": {

0 commit comments

Comments
 (0)