Skip to content

Commit

Permalink
Fix: initial workspace element positions and updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Aug 26, 2024
1 parent 59983e2 commit 229ac60
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const preview: Preview = {
reactRouter: {},
options: {
storySort: {
order: ["Introduction", "Installation", "Customization"],
order: ["Introduction", "Installation", "Customization", "Modifying State", "External Shapes"]
},
}
},
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Changelog

# v3.0.0 [2024-08-27]

## Major Release

### Features
- Complete UI overhaul with a new design system
- Adds support for element rotation
- Adds support for passing external shapes into the toolkit

---

# v2.1.1 [2024-08-07]

## Patch Release
Expand Down
12 changes: 6 additions & 6 deletions src/store/reducers/editor/seats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@ const gap = 50;
export default () => [
...[...Array(10).keys()].map((p) => ({
id: uuidV4(),
x: getWorkspaceCenterX() - gap * (p + 1),
x: getWorkspaceCenterX() - gap * (p + 1.5),
y: getWorkspaceHeight() * 0.48,
label: p + 1
})),
...[...Array(10).keys()].map((p) => ({
id: uuidV4(),
x: getWorkspaceCenterX() + gap * (p + 1),
x: getWorkspaceCenterX() + gap * (p + 0.5),
y: getWorkspaceHeight() * 0.48,
label: p + 1
})),
...[...Array(7).keys()].map((p) => ({
id: uuidV4(),
x: getWorkspaceCenterX() - gap * (p + 1),
x: getWorkspaceCenterX() - gap * (p + 1.5),
y: getWorkspaceHeight() * 0.58,
label: p + 1
})),
...[...Array(7).keys()].map((p) => ({
id: uuidV4(),
x: getWorkspaceCenterX() + gap * (p + 1),
x: getWorkspaceCenterX() + gap * (p + 0.5),
y: getWorkspaceHeight() * 0.58,
label: p + 1
})),
...[...Array(5).keys()].map((p) => ({
id: uuidV4(),
x: getWorkspaceCenterX() - gap * (p + 1),
x: getWorkspaceCenterX() - gap * (p + 1.5),
y: getWorkspaceHeight() * 0.68,
label: p + 1
})),
...[...Array(5).keys()].map((p) => ({
id: uuidV4(),
x: getWorkspaceCenterX() + gap * (p + 1),
x: getWorkspaceCenterX() + gap * (p + 0.5),
y: getWorkspaceHeight() * 0.68,
label: p + 1
}))
Expand Down
4 changes: 2 additions & 2 deletions src/store/reducers/editor/shapes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { getWorkspaceCenterX, getWorkspaceHeight } from "@/utils";
export default () => [
{
id: uuidV4(),
x: getWorkspaceCenterX() - 550,
x: getWorkspaceCenterX() - 600,
y: getWorkspaceHeight() * 0.18,
width: 1100,
width: 1150,
height: 100,
rx: 10,
name: "RectangleHorizontal"
Expand Down
2 changes: 1 addition & 1 deletion src/store/reducers/editor/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getWorkspaceCenterX, getWorkspaceHeight } from "@/utils";
export default () => [
{
id: uuidV4(),
x: getWorkspaceCenterX() - 58,
x: getWorkspaceCenterX() - 78,
y: getWorkspaceHeight() * 0.27,
label: "STAGE",
fontSize: 35,
Expand Down
36 changes: 36 additions & 0 deletions src/stories/external-shapes.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Meta } from "@storybook/blocks";

<Meta title="External Shapes" />

<h1>External Shapes</h1>

<h4>You can control the shapes available to you within the toolkit by passing in an array of shapes in options as follows:</h4>

```tsx
import { SeatToolkit } from "@mezh-hq/react-seat-toolkit";
import { FireExtinguisher } from "lucide-react";

return <SeatToolkit
mode="designer"
options={{
shapes: {
icons: [
FireExtinguisher
],
overrideDefaultIconset: false
}
}}
/>
```

<h4>Here, we are passing in an array of shapes with a single shape, FireExtinguisher, which will be added to the default shapes available in the toolkit.</h4>

<h4>If you need to completely override the default shapes available in the toolkit, you can set the overrideDefaultIconset property to true. This will remove all default shapes and keep only the shapes you pass </h4>

<br/>

---

<br/>

<h5> NOTE: The shapes you pass in should be React components that render an SVG and must contain a `displayName` property. If the `displayName` property is not present, the toolkit will not be able to render the shape. </h5>

0 comments on commit 229ac60

Please sign in to comment.