Skip to content

Commit 57075ca

Browse files
Merge pull request #10 from mezh-hq/development
Feature / UI Revamp
2 parents 7de7176 + 84ccf68 commit 57075ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+1917
-1103
lines changed

.storybook/preview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const preview: Preview = {
2626
reactRouter: {},
2727
options: {
2828
storySort: {
29-
order: ["Introduction", "Installation", "Customization"],
29+
order: ["Introduction", "Installation", "Customization", "Modifying State", "External Shapes"]
3030
},
3131
}
3232
},

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
Changelog
22

3+
# v3.0.0 [2024-08-27]
4+
5+
## Major Release
6+
7+
### Features
8+
- Complete UI overhaul with a new design system
9+
- Adds support for element rotation
10+
- Adds support for passing external shapes into the toolkit
11+
12+
---
13+
314
# v2.1.1 [2024-08-07]
415

516
## Patch Release

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020

2121
<br/>
2222

23-
<img width="1440" alt="image" src="https://github.com/mezh-hq/react-seat-toolkit/assets/73662613/1c0a5c80-e402-46ed-bc17-364730122173">
23+
<img width="1440" alt="image" src="https://github.com/user-attachments/assets/a34e5eb6-73e6-437a-8712-8aaefed26483">
2424

2525
<p align="center">
26-
<img width="49.5%" alt="image" src="https://github.com/mezh-hq/react-seat-toolkit/assets/73662613/18a321a0-4ced-49c8-91eb-44605ea2ab9c">
27-
<img width="49.5%" alt="image" src="https://github.com/mezh-hq/react-seat-toolkit/assets/73662613/e43be42f-40b0-4aaf-8d3a-a538abc8b2c1">
26+
<img width="49.5%" alt="image" src="https://github.com/user-attachments/assets/e6b08c94-fa08-4fd0-ad1d-9454f9511c0c">
27+
<img width="49.5%" alt="image" src="https://github.com/user-attachments/assets/63405b00-b821-4a3a-9c16-66a1f05bd114">
2828
</p>
2929

3030
## Features
@@ -40,7 +40,7 @@
4040
- Change seat colors ✓
4141
- Change seat labels ✓
4242
- Change seat status ✓
43-
- Group seats together into categories ✓
43+
- Group seats into categories ✓
4444
- Categorizer (Manage seat categories) ✓
4545

4646
- **Pen**
@@ -68,8 +68,8 @@
6868

6969
- **Miscallaneous**
7070
- Add, move around and scale background images ✓
71-
- Add and move around booths ✓
7271
- Multiple element selection and deselection ✓
72+
- Rotate elements ✓
7373
- Bring elements to front or back ✓
7474

7575
- **Responsive**: The layout is responsive and can be viewed on any device ✓

bun.lockb

-52.7 KB
Binary file not shown.

esbuild.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ build({
5050
outfile: "./dist/index.slim.js",
5151
external: [
5252
...options.external,
53-
"@radix-ui/react-checkbox",
5453
"@radix-ui/react-label",
5554
"@radix-ui/react-popover",
56-
"@radix-ui/react-radio-group",
5755
"@radix-ui/react-select",
5856
"@radix-ui/react-tooltip",
5957
"class-variance-authority",
6058
"lodash",
59+
"lucide-react",
6160
"tailwind-merge"
6261
]
6362
});

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mezh-hq/react-seat-toolkit",
3-
"version": "2.1.1",
3+
"version": "3.0.0-blizzard.8",
44
"description": "React UI library to design and render seat layouts",
55
"main": "dist/index.cjs",
66
"module": "dist/index.mjs",
@@ -63,11 +63,10 @@
6363
"@interactjs/auto-start": "1.10.26",
6464
"@interactjs/interact": "1.10.26",
6565
"@mezh-hq/react-gridlines": "1.0.1",
66-
"@radix-ui/react-checkbox": "1.0.4",
6766
"@radix-ui/react-label": "2.0.2",
6867
"@radix-ui/react-popover": "1.0.7",
69-
"@radix-ui/react-radio-group": "1.1.3",
7068
"@radix-ui/react-select": "2.0.0",
69+
"@radix-ui/react-switch": "1.1.0",
7170
"@radix-ui/react-tooltip": "1.0.6",
7271
"@reduxjs/toolkit": "2.1.0",
7372
"class-variance-authority": "0.7.0",
@@ -108,9 +107,7 @@
108107
"eslint-plugin-react": "7.33.2",
109108
"eslint-plugin-react-hooks": "4.6.0",
110109
"eslint-plugin-storybook": "0.6.13",
111-
"install": "0.13.0",
112110
"lefthook": "1.4.3",
113-
"npm": "10.8.1",
114111
"postcss": "8.4.31",
115112
"prettier": "2.8.8",
116113
"sonner": "1.5.0",

src/actions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { panDown, panLeft, panRight, panUp } from "@/components/workspace/zoom";
1+
import { panDown, panLeft, panRight, panUp } from "@/components/workspace/dock";
22
import { store } from "@/store";
33
import { clearElements, deselectElement, selectElement } from "@/store/reducers/editor";
44
import { stateToJSON } from "@/utils";

src/components/controls/control-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const ControlInput = ({ id, label, ...props }: ControlInputProps) => {
99
return (
1010
<>
1111
<Label htmlFor={id}>{label}</Label>
12-
<Input id={id} className="col-span-2 h-8" {...props} />
12+
<Input id={id} className="col-span-2" {...props} />
1313
</>
1414
);
1515
};

src/components/controls/image.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const onUploadClick = () => document.getElementById("image-input").click();
1313

1414
type IImageControlProps = Pick<ISTKProps, "options" | "styles">;
1515

16-
const ImageControls = ({ options: { maxImageSize = 1024000 } = {} }: IImageControlProps) => {
16+
const Controls = ({ options: { maxImageSize = 1024000 } = {} }: IImageControlProps) => {
1717
const [file, setFile] = useState(null);
1818

1919
const onUpload = async (e) => {
@@ -49,19 +49,27 @@ const ImageControls = ({ options: { maxImageSize = 1024000 } = {} }: IImageContr
4949
}, [file]);
5050

5151
return (
52-
<div className="w-full h-full flex flex-col justify-between gap-5">
52+
<div className="w-full flex flex-col gap-5">
5353
<div
54-
className="h-full w-full flex justify-center items-center rounded-md cursor-pointer bg-gray-100 hover:bg-gray-200 transition-all duration-medium"
54+
className="w-full aspect-square flex justify-center items-center rounded-md overflow-clip cursor-pointer bg-slate-100 border border-gray-200"
5555
onClick={onUploadClick}
5656
>
57-
{file ? <img src={file} alt="uploaded image" className="h-full w-full" /> : <Image size={30} />}
57+
{file ? (
58+
<img src={file} alt="uploaded image" className="h-full w-full object-cover" />
59+
) : (
60+
<Image size={24} className="text-slate-500" />
61+
)}
5862
</div>
59-
<Button className="py-2.5" onClick={onAddToWorkspace} disabled={!file}>
63+
<Button className="py-2.5" variant="secondary" onClick={onAddToWorkspace} disabled={!file}>
6064
Add to Workspace
6165
</Button>
6266
<input id="image-input" type="file" accept="image/*" className="hidden" onInput={onUpload} />
6367
</div>
6468
);
6569
};
6670

67-
export default memo(ImageControls);
71+
const ImageControls = memo(Controls);
72+
73+
(ImageControls as any).name = "ImageControls";
74+
75+
export default ImageControls;

src/components/controls/index.tsx

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { useMemo } from "react";
2+
import { X } from "lucide-react";
23
import { useSelector } from "react-redux";
34
import { twMerge } from "tailwind-merge";
45
import { dataAttributes, ids } from "@/constants";
6+
import { store } from "@/store";
7+
import { toggleControls } from "@/store/reducers/editor";
58
import { ISTKProps } from "@/types";
6-
import { AnimatedSwitcher } from "../core";
9+
import { AnimatedSwitcher, IconButton } from "../core";
710
import { Tool } from "../toolbar/data";
8-
import { ElementType } from "../workspace/elements";
911
import { default as ImageControls } from "./image";
1012
import { default as NoControls } from "./no-controls";
1113
import { default as NoSelectedElement } from "./no-selection";
@@ -15,7 +17,9 @@ import { default as SeatControls } from "./seat";
1517
import { default as SelectControls } from "./select";
1618
import { default as ShapeControls } from "./shapes";
1719

18-
const transition = "transition-all duration-500";
20+
const onCogClick = () => store.dispatch(toggleControls());
21+
22+
const transition = "transition-all duration-500 ease-in-out";
1923

2024
const width = "w-[22rem]";
2125

@@ -32,7 +36,6 @@ const Controls = ({ options, styles }: IControlProps) => {
3236
const firstElementType = document
3337
.getElementById(selectedElementIds[0])
3438
?.getAttribute?.(dataAttributes.elementType);
35-
if (firstElementType === ElementType.Booth) return NoSelectionControls;
3639
if (selectedElementIds.length > 1) {
3740
const same = selectedElementIds.every((id) => {
3841
return document.getElementById(id)?.getAttribute?.(dataAttributes.elementType) === firstElementType;
@@ -51,23 +54,30 @@ const Controls = ({ options, styles }: IControlProps) => {
5154
}, [selectedTool, selectedElementIds]);
5255

5356
return (
54-
<>
55-
<div className={twMerge("pointer-events-none grow-0 shrink-0", transition, open ? width : "w-0")} />
56-
<div
57-
id={ids.controls}
58-
className={twMerge(
59-
"py-5 px-6 h-[calc(100%-32px)] absolute top-0 border-t border-black overflow-y-auto",
60-
transition,
61-
width,
62-
open ? "right-0" : "-right-[22rem]"
63-
)}
64-
>
65-
<AnimatedSwitcher
66-
key={ControlComponent.name}
67-
component={<ControlComponent options={options} styles={styles} />}
57+
<div
58+
id={ids.controls}
59+
className={twMerge(
60+
"h-full bg-white border-l shadow-lg border-gray-200 absolute top-0 overflow-y-auto z-10",
61+
transition,
62+
width,
63+
open ? "right-0" : "-right-[22rem]"
64+
)}
65+
>
66+
<div className="flex justify-between items-center gap-4 h-14 border-b border-gray-200 box-content px-5 sticky top-0 bg-white">
67+
<h5>Settings</h5>
68+
<IconButton
69+
className="w-6 h-6 p-0 shrink-0"
70+
variant="secondary"
71+
icon={<X className="w-4 h-4" />}
72+
onClick={onCogClick}
6873
/>
6974
</div>
70-
</>
75+
<AnimatedSwitcher
76+
key={ControlComponent.name}
77+
component={<ControlComponent options={options} styles={styles} />}
78+
className="py-4 px-5 h-[calc(100%-3.5rem)]"
79+
/>
80+
</div>
7181
);
7282
};
7383

0 commit comments

Comments
 (0)