Skip to content

Commit 9d4b9ec

Browse files
Merge pull request #1 from mezh-hq/development
Documentation updates and basic prop inputs
2 parents 60e6136 + ca0b562 commit 9d4b9ec

Some content is hidden

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

42 files changed

+424
-138
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
## Installation
2-
3-
Run `bun i @mezh-hq/react-seat-toolkit` to incorporate into your project <br/>
4-
51
## Getting started
62

73
- Run `bun install` to install all dependencies

README.md

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ React UI library to design and render seat layouts. The library is still under a
2929
</p>
3030

3131

32-
33-
3432
## Features
3533

3634
- **JSON based**: Define your seat layout using JSON data and retrieve it back as JSON after customization ✓
@@ -82,6 +80,71 @@ React UI library to design and render seat layouts. The library is still under a
8280

8381
- **Override styles**: Override the default styles to match your application's theme 🛠️
8482

83+
## Installation
84+
85+
Run `bun i @mezh-hq/react-seat-toolkit` to incorporate into your project <br/>
86+
87+
## Usage
88+
89+
### User mode
90+
91+
```jsx
92+
import React from 'react';
93+
import SeatToolkit from '@mezh-hq/react-seat-toolkit';
94+
95+
const App = () => {
96+
const data = {
97+
seats: [
98+
{
99+
id: '1',
100+
x: 100,
101+
y: 100,
102+
label: 'A1',
103+
color: 'blue',
104+
},
105+
],
106+
};
107+
return (
108+
<SeatToolkit
109+
mode="user"
110+
data={data}
111+
events={{
112+
onSeatClick: (seat) => {
113+
console.log(seat);
114+
},
115+
onSectionClick: (section) => {
116+
console.log(section);
117+
},
118+
}}
119+
/>
120+
);
121+
};
122+
123+
export default App;
124+
```
125+
126+
### Designer mode
127+
128+
```jsx
129+
import React from 'react';
130+
import SeatToolkit from '@mezh-hq/react-seat-toolkit';
131+
132+
const App = () => {
133+
return (
134+
<SeatToolkit
135+
mode="designer"
136+
events={{
137+
onExport: (data) => {
138+
console.log(data);
139+
},
140+
}}
141+
/>
142+
);
143+
};
144+
145+
export default App;
146+
```
147+
85148
## Contributing
86149

87-
Please read [CONTRIBUTING.md](https://github.com/mezh-hq/react-seat-toolkit/blob/main/CONTRIBUTING.md) for details on setting up your development environment and the process for submitting pull requests to us.
150+
Please read [CONTRIBUTING.md](https://github.com/mezh-hq/react-seat-toolkit/blob/main/CONTRIBUTING.md) for details on setting up your development environment and the process of submitting pull requests to us.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mezh-hq/react-seat-toolkit",
3-
"version": "0.0.1",
3+
"version": "0.1.0-blizzard.1",
44
"description": "React UI library to design and render seat layouts",
55
"main": "dist/index.js",
66
"private": false,
@@ -23,7 +23,9 @@
2323
"keywords": [
2424
"Designer",
2525
"Seats",
26-
"Layout"
26+
"Layout",
27+
"Hall arrangement",
28+
"Editor"
2729
],
2830
"author": "Akalanka Perera, Miyuru Gunarathna",
2931
"license": "MIT",

src/components/controls/index.jsx renamed to src/components/controls/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ const transition = "transition-all duration-500";
1717
const width = "w-[22rem]";
1818

1919
const Controls = () => {
20-
const open = useSelector((state) => state.editor.showControls);
21-
const selectedTool = useSelector((state) => state.toolbar.selectedTool);
22-
const selectedElementIds = useSelector((state) => state.editor.selectedElementIds);
20+
const open = useSelector((state: any) => state.editor.showControls);
21+
const selectedTool = useSelector((state: any) => state.toolbar.selectedTool);
22+
const selectedElementIds = useSelector((state: any) => state.editor.selectedElementIds);
2323

2424
const ControlComponent = useMemo(() => {
2525
if (selectedTool === Tool.Select) {

src/components/core/animated-switcher.jsx renamed to src/components/core/animated-switcher.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
11
import { motion } from "framer-motion";
22
import { twMerge } from "tailwind-merge";
33

4-
const AnimatedSwitcher = ({ customKey, component, alternateComponent, show, className, duration }) => {
4+
interface AnimatedSwitcherProps {
5+
customKey?: string;
6+
component: React.ReactNode;
7+
alternateComponent?: React.ReactNode;
8+
show: boolean;
9+
className?: string;
10+
duration?: number;
11+
}
12+
13+
const AnimatedSwitcher = ({
14+
customKey,
15+
component,
16+
alternateComponent,
17+
show,
18+
className,
19+
duration
20+
}: AnimatedSwitcherProps) => {
521
return (
622
<motion.div
723
key={customKey ?? (show ? "component" : "alternateComponent")}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)