Skip to content

Commit e641695

Browse files
YohhUriel-Sautron
andcommitted
ui-trackoccupancydiagram: setup sub-repo
Co-authored-by: Uriel-Sautron <[email protected]> Signed-off-by: Yohh <[email protected]>
1 parent c0df267 commit e641695

16 files changed

+174
-7
lines changed

package-lock.json

+29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"ui-warped-map",
1818
"ui-manchette",
1919
"ui-manchette-with-spacetimechart",
20+
"ui-trackoccupancydiagram",
2021
"storybook"
2122
],
2223
"engines": {

storybook/.storybook/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { mergeConfig } from 'vite';
55
/** @type { import('@storybook/html-vite').StorybookConfig } */
66
const config: StorybookConfig = {
77
stories: [
8-
'../stories/**/stories.ts',
9-
'../../**/src/**/*.mdx',
8+
// TODO: remove this when every stories are migrated to `@osrd-project/stroybook/stories/`
109
'../../**/src/**/*.stories.@(js|jsx|mjs|ts|tsx)',
10+
'../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
1111
],
1212
addons: [
1313
getAbsolutePath('@storybook/addon-links'),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from 'react';
2+
3+
import {
4+
TrackOccupancyManchette,
5+
TrackOccupancyCanvas,
6+
} from '@osrd-project/ui-trackoccupancydiagram';
7+
import type { Meta, StoryObj } from '@storybook/react';
8+
9+
const TrackOccupancyDiagram = () => (
10+
<div>
11+
<TrackOccupancyManchette />
12+
<TrackOccupancyCanvas />
13+
</div>
14+
);
15+
16+
const meta: Meta<typeof TrackOccupancyDiagram> = {
17+
title: 'TrackOccupancyDiagram/Rendering',
18+
component: TrackOccupancyDiagram,
19+
decorators: [(Story) => <Story />],
20+
parameters: {
21+
layout: 'centered',
22+
backgrounds: {
23+
default: 'dark',
24+
},
25+
},
26+
27+
render: () => <TrackOccupancyDiagram />,
28+
tags: ['autodocs'],
29+
};
30+
31+
export default meta;
32+
33+
type Story = StoryObj<typeof TrackOccupancyDiagram>;
34+
35+
export const TrackOccupancyDiagramStoryDefault: Story = {
36+
args: {},
37+
};

storybook/stories/just-a-test.mdx

-3
This file was deleted.

storybook/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"extends": "../tsconfig.base.json",
3-
"include": [".storybook/*.tsx", "./stories/**/*"],
3+
"include": [".storybook/*.tsx", "stories/**/*"],
44
"compilerOptions": {
5-
"rootDir": "./src",
5+
"rootDir": "./",
66
"outDir": "./dist",
77
"declarationDir": "./dist"
88
}

ui-trackoccupancydiagram/README.md

Whitespace-only changes.

ui-trackoccupancydiagram/package.json

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@osrd-project/ui-trackoccupancydiagram",
3+
"version": "0.0.1-dev",
4+
"license": "LGPL-3.0-or-later",
5+
"bugs": "https://github.com/osrd-project/osrd-ui/issues",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/osrd-project/osrd-ui.git",
9+
"directory": "ui-trackoccupancydiagram"
10+
},
11+
"publishConfig": {
12+
"access": "public"
13+
},
14+
"type": "module",
15+
"module": "./dist/index.esm.js",
16+
"types": "./dist/index.d.ts",
17+
"main": "./dist/index.esm.js",
18+
"style": "dist/theme.css",
19+
"files": [
20+
"/dist"
21+
],
22+
"exports": {
23+
"./dist/theme.css": "./dist/theme.css",
24+
".": {
25+
"types": "./dist/index.d.ts",
26+
"default": "./dist/index.esm.js"
27+
}
28+
},
29+
"scripts": {
30+
"rollup": "rollup -c",
31+
"clean": "rimraf dist",
32+
"build": "npm run rollup",
33+
"watch": "NODE_ENV=development rollup -c -w",
34+
"test": "vitest run --dir src/__tests__",
35+
"prepublishOnly": "npm run clean && npm run build",
36+
"lint": "eslint src --max-warnings 0",
37+
"lint:fix": "eslint src --fix"
38+
},
39+
"dependencies": {
40+
"@types/chroma-js": "^2.4.4",
41+
"chroma-js": "^3.1.1",
42+
"classnames": "^2.5.1",
43+
"tailwindcss": "^3.4.1"
44+
},
45+
"peerDependencies": {
46+
"react": ">=18.0"
47+
},
48+
"devDependencies": {
49+
"autoprefixer": "^10.4.17",
50+
"postcss": "^8.4.37",
51+
"postcss-assets": "^6.0.0",
52+
"postcss-import": "^16.0.0",
53+
"postcss-preset-env": "^10.0.5",
54+
"rollup-plugin-livereload": "^2.0.5",
55+
"rollup-plugin-postcss": "^4.0.2",
56+
"rollup-plugin-serve": "^1.1.1"
57+
}
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import generateBaseRollupConfig from '../rollup-base.config.js';
2+
3+
export default generateBaseRollupConfig('osrdcore', ['react']);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { describe, expect, it } from 'vitest';
2+
3+
describe('test to remove', () => {
4+
it('should return the good value', () => {
5+
expect(1 + 1).toEqual(2);
6+
});
7+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
3+
const TrackOccupancyCanvas = () => <div>TrackOccupancyCanvas</div>;
4+
5+
export default TrackOccupancyCanvas;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
3+
const TrackOccupancyManchette = () => <div>TrackOccupancyManchette</div>;
4+
5+
export default TrackOccupancyManchette;

ui-trackoccupancydiagram/src/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import './styles/main.css';
2+
3+
import TrackOccupancyCanvas from './components/TrackOccupancyCanvas';
4+
import TrackOccupancyManchette from './components/TrackOccupancyManchette';
5+
6+
export { TrackOccupancyCanvas, TrackOccupancyManchette };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import 'tailwindcss/base';
2+
@import 'tailwindcss/components';
3+
@import 'tailwindcss/utilities';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import osrdUiPreset from '../tailwind-preset.js';
2+
/** @type {import('tailwindcss').Config} */
3+
export default {
4+
presets: [osrdUiPreset],
5+
content: ['./src/**/*.{js,jsx,ts,tsx}'],
6+
};
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../tsconfig.base.json",
3+
"include": ["./src/**/*"],
4+
"compilerOptions": {
5+
"rootDir": "./src",
6+
"outDir": "./dist",
7+
"declarationDir": "./dist",
8+
"typeRoots": ["./node_modules/@types", "../raw.d.ts"]
9+
}
10+
}

0 commit comments

Comments
 (0)