mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-06-23 01:26:40 +02:00
Show Update and Cancel instead of Create when editing words
This commit is contained in:
parent
43d2d48b27
commit
0d2ac0648e
1 changed files with 41 additions and 18 deletions
|
@ -104,7 +104,7 @@ export class WordForm extends Component {
|
||||||
<div className='box'>
|
<div className='box'>
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label className='label'>Word</label>
|
<label className='label'>Word</label>
|
||||||
<p className='control'>
|
<div className='control'>
|
||||||
<input className={ `input${(!this.state.nameIsValid) ? ' is-danger' : ''}` }
|
<input className={ `input${(!this.state.nameIsValid) ? ' is-danger' : ''}` }
|
||||||
type='text' placeholder='Required'
|
type='text' placeholder='Required'
|
||||||
value={ this.state.wordName }
|
value={ this.state.wordName }
|
||||||
|
@ -115,7 +115,7 @@ export class WordForm extends Component {
|
||||||
? (
|
? (
|
||||||
<span className='help is-danger'>You must specify the word.</span>
|
<span className='help is-danger'>You must specify the word.</span>
|
||||||
) : null}
|
) : null}
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<IPAField value={ this.state.wordPronunciation }
|
<IPAField value={ this.state.wordPronunciation }
|
||||||
|
@ -123,7 +123,7 @@ export class WordForm extends Component {
|
||||||
|
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label className='label'>Part of Speech</label>
|
<label className='label'>Part of Speech</label>
|
||||||
<p className='control'>
|
<div className='control'>
|
||||||
<span className='select'>
|
<span className='select'>
|
||||||
<select value={ this.state.wordPartOfSpeech }
|
<select value={ this.state.wordPartOfSpeech }
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
|
@ -139,12 +139,12 @@ export class WordForm extends Component {
|
||||||
})}
|
})}
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label className='label'>Definition</label>
|
<label className='label'>Definition</label>
|
||||||
<p className='control'>
|
<div className='control'>
|
||||||
<input className={ `input${(!this.state.definitionIsValid) ? ' is-danger' : ''}` }
|
<input className={ `input${(!this.state.definitionIsValid) ? ' is-danger' : ''}` }
|
||||||
type='text' placeholder='Equivalent word(s)'
|
type='text' placeholder='Equivalent word(s)'
|
||||||
value={ this.state.wordDefinition }
|
value={ this.state.wordDefinition }
|
||||||
|
@ -157,12 +157,12 @@ export class WordForm extends Component {
|
||||||
You must at least enter a Definition if excluding Details.
|
You must at least enter a Definition if excluding Details.
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label className='label'>Details</label>
|
<label className='label'>Details</label>
|
||||||
<p className='control'>
|
<div className='control'>
|
||||||
<textarea className={ `textarea${(!this.state.detailsIsValid) ? ' is-danger' : ''}` }
|
<textarea className={ `textarea${(!this.state.detailsIsValid) ? ' is-danger' : ''}` }
|
||||||
placeholder='Explanation of word (Markdown enabled)'
|
placeholder='Explanation of word (Markdown enabled)'
|
||||||
value={ this.state.wordDetails }
|
value={ this.state.wordDetails }
|
||||||
|
@ -175,19 +175,42 @@ export class WordForm extends Component {
|
||||||
You must at least enter Details if excluding a Definition.
|
You must at least enter Details if excluding a Definition.
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='field'>
|
{this.props.word
|
||||||
<p className='control'>
|
? (
|
||||||
<a className='button is-primary'
|
<div className='field is-grouped'>
|
||||||
onClick={() => {
|
<div className='control'>
|
||||||
this.submitWord();
|
<a className='button is-text'
|
||||||
}}>
|
onClick={() => {
|
||||||
Create
|
this.props.callback();
|
||||||
</a>
|
}}>
|
||||||
</p>
|
Cancel
|
||||||
</div>
|
</a>
|
||||||
|
</div>
|
||||||
|
<div className='control'>
|
||||||
|
<a className='button is-primary'
|
||||||
|
onClick={() => {
|
||||||
|
this.submitWord();
|
||||||
|
}}>
|
||||||
|
Update
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className='field'>
|
||||||
|
<div className='control'>
|
||||||
|
<a className='button is-primary'
|
||||||
|
onClick={() => {
|
||||||
|
this.submitWord();
|
||||||
|
}}>
|
||||||
|
Create
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue