From 1c91adc18367dabfc2ce5905a3273e63830de266 Mon Sep 17 00:00:00 2001 From: Chris L Date: Fri, 7 Jan 2022 13:01:07 +0100 Subject: [PATCH] Refactored Melody Editor to only use MUI components. #164 --- src/Components/Input/LabeledSelect/index.jsx | 7 +- .../MelodyEditor/MelodyElement/index.jsx | 39 +-- .../MelodyEditor/MelodyElement/style.scss | 83 ++---- .../MelodyEditor/__tests__/index.test.jsx | 5 +- src/Components/MelodyEditor/index.jsx | 245 +++++++++++------- src/Components/MelodyEditor/style.scss | 135 ---------- 6 files changed, 198 insertions(+), 316 deletions(-) delete mode 100644 src/Components/MelodyEditor/style.scss diff --git a/src/Components/Input/LabeledSelect/index.jsx b/src/Components/Input/LabeledSelect/index.jsx index bee0a2495..c52cfd49e 100644 --- a/src/Components/Input/LabeledSelect/index.jsx +++ b/src/Components/Input/LabeledSelect/index.jsx @@ -54,9 +54,10 @@ function LabeledSelect({ variant="standard" > - - {label} - + { label && + + {label} + } - -
- - -
- + + + ); } SaveMelody.propTypes = { onSave: PropTypes.func.isRequired }; @@ -138,24 +153,37 @@ function PresetSelect({ ]; return( -
- - -
- -
-
+ + + ); } PresetSelect.defaultProps = { selected: -1 }; @@ -314,19 +342,26 @@ function MelodyEditor({ } return ( - + md={6} + xs={12} + > + + ); }); @@ -339,20 +374,16 @@ function MelodyEditor({ >
-
-
- -
-
+ -
+
- - +
+ +
-
- {!sync && melodyElements} - - {sync && - } -
- -
- { !sync && - } - - { !dummy && - } -
-
+
+ +
+ {!sync && + + {melodyElements} + } + + {sync && + + + } +
+ + + { !sync && + } + + { !dummy && + } + + +
+
); } diff --git a/src/Components/MelodyEditor/style.scss b/src/Components/MelodyEditor/style.scss deleted file mode 100644 index 143236eb8..000000000 --- a/src/Components/MelodyEditor/style.scss +++ /dev/null @@ -1,135 +0,0 @@ -#melody-editor { - .overlay { - .overlay__wrapper { - max-width: 960px; - width: 80%; - - @media screen and (max-width: 600px) { - width: 90%; - } - } - } - - .line-wrapper { - display: flex; - flex-direction: row; - - .info-wrapper-wrapper { - white-space: nowrap; - } - - select { - margin-left: 10px; - height: 20px; - border: 1px solid silver; - border-radius: 3px; - } - - .melody-selection-wrapper { - display: flex; - flex-direction: row; - margin-bottom: 6px; - - .info-wrapper-wrapper { - display: none; - } - - .default-btn { - margin-top: -2px; - margin-left: 10px; - - button { - width: 100px; - } - } - } - - @media screen and (max-width: 768px) { - flex-direction: column; - - select { - margin-left: 0px; - } - - .melody-selection-wrapper { - .default-btn button { - width: inherit; - } - } - } - } - - .save-melody-wrapper { - display: flex; - flex-direction: row; - - input { - border: 1px solid silver; - padding-left: 5px; - padding-right: 5px; - line-height: 23px; - } - - .default-btn { - margin-left: 10px; - - button { - width: 100px; - - @media screen and (max-width: 768px) { - width: inherit; - } - } - } - } - - .melody-editor-escs { - display: flex; - flex-wrap: wrap; - margin-left: -10px; - margin-right: -10px; - - &.all { - .esc-melody-wrapper { - width: 100%; - } - } - } - - .button-wrapper { - display: flex; - justify-content: flex-end; - - button { - width: 100px; - margin-left: 15px; - } - } - - @media screen and (max-width: 600px) { - .melody-editor-escs.single { - .esc-melody { - margin-top: 5px; - margin-bottom: 5px; - - header { - flex-direction: column; - border: 0px; - padding-bottom: 0px; - margin-bottom: 4px; - - .default-btn { - margin-top: 2px; - margin-left: -2px; - margin-right: -2px; - - button { - margin-left: 2px; - margin-right: 2px; - } - } - } - } - } - } -}