Skip to content

Commit 31f5600

Browse files
committed
customization panel can now render useStateModal with a button click. useStateModal has minimal styling and can display state of parent app component.
Co-authored-by: Crys Lim [email protected]
1 parent 745370f commit 31f5600

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React, {useRef, useState, useContext, useEffect } from 'react';
2+
import Modal from '@material-ui/core/Modal';
3+
import StateContext from '../../context/context';
4+
import TableStateProps from '../right/TableStateProps';
5+
6+
function UseStateModal() {
7+
8+
const [open, setOpen] = useState(false);
9+
10+
// choose state source
11+
12+
// state table
13+
14+
const body = (
15+
<div className="useState-position">
16+
<div className="useState-header">
17+
<span>Choose State Source</span>
18+
<button style={{ padding: '1px', float: 'right' }} onClick={() => setOpen(false)}>X</button>
19+
</div>
20+
<div className="useState-window">
21+
<div className="useState-dropdown">
22+
<button >Choose Stateful Component</button>
23+
<div>
24+
<a href="#">component 1</a>
25+
<a href="#">component 2</a>
26+
</div>
27+
</div>
28+
<div className="useState-stateDisplay">
29+
<TableStateProps selectHandler={() => console.log('selectHandler')} deleteHandler={() => console.log('deleteHandler')} isThemeLight={true}/>
30+
</div>
31+
</div>
32+
</div>
33+
);
34+
35+
return (
36+
<div>
37+
<button onClick={() => setOpen(true)}>Use State</button>
38+
<Modal
39+
open={open}
40+
>
41+
{body}
42+
</Modal>
43+
</div>
44+
)
45+
}
46+
47+
export default UseStateModal;

app/src/containers/CustomizationPanel.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import ProjectManager from '../components/right/ProjectManager';
2929
import StateContext from '../context/context';
3030
import FormSelector from '../components/form/Selector';
3131
import { config } from 'ace-builds';
32+
import UseStateModal from '../components/bottom/UseStateModal';
3233
// Previously named rightContainer, Renamed to Customizationpanel this now hangs on BottomTabs
3334
// need to pass in props to use the useHistory feature of react router
3435
const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
@@ -545,6 +546,9 @@ const CustomizationPanel = ({ isThemeLight }): JSX.Element => {
545546
/>
546547
</FormControl>
547548
</div>
549+
<div>
550+
<UseStateModal />
551+
</div>
548552
</div>
549553
<div className={classes.configRow}>
550554
<div

app/src/public/styles/style.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,3 +608,41 @@ a.nav_link:hover {
608608
right: 30px ;
609609
z-index: 999;
610610
}
611+
612+
/* UseStateModal Styling */
613+
614+
.useState-position {
615+
display: flex;
616+
flex-direction: column;
617+
position: fixed;
618+
align-items:flex-start;
619+
top: 30%;
620+
left: 30%;
621+
622+
}
623+
624+
.useState-header {
625+
font-size: 35px;
626+
background-color: #003366;
627+
color: rgb(241, 240, 240);
628+
width: 600px;
629+
border: 3px;
630+
border-style: solid;
631+
border-color: black;
632+
font-family: 'Open Sans', sans-serif;
633+
border-radius: 15px 15px 0px 0px;
634+
}
635+
636+
.useState-window {
637+
width: 600px;
638+
height: 300px;
639+
resize: none;
640+
white-space: pre-line;
641+
font-size: 18px;
642+
border: 3px;
643+
border-style: solid;
644+
border-color: black;
645+
border-radius: 0px 0px 15px 15px;
646+
font-family: Arial, Helvetica, sans-serif;
647+
background-color: rgb(241, 240, 240);;
648+
}

0 commit comments

Comments
 (0)