Skip to content

Commit f1bac81

Browse files
committed
added initial and final state colors in toolbox
1 parent befe3d2 commit f1bac81

File tree

4 files changed

+64
-8
lines changed

4 files changed

+64
-8
lines changed

src/components/Editor.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { createContext, useRef, useState } from "react";
1+
import { createContext, useState } from "react";
22
import {
33
Alert,
44
AlertTitle,
55
Box,
66
Button,
7-
Divider,
87
Grid,
98
Slider,
109
Snackbar,
@@ -206,7 +205,9 @@ export const Editor = () => {
206205

207206
if (PossibleTransitionValues.includes(row.state)) {
208207
setAlertMessage(
209-
`State name cannot be ${PossibleTransitionValues.join(", ")}`
208+
`State name cannot be one of the following: ${PossibleTransitionValues.join(
209+
", "
210+
)}`
210211
);
211212
return;
212213
}

src/consts/Colors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const transitionColor = "coral";
1111
export const transitionHoverColor = "IndianRed";
1212
export const transitionSelectedColor = "black";
1313

14-
export const startingStateColor = "#ff99bb"; // pink tone
14+
export const startingStateColor = "lightblue"; // pink tone
1515

1616
export const appBarBackgroundColor = "rgba(148, 148, 148, 0.15)";
1717
export const drawerHeaderBoxShadow =

src/consts/ToolboxStateSize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const ToolboxStateSize = 55;

src/features/Playground.tsx

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ import { useEffect } from "react";
1111
import { XarrowCoreProps } from "./components/playground/props/XarrowProps";
1212
import { DataContext } from "../components/Editor";
1313
import { useContext } from "react";
14-
import { Box } from "@mui/material";
14+
import { Box, Grid } from "@mui/material";
15+
import {
16+
stateFinalColor,
17+
stateInitialColor,
18+
stateInitialFinalColor,
19+
} from "../consts/Colors";
20+
import { ToolboxStateSize } from "../consts/ToolboxStateSize";
1521

1622
const Playground = (props: PlaygroundProps) => {
1723
console.log("re rendering Playground: props", props);
@@ -80,13 +86,13 @@ const Playground = (props: PlaygroundProps) => {
8086
transition={transition}
8187
/>
8288
))}
83-
89+
8490
<div className="toolboxMenu">
8591
<Box>Drag & drop me!</Box>
8692
{/* <div className="toolboxTitle">Drag & drop me!</div> */}
8793
<hr />
8894
<div className="toolboxContainer">
89-
<div
95+
<Box
9096
className="state"
9197
draggable
9298
style={{
@@ -99,7 +105,55 @@ const Playground = (props: PlaygroundProps) => {
99105
onTouchMove={props.handleDropDynamic}
100106
>
101107
state
102-
</div>
108+
</Box>
109+
110+
<Grid
111+
container
112+
direction="column"
113+
justifyContent="center"
114+
alignItems="center"
115+
spacing={1}
116+
>
117+
<Grid item>
118+
<Box
119+
className="state"
120+
sx={{
121+
width: `${ToolboxStateSize}px`,
122+
height: `${ToolboxStateSize}px`,
123+
borderRadius: `${ToolboxStateSize}px`,
124+
backgroundColor: stateInitialColor,
125+
}}
126+
>
127+
Initial
128+
</Box>
129+
</Grid>
130+
<Grid item>
131+
<Box
132+
className="state"
133+
sx={{
134+
width: `${ToolboxStateSize}px`,
135+
height: `${ToolboxStateSize}px`,
136+
borderRadius: `${ToolboxStateSize}px`,
137+
backgroundColor: stateFinalColor,
138+
}}
139+
>
140+
Final
141+
</Box>
142+
</Grid>
143+
<Grid item>
144+
<Box
145+
className="state"
146+
sx={{
147+
width: `${ToolboxStateSize}px`,
148+
height: `${ToolboxStateSize}px`,
149+
borderRadius: `${ToolboxStateSize}px`,
150+
backgroundColor: stateInitialFinalColor,
151+
}}
152+
>
153+
Initial Final
154+
</Box>
155+
</Grid>
156+
</Grid>
103157
</div>
104158
</div>
105159
</div>

0 commit comments

Comments
 (0)