diff --git a/src/PhonoChangeApplier.js b/src/PhonoChangeApplier.js index 819b9f8..035a9aa 100644 --- a/src/PhonoChangeApplier.js +++ b/src/PhonoChangeApplier.js @@ -10,7 +10,7 @@ const PhonoChangeApplier = () => { const [ phonemes, setPhonemes ] = useState( { phoneme: [ 'feature' ] } ); - const [ epochs, setEpochs ] = useState([{name: 'epoch one', changes:['sound>change/environment']}]); + const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ feature]>[+ new feature]/[]_[]']}]); return (
diff --git a/src/components/Epochs.js b/src/components/Epochs.js index 55e915e..641b390 100644 --- a/src/components/Epochs.js +++ b/src/components/Epochs.js @@ -4,17 +4,22 @@ import './Epochs.scss'; import SoundChangeSuite from './SoundChangeSuite'; const addEpoch = (e, props) => { - console.log(props) e.preventDefault() - props.setEpochs([...props.epochs, {name: '', changes:['']}]) - console.log(props) + let index = props.epochs.length + 1; + props.setEpochs([...props.epochs, {name: `epoch ${index}`, changes:['[+ feature]>[+ new feature]/[]_[]']}]) } + const Epochs = props => { + const removeEpoch = (e, epochName) => { + e.preventDefault() + let newEpochs = props.epochs.filter(epoch => epoch.name !== epochName); + props.setEpochs(newEpochs) + } return (

Sound Change Epochs

- {props.epochs ? props.epochs.map((epoch, idx) => ) : <>} + {props.epochs ? props.epochs.map((epoch, idx) => ) : <>}
addEpoch(e, props)}>
diff --git a/src/components/SoundChangeSuite.js b/src/components/SoundChangeSuite.js index 122b43e..18b84a4 100644 --- a/src/components/SoundChangeSuite.js +++ b/src/components/SoundChangeSuite.js @@ -13,6 +13,9 @@ const SoundChangeSuite = props => { onChange={e=>setEpoch({...epoch, changes:e.target.value.split(/\n/)})} > +
props.removeEpoch(e, epoch.name)}> + +
); }