-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4ac3a04
commit 1681f6e
Showing
17 changed files
with
308 additions
and
37 deletions.
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
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,18 @@ | ||
export const disableArgTypes = (keys: string[]) => { | ||
return keys.reduce((acc: Record<string, any>, key) => { | ||
acc[key] = { table: { disable: true } }; | ||
return acc; | ||
}, {}); | ||
}; | ||
|
||
export const prefixKeys = (object: Record<string, any>, prefix: string) => { | ||
return Object.keys(object).reduce((acc: Record<string, any>, key) => { | ||
acc[`${prefix}${key}`] = object[key]; | ||
return acc; | ||
}, {}); | ||
}; | ||
|
||
export enum STKMode { | ||
DESIGNER = "designer", | ||
USER = "user" | ||
} |
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,32 @@ | ||
import { Meta } from "@storybook/blocks"; | ||
import { Button } from "../components"; | ||
|
||
|
||
|
||
<Meta title="Customization" /> | ||
|
||
<h1>Customization</h1> | ||
|
||
<h4>React Seat Toolkit is highly customizable. You can change almost every aspect of it through its `styles` prop</h4> | ||
|
||
<h4>Here is an example of how you can override its default styles:</h4> | ||
|
||
```jsx | ||
import { SeatToolkit } from "@mezh-hq/react-seat-toolkit"; | ||
|
||
return <SeatToolkit | ||
mode="designer" | ||
styles={{ | ||
root: { | ||
className: "bg-gray-100", | ||
style: { | ||
padding: "20px", | ||
borderRadius: "10px", | ||
boxShadow: "0 0 10px rgba(0, 0, 0, 0.1)" | ||
} | ||
} | ||
}} | ||
/> | ||
``` | ||
|
||
<h4>For a full list of supported styles please have a look at its type definitions</h4> |
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
import { toast } from "sonner"; | ||
import SeatToolkit from "@/index"; | ||
import { STKMode } from "../_utils"; | ||
import { options } from "../options"; | ||
|
||
export default { | ||
title: "Designer/Basic", | ||
component: SeatToolkit, | ||
...options | ||
}; | ||
|
||
export const Story = { | ||
render: (props) => <SeatToolkit mode={STKMode.DESIGNER} {...props} /> | ||
}; | ||
|
||
export const WithoutFooter = { | ||
render: (props) => ( | ||
<SeatToolkit | ||
mode={STKMode.DESIGNER} | ||
{...props} | ||
options={{ | ||
showFooter: false, | ||
...props.options | ||
}} | ||
/> | ||
) | ||
}; | ||
|
||
export const WithReloadButton = { | ||
render: (props) => ( | ||
<SeatToolkit | ||
mode={STKMode.DESIGNER} | ||
{...props} | ||
options={{ | ||
showReloadButton: true, | ||
...props.options | ||
}} | ||
events={{ | ||
onReload: () => { | ||
toast.info("Reload clicked"); | ||
}, | ||
...props.events | ||
}} | ||
/> | ||
) | ||
}; |
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,13 @@ | ||
import SeatToolkit from "@/index"; | ||
import { STKMode } from "../_utils"; | ||
import { options } from "../options"; | ||
|
||
export default { | ||
title: "Designer/Blank", | ||
component: SeatToolkit, | ||
...options | ||
}; | ||
|
||
export const Story = { | ||
render: (props) => <SeatToolkit mode={STKMode.DESIGNER} data={{}} {...props} /> | ||
}; |
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,34 @@ | ||
import { toast } from "sonner"; | ||
import SeatToolkit from "@/index"; | ||
import { STKMode } from "../_utils"; | ||
import { options } from "../options"; | ||
|
||
export default { | ||
title: "Designer/Persisted", | ||
component: SeatToolkit, | ||
...options | ||
}; | ||
|
||
export const Story = { | ||
render: (props) => { | ||
const saved = sessionStorage.getItem("stk-data"); | ||
const data = saved ? JSON.parse(saved) : undefined; | ||
return ( | ||
<SeatToolkit | ||
{...props} | ||
mode={STKMode.DESIGNER} | ||
data={data} | ||
options={{ | ||
exportButtonText: "Save to Session Storage" | ||
}} | ||
events={{ | ||
onExport: (data) => { | ||
sessionStorage.setItem("stk-data", JSON.stringify(data)); | ||
toast.info("Changes saved to session storage. They will be available on page reload"); | ||
}, | ||
...props.events | ||
}} | ||
/> | ||
); | ||
} | ||
}; |
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,132 @@ | ||
import { disableArgTypes, prefixKeys } from "./_utils"; | ||
|
||
export const options = { | ||
parameters: { | ||
layout: "fullscreen" | ||
}, | ||
tags: ["autodocs"], | ||
argTypes: { | ||
...disableArgTypes(["options"]), | ||
...prefixKeys( | ||
{ | ||
showFooter: { | ||
control: "boolean", | ||
description: "Show or hide the footer", | ||
defaultValue: { summary: true } | ||
}, | ||
showGridSwitch: { | ||
control: "boolean", | ||
description: "Show or hide the grid switch", | ||
defaultValue: { summary: true } | ||
}, | ||
showSeatLabels: { | ||
control: "boolean", | ||
description: "Show or hide the seat labels", | ||
defaultValue: { summary: true } | ||
}, | ||
showZoomControls: { | ||
control: "boolean", | ||
description: "Show or hide the zoom controls", | ||
defaultValue: { summary: true } | ||
}, | ||
showVisibilityControls: { | ||
control: "boolean", | ||
description: "Show or hide the visibility controls", | ||
defaultValue: { summary: true } | ||
}, | ||
showReloadButton: { | ||
control: "boolean", | ||
description: "Show or hide the reload button", | ||
defaultValue: { summary: false } | ||
}, | ||
exportButtonText: { | ||
control: "text", | ||
description: "Custom text for the export button", | ||
defaultValue: { summary: "Export" } | ||
}, | ||
operationTriggerIcon: { | ||
control: "function", | ||
description: "React component to use in place of the operation trigger icon" | ||
}, | ||
seatIcon: { | ||
control: "function", | ||
description: "React component to use as a seat icon" | ||
}, | ||
selectedSeatIcon: { | ||
control: "function", | ||
description: "React component to use as a selected seat icon" | ||
}, | ||
maxSeatSelectionCount: { | ||
control: "number", | ||
description: | ||
"Maximum number of seats that can be selected. Only applicable in user mode. Defaults to infinity." | ||
}, | ||
maxImageSize: { | ||
control: "number", | ||
description: "Maximum size of an image which can be added to the workspace in bytes" | ||
}, | ||
locationInputPlaceholder: { | ||
control: "text", | ||
description: "Placeholder text for the location input" | ||
}, | ||
disableCategoryDelete: { | ||
control: "boolean", | ||
description: "Disable category deletion", | ||
defaultValue: { summary: false } | ||
}, | ||
disableCategoryDeleteIfReserved: { | ||
control: "boolean", | ||
description: "Disable category deletion if there are reserved seats falling under the category", | ||
defaultValue: { summary: false } | ||
}, | ||
disableSectionDelete: { | ||
control: "boolean", | ||
description: "Disable section deletion", | ||
defaultValue: { summary: false } | ||
} | ||
}, | ||
"options." | ||
), | ||
...disableArgTypes(["events"]), | ||
...prefixKeys( | ||
{ | ||
onSeatClick: { | ||
description: "Fired when a seat is clicked" | ||
}, | ||
onFreeSeatClick: { | ||
description: "Fired when a free seat is clicked" | ||
}, | ||
onSeatHover: { | ||
description: "Fired when a seat is hovered over" | ||
}, | ||
onSeatLeave: { | ||
description: "Fired when a seat is no longer hovered over" | ||
}, | ||
onSeatSelectionChange: { | ||
description: "Fired when the selected seats change. Only applicable in user mode." | ||
}, | ||
onMaxSeatSelectionCountReached: { | ||
description: "Fired when the user tries to select more seats than the maxSeatSelectionCount" | ||
}, | ||
onWorkspaceHover: { | ||
description: "Fired when the workspace is hovered over" | ||
}, | ||
onWorkspaceLoad: { | ||
description: "Fired when the workspace is loaded" | ||
}, | ||
onSectionClick: { | ||
description: "Fired when a section is clicked" | ||
}, | ||
onExport: { | ||
description: "Fired when the export button is clicked" | ||
}, | ||
onReload: { | ||
description: "Fired when the reload button is clicked" | ||
} | ||
}, | ||
"events." | ||
) | ||
} | ||
}; | ||
|
||
export default options; |
Oops, something went wrong.