-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add storybook #196
Merged
Merged
feat: add storybook #196
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import type { StorybookConfig } from '@storybook/react-vite' | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/addon-onboarding', | ||
'@storybook/addon-interactions', | ||
], | ||
framework: { | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
} | ||
export default config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Preview } from '@storybook/react' | ||
import React from 'react' | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i, | ||
}, | ||
}, | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<div style={{ direction: 'rtl' }}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
} | ||
|
||
export default preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import { BusToolTip, BusToolTipProps } from './BusToolTip' | ||
|
||
const meta = { | ||
title: 'Components/MapLayers/BusToolTip', | ||
component: BusToolTip, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['map', 'tooltip', 'autodocs'], | ||
} satisfies Meta<typeof BusToolTip> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
const defaultArgs: BusToolTipProps = { | ||
position: { | ||
loc: [31.799982, 34.786926], | ||
color: 22, | ||
operator: 3, | ||
bearing: 106, | ||
recorded_at_time: 1698809440000, | ||
point: { | ||
id: 2838516282, | ||
siri_snapshot_id: 919509, | ||
siri_ride_stop_id: 1370461085, | ||
recorded_at_time: '2023-11-01T03:30:40+00:00', | ||
lon: 34.786926, | ||
lat: 31.799982, | ||
bearing: 106, | ||
velocity: 22, | ||
distance_from_journey_start: 636, | ||
distance_from_siri_ride_stop_meters: 278, | ||
siri_snapshot__snapshot_id: '2023/11/01/03/30', | ||
siri_route__id: 973, | ||
siri_route__line_ref: 2974, | ||
siri_route__operator_ref: 3, | ||
siri_ride__id: 52703935, | ||
siri_ride__journey_ref: '2023-11-01-56650774', | ||
siri_ride__scheduled_start_time: '2023-11-01T03:30:00+00:00', | ||
siri_ride__vehicle_ref: '23321002', | ||
siri_ride__first_vehicle_location_id: 2838509585, | ||
siri_ride__last_vehicle_location_id: 2838555351, | ||
siri_ride__duration_minutes: 27, | ||
siri_ride__gtfs_ride_id: 57365030, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} as any, | ||
}, | ||
icon: '/bus-logos/3.svg', | ||
} | ||
|
||
export const Default: Story = { | ||
args: defaultArgs, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused import plz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://stackoverflow.com/a/70122171
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://dev.to/titungdup/you-no-longer-need-to-import-react-from-react-3pbj
in this pr i changed it and it's works for me without this import
#166
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't work in the storybook thingy. maybe the TS version isn't up to date. it can be improved in future PR