From 953c403f3b3dc16ea3e742bcb81ddee49fc4c239 Mon Sep 17 00:00:00 2001 From: Sorrel Bri Date: Wed, 26 Feb 2020 16:16:52 -0800 Subject: [PATCH] style features and options components --- src/PhonoChangeApplier.scss | 4 ++- src/components/Epochs.js | 31 +++++++++++++++------ src/components/Features.js | 44 ++++++++++++++++++++---------- src/components/Features.scss | 27 ++++++++++++++++++ src/components/Options.js | 23 ++-------------- src/components/Options.scss | 8 ++++++ src/components/SoundChangeSuite.js | 4 +-- src/reducers/reducer.results.js | 1 + 8 files changed, 95 insertions(+), 47 deletions(-) diff --git a/src/PhonoChangeApplier.scss b/src/PhonoChangeApplier.scss index 435a091..677e259 100644 --- a/src/PhonoChangeApplier.scss +++ b/src/PhonoChangeApplier.scss @@ -21,7 +21,9 @@ div.App { grid-template-rows: repeat(auto-fill, minmax(300px, 1fr)); div { - padding: 1em; + width: 100%; + max-height: 85vh; + margin: 1em; overflow-y: scroll; } } diff --git a/src/components/Epochs.js b/src/components/Epochs.js index b779d91..b711cfb 100644 --- a/src/components/Epochs.js +++ b/src/components/Epochs.js @@ -36,23 +36,36 @@ const Epochs = ({epochs, dispatch}) => { value: dispatchValue }) } + + const renderAddEpochButton = index => { + if (index === epochs.length - 1 ) return ( +
addEpoch(e)}> + +
+ ) + return <> + } const renderEpochs = () => { if (epochs) return epochs.map((epoch, index) => ( - - )); +
+ + {renderAddEpochButton(index)} +
+ )); } return ( <> { renderEpochs() } -
addEpoch(e)}> - -
); } diff --git a/src/components/Features.js b/src/components/Features.js index e136ea6..e1135b0 100644 --- a/src/components/Features.js +++ b/src/components/Features.js @@ -21,8 +21,22 @@ const parsePhonesFromFeatureObject = featureObject => { const { plus, minus } = feature[featureName]; return (
  • - {`[+ ${featureName}] = ${plus}`} - {`[- ${featureName}] = ${minus}`} + + + {`[+ ${featureName}]`} + + + {plus} + + + + + {`[- ${featureName}]`} + + + {minus} + +
  • ) }) @@ -82,20 +96,22 @@ const Features = ({ phones, features, dispatch }) => { > {/* ! Positive Phones */} - - setNewPositivePhones(e.target.value)} - > + {/* ! Negative Phones */} - - setNewNegativePhones(e.target.value)} - > + { const [ load, setLoad ] = useState(''); const handleRadioChange = e => { - const { name, id } = e.target.name; + const { name, id } = e.target; dispatch({ type: 'SET_OPTIONS', value: { @@ -16,18 +16,6 @@ const Options = ({ options, dispatch }) => { }); } - const handleCheckChange = e => { - const option = e.target.name; - const setValue = e.target.checked ? 'true' : 'false'; - dispatch({ - type: 'SET_OPTIONS', - value: { - option, - setValue - } - }); - } - const handleFormSubmit = (e, options) => { e.preventDefault(); dispatch({ @@ -48,7 +36,7 @@ const Options = ({ options, dispatch }) => { type="radio" name="output" id="default" checked={options ? options.output === 'default' : true} onChange={e=>handleRadioChange(e)} - /> + /> @@ -71,13 +59,6 @@ const Options = ({ options, dispatch }) => { *proto > *epoch > output - handleCheckChange(e)} - /> - - diff --git a/src/components/Options.scss b/src/components/Options.scss index e69de29..3fc726f 100644 --- a/src/components/Options.scss +++ b/src/components/Options.scss @@ -0,0 +1,8 @@ +div.Options { + + form { + display: flex; + flex-flow: column nowrap; + } + +} \ No newline at end of file diff --git a/src/components/SoundChangeSuite.js b/src/components/SoundChangeSuite.js index eb0b6e5..e2ec606 100644 --- a/src/components/SoundChangeSuite.js +++ b/src/components/SoundChangeSuite.js @@ -14,7 +14,7 @@ const SoundChangeSuite = props => { }, [epoch]) return ( -
    + <>

    {epoch.name}

    @@ -46,7 +46,7 @@ const SoundChangeSuite = props => { props.removeEpoch(e, epoch.name)}>
    -
    + ); } diff --git a/src/reducers/reducer.results.js b/src/reducers/reducer.results.js index c8d4801..0cb6676 100644 --- a/src/reducers/reducer.results.js +++ b/src/reducers/reducer.results.js @@ -276,6 +276,7 @@ export const run = (state: stateType, action: resultsAction): stateType => { }, []); const results = passResults.map(stringifyResults); + console.log(results) return {...state, results } } catch (err) { console.log(err)