Skip to content
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(storybook): Add story for location marker icon #2278

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import type { Meta, StoryObj } from "@storybook/react"
import React from "react"
import { LocationMarker } from "../../../../src/components/mapMarkers"
import { LocationDotIcon } from "../../../../src/helpers/icon"
import { inMapDecorator } from "../../../../.storybook/inMapDecorator"
import locationSearchResultFactory from "../../../../tests/factories/locationSearchResult"

const location = locationSearchResultFactory.build({
latitude: 42.360082,
longitude: -71.05888,
})

const meta = {
args: { location },
argTypes: {
location: { table: { disable: true } },
},
render: ({ selected }) => {
return (
<LocationDotIcon
className={
"c-location-dot-icon" +
(selected ? " c-location-dot-icon--selected" : "")
}
/>
)
},
component: LocationMarker,
parameters: {
layout: "centered",
stretch: false,
},
} satisfies Meta<typeof LocationMarker>

export default meta
type Story = StoryObj<typeof meta>

export const Unselected: Story = {
args: {
selected: false,
},
}

export const Selected: Story = {
args: {
selected: true,
},
}

const InMap: Story = {
decorators: [inMapDecorator],
render: LocationMarker,
parameters: {
layout: "fullscreen",
stretch: true,
},
}

export const UnselectedInMap: Story = {
...Unselected,
...InMap,
}

export const SelectedInMap: Story = {
...Selected,
...InMap,
}