Skip to content

Commit b04c0aa

Browse files
committed
all: stop importing CSS files from library code
We were importing CSS files directly from library code. This causes issues for downstream users, because they are forced to configure their build system to support CSS imports (e.g. webpack doesn't support this by default). Moreover, this makes it impossible to use the library without a build system (e.g. importing it directly from pure HTML/JS files). Make users responsible for including the CSS one way or another. Our stories do this using CSS imports already, but other downstream consumers might prefer to use a <link> or similar. Signed-off-by: Simon Ser <[email protected]>
1 parent 4a07429 commit b04c0aa

File tree

10 files changed

+11
-15
lines changed

10 files changed

+11
-15
lines changed

package-lock.json

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

storybook/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,9 @@
1919
"clean": "rimraf storybook-static",
2020
"start": "storybook dev -p 6006",
2121
"build": "storybook build"
22+
},
23+
"dependencies": {
24+
"@osrd-project/ui-core": "0.0.1-dev",
25+
"@osrd-project/ui-trackoccupancydiagram": "0.0.1-dev"
2226
}
2327
}

storybook/stories/TrackOccupancyDiagram/TrackOccupancyDiagram.stories.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ import {
3737
import occupancyZones from '../samples/TrackOccupancyDiagramSamples/occupancyZones';
3838
import tracks from '../samples/TrackOccupancyDiagramSamples/tracks';
3939

40+
import '@osrd-project/ui-core/dist/theme.css';
41+
import '@osrd-project/ui-trackoccupancydiagram/dist/theme.css';
42+
4043
type TrackOccupancyDiagramProps = {
4144
xZoomLevel: number;
4245
yZoomLevel: number;

ui-core/src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './styles/main.css';
2-
31
export { default as Button, ButtonProps } from './components/buttons/Button';
42
export {
53
default as ComboBox,
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './styles/main.css';
2-
31
export { default as useManchettesWithSpaceTimeChart } from './hooks/useManchetteWithSpaceTimeChart';
42
export { DEFAULT_ZOOM_MS_PER_PX } from './consts';
53
export { timeScaleToZoomValue } from './helpers';

ui-manchette/src/components/Waypoint.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import cx from 'classnames';
44

55
import { type InteractiveWaypoint } from '../types';
6-
import '@osrd-project/ui-core/dist/theme.css';
76
import { positionMmToKm } from '../utils';
87

98
type WaypointProps = {

ui-manchette/src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import '@osrd-project/ui-core/dist/theme.css';
2-
import './styles/main.css';
31
import './components/consts';
42

53
import Manchette from './components/Manchette';

ui-spacetimechart/src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './styles/main.css';
2-
31
export type { HoveredItem, SpaceTimeChartProps } from './lib/types';
42

53
export * from './components/SpaceTimeChart';

ui-speedspacechart/src/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
import '@osrd-project/ui-core/dist/theme.css';
2-
import './styles/main.css';
3-
41
export { default as SpeedSpaceChart } from './components/SpeedSpaceChart';

ui-trackoccupancydiagram/src/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
import '@osrd-project/ui-core/dist/theme.css';
2-
import './styles/main.css';
3-
41
export { default as TrackOccupancyCanvas } from './components/TrackOccupancyCanvas';
52
export { default as TrackOccupancyManchette } from './components/TrackOccupancyManchette';

0 commit comments

Comments
 (0)