Skip to content

Commit

Permalink
storybook: move manchette's stories into /storybook
Browse files Browse the repository at this point in the history
Signed-off-by: Clara Ni <[email protected]>
  • Loading branch information
clarani committed Mar 7, 2025
1 parent 5188d5b commit ec1ee77
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 59 deletions.
34 changes: 0 additions & 34 deletions storybook/stories/ManchetteSplit/sampleData.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Manchette } from '@osrd-project/ui-charts';
import '@osrd-project/ui-core/dist/theme.css';
import '@osrd-project/ui-charts/dist/theme.css';
import type { Meta, StoryObj } from '@storybook/react';

import { SAMPLE_WAYPOINTS } from './assets/sampleData';
import Manchette from '../components/Manchette';

const meta: Meta<typeof Manchette> = {
component: Manchette,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Manchette } from '@osrd-project/ui-charts';
import '@osrd-project/ui-core/dist/theme.css';
import type { Meta, StoryObj } from '@storybook/react';

import WAYPOINTS_DATA from './sampleData';
import { SAMPLE_WAYPOINTS } from './assets/sampleData';

const meta: Meta<typeof Manchette> = {
component: Manchette,
Expand All @@ -26,12 +26,12 @@ const customDiv = (
export const Default: Story = {
args: {
contents: [
WAYPOINTS_DATA[0],
SAMPLE_WAYPOINTS[0],
customDiv,
WAYPOINTS_DATA[1],
WAYPOINTS_DATA[2],
SAMPLE_WAYPOINTS[1],
SAMPLE_WAYPOINTS[2],
customDiv,
WAYPOINTS_DATA[3],
SAMPLE_WAYPOINTS[3],
customDiv,
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Waypoint } from '../../types';
import { type Waypoint } from '@osrd-project/ui-charts';

export const SAMPLE_WAYPOINTS: Waypoint[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type ProjectPathTrainResult, type Waypoint } from '../../Manchette';
import { type ProjectPathTrainResult, type Waypoint } from '@osrd-project/ui-charts';

export const SAMPLE_WAYPOINTS: Waypoint[] = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import React, { useEffect, useRef, useState } from 'react';

import {
PathLayer,
SpaceTimeChart,
Manchette,
type ProjectPathTrainResult,
type Waypoint,
useManchetteWithSpaceTimeChart,
} from '@osrd-project/ui-charts';
import { EyeClosed, Telescope } from '@osrd-project/ui-icons';
import type { Meta } from '@storybook/react';
import '@osrd-project/ui-core/dist/theme.css';
import '@osrd-project/ui-charts/dist/theme.css';
import cx from 'classnames';
import { createPortal } from 'react-dom';

import { SAMPLE_PATHS_DATA, SAMPLE_WAYPOINTS } from './assets/sampleData';
import Menu, { type MenuItem } from './Menu';
import { PathLayer, SpaceTimeChart } from '../../../spaceTimeChart';
import Manchette, { type ProjectPathTrainResult, type Waypoint } from '../../Manchette';
import { SAMPLE_WAYPOINTS, SAMPLE_PATHS_DATA } from '../assets/sampleData';
import useManchettesWithSpaceTimeChart from '../hooks/useManchetteWithSpaceTimeChart';

type ManchetteWithSpaceTimeWrapperProps = {
waypoints: Waypoint[];
Expand Down Expand Up @@ -63,7 +68,7 @@ const ManchetteWithSpaceTimeWrapper = ({
setActiveWaypointId(waypointId);
};

const { manchetteProps, spaceTimeChartProps, handleScroll } = useManchettesWithSpaceTimeChart(
const { manchetteProps, spaceTimeChartProps, handleScroll } = useManchetteWithSpaceTimeChart(
waypoints,
projectPathTrainResult,
manchetteWithSpaceTimeChartRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React, { useRef } from 'react';

import type { Meta } from '@storybook/react';

import '@osrd-project/ui-core/dist/theme.css';
import '@osrd-project/ui-charts/dist/theme.css';
import {
PathLayer,
SpaceTimeChart,
Manchette,
useManchetteWithSpaceTimeChart,
type ProjectPathTrainResult,
type Waypoint,
} from '@osrd-project/ui-charts';
import type { Meta } from '@storybook/react';

import { PathLayer, SpaceTimeChart } from '../../../spaceTimeChart';
import Manchette, { type ProjectPathTrainResult, type Waypoint } from '../../Manchette';
import { SAMPLE_WAYPOINTS, SAMPLE_PATHS_DATA } from '../assets/sampleData';
import useManchettesWithSpaceTimeChart from '../hooks/useManchetteWithSpaceTimeChart';
import { SAMPLE_WAYPOINTS, SAMPLE_PATHS_DATA } from './assets/sampleData';

type ManchetteWithSpaceTimeWrapperProps = {
waypoints: Waypoint[];
Expand All @@ -25,7 +29,7 @@ const ManchetteWithSpaceTimeWrapper = ({
}: ManchetteWithSpaceTimeWrapperProps) => {
const manchetteWithSpaceTimeChartRef = useRef<HTMLDivElement>(null);

const { manchetteProps, spaceTimeChartProps, handleScroll } = useManchettesWithSpaceTimeChart(
const { manchetteProps, spaceTimeChartProps, handleScroll } = useManchetteWithSpaceTimeChart(
waypoints,
projectPathTrainResult,
manchetteWithSpaceTimeChartRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { Meta } from '@storybook/react';

import '@osrd-project/ui-core/dist/theme.css';
import { ManchetteWithSpaceTimeChart } from '@osrd-project/ui-charts';
import '@osrd-project/ui-charts/dist/theme.css';
import '@osrd-project/ui-core/dist/theme.css';
import type { Meta } from '@storybook/react';

import { SAMPLE_WAYPOINTS, SAMPLE_PATHS_DATA } from '../assets/sampleData';
import ManchetteWithSpaceTimeChart from '../components/ManchetteWithSpaceTimeChart';
import { SAMPLE_WAYPOINTS, SAMPLE_PATHS_DATA } from './assets/sampleData';

const meta: Meta<typeof ManchetteWithSpaceTimeChart> = {
title: 'Manchette with SpaceTimeChart/simple',
Expand Down

0 comments on commit ec1ee77

Please sign in to comment.