added simple file modal toggle
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import MainMenu from './features/menu/Menu';
|
import MainMenu from './features/menu/Menu';
|
||||||
import TimbreSwitcher from './features/timbre/timbreSwitcher';
|
import TimbreSwitcher from './features/timbre/timbreSwitcher';
|
||||||
import IO from './features/io/IO';
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
@@ -9,7 +8,6 @@ function App() {
|
|||||||
<div className="App">
|
<div className="App">
|
||||||
<header className="App-header">
|
<header className="App-header">
|
||||||
<MainMenu />
|
<MainMenu />
|
||||||
<IO />
|
|
||||||
<TimbreSwitcher />
|
<TimbreSwitcher />
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
.dropzone-container {
|
||||||
|
background: white;
|
||||||
|
padding: 0.95em;
|
||||||
|
position: fixed;
|
||||||
|
margin: auto;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: calc(7.5em);
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 14em;
|
||||||
|
z-index: 100;
|
||||||
|
border: 0.09em solid slategray;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.show {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
+17
-11
@@ -1,32 +1,34 @@
|
|||||||
import React, { useState, useEffect, useMemo } from 'react';
|
import React, { useState, useEffect, useMemo } from 'react';
|
||||||
import { useDropzone } from 'react-dropzone';
|
import { useDropzone } from 'react-dropzone';
|
||||||
|
import './IO.css';
|
||||||
|
|
||||||
const baseStyle = {
|
const baseStyle = {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
padding: '20px',
|
height: '4.25em',
|
||||||
|
padding: '0.5em',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
borderColor: '#eeeeee',
|
borderColor: 'slategrey',
|
||||||
borderStyle: 'dashed',
|
borderStyle: 'dashed',
|
||||||
backgroundColor: '#fafafa',
|
backgroundColor: 'ghostwhite',
|
||||||
color: '#bdbdbd',
|
color: 'slategray',
|
||||||
outline: 'none',
|
outline: 'none',
|
||||||
transition: 'border .24s ease-in-out',
|
transition: 'border .24s ease-in-out',
|
||||||
};
|
};
|
||||||
|
|
||||||
const activeStyle = {
|
const activeStyle = {
|
||||||
borderColor: '#2196f3',
|
borderColor: 'slateblue',
|
||||||
};
|
};
|
||||||
|
|
||||||
const acceptStyle = {
|
const acceptStyle = {
|
||||||
borderColor: '#00e676',
|
borderColor: 'mediumseagreen',
|
||||||
};
|
};
|
||||||
|
|
||||||
const rejectStyle = {
|
const rejectStyle = {
|
||||||
borderColor: '#ff1744',
|
borderColor: 'crimson',
|
||||||
};
|
};
|
||||||
|
|
||||||
const Dropzone = ({ setFile }) => {
|
const Dropzone = ({ setFile }) => {
|
||||||
@@ -54,16 +56,20 @@ const Dropzone = ({ setFile }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="dropzone-container">
|
<div className="dropzone-container">
|
||||||
<div {...getRootProps({ style })}>
|
<div {...getRootProps({ style })}>
|
||||||
<input {...getInputProps()} />
|
<input {...getInputProps()} />
|
||||||
<p>Drag and drop file here, or click to select</p>
|
<p>Drag and drop file here, or click to select</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function IO(props) {
|
export default function IO({ show }) {
|
||||||
|
const display = show
|
||||||
|
? 'dropzone-container show'
|
||||||
|
: 'dropzone-container hide';
|
||||||
|
|
||||||
const [file, setFile] = useState(null);
|
const [file, setFile] = useState(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -71,7 +77,7 @@ export default function IO(props) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="io">
|
<div className={display}>
|
||||||
<Dropzone className="dropzone-modal" setFile={setFile} />
|
<Dropzone className="dropzone-modal" setFile={setFile} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ h2 {
|
|||||||
.modal-main {
|
.modal-main {
|
||||||
background: white;
|
background: white;
|
||||||
padding: 0.75em 0 1em;
|
padding: 0.75em 0 1em;
|
||||||
border: solid 1pt slategrey;
|
border: solid 0.09em slategrey;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
+24
-10
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
import IO from '../io/IO';
|
||||||
import { useDispatch, useSelector } from 'react-redux'; // probably temporarily here
|
import { useDispatch, useSelector } from 'react-redux'; // probably temporarily here
|
||||||
import { parameterRefreshAll } from '../timbre/parameters/parameterSlice'; // probably temporarily here
|
import { parameterRefreshAll } from '../timbre/parameters/parameterSlice'; // probably temporarily here
|
||||||
import logo from '../../1f3b9.svg';
|
import logo from '../../1f3b9.svg';
|
||||||
@@ -40,7 +41,10 @@ export default function MainMenu() {
|
|||||||
className: '',
|
className: '',
|
||||||
openState: true,
|
openState: true,
|
||||||
});
|
});
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState({
|
||||||
|
saveCheck: false,
|
||||||
|
ioModal: false,
|
||||||
|
});
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const HandleClick = () => {
|
const HandleClick = () => {
|
||||||
@@ -59,22 +63,26 @@ export default function MainMenu() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const modalState = () => {
|
const showSaveCheck = () => {
|
||||||
setShowModal(!showModal);
|
setShowModal({ ...showModal, saveCheck: !showModal.saveCheck });
|
||||||
|
};
|
||||||
|
|
||||||
|
const showIOModal = () => {
|
||||||
|
setShowModal({ ...showModal, ioModal: !showModal.ioModal });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Modal
|
<Modal
|
||||||
show={showModal}
|
show={showModal.saveCheck}
|
||||||
handleClose={modalState}
|
handleClose={showSaveCheck}
|
||||||
handleSave={() => {
|
handleSave={() => {
|
||||||
modalState();
|
showSaveCheck();
|
||||||
HandleClick(); // temporary while I implement the binary parsing stuff
|
HandleClick(); // temporary while I implement the binary parsing stuff
|
||||||
}}
|
}}
|
||||||
handleNoSave={() => {
|
handleNoSave={() => {
|
||||||
dispatch(parameterRefreshAll());
|
dispatch(parameterRefreshAll());
|
||||||
modalState();
|
showSaveCheck();
|
||||||
HandleClick();
|
HandleClick();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -90,14 +98,20 @@ export default function MainMenu() {
|
|||||||
<button
|
<button
|
||||||
className="menu-button"
|
className="menu-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
!unsaved ? HandleClick() : modalState();
|
!unsaved ? HandleClick() : showSaveCheck();
|
||||||
}}>
|
}}>
|
||||||
New Patch
|
New Patch
|
||||||
</button>
|
</button>
|
||||||
<button className="menu-button">Load Patch</button>
|
<button
|
||||||
|
className="menu-button"
|
||||||
|
onClick={() => {
|
||||||
|
!unsaved ? showIOModal() : showSaveCheck();
|
||||||
|
}}>
|
||||||
|
Load Patch
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<IO show={showModal.ioModal} />
|
||||||
<button className="menu-open-button" onClick={HandleClick} />
|
<button className="menu-open-button" onClick={HandleClick} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user