Skip to content

Commit

Permalink
[fixup] morgan nit and ian comment addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
b-cooper committed Jun 11, 2018
1 parent eba680b commit 71e29c4
Showing 1 changed file with 40 additions and 33 deletions.
73 changes: 40 additions & 33 deletions protocol-designer/src/components/FilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,48 @@ export type FilePageProps = {
saveFileMetadata: () => void
}

const FilePage = ({formConnector, isFormAltered, instruments, saveFileMetadata}: FilePageProps) => (
<div className={styles.file_page}>
<section>
<h2>
Information
</h2>
<form onSubmit={() => { console.log('DID IT') }}>
<div className={formStyles.row_wrapper}>
<FormGroup label='Protocol Name:' className={formStyles.column_1_2}>
<InputField placeholder='Untitled' {...formConnector('name')} />
</FormGroup>
const FilePage = ({formConnector, isFormAltered, instruments, saveFileMetadata}: FilePageProps) => {
const handleSubmit = () => {
// blur focused field on submit
if (document && document.activeElement) document.activeElement.blur()
saveFileMetadata()
}
return (
<div className={styles.file_page}>
<section>
<h2>
Information
</h2>
<form onSubmit={handleSubmit}>
<div className={formStyles.row_wrapper}>
<FormGroup label='Protocol Name:' className={formStyles.column_1_2}>
<InputField placeholder='Untitled' {...formConnector('name')} />
</FormGroup>

<FormGroup label='Organization/Author:' className={formStyles.column_1_2}>
<InputField {...formConnector('author')} />
</FormGroup>
</div>
<FormGroup label='Organization/Author:' className={formStyles.column_1_2}>
<InputField {...formConnector('author')} />
</FormGroup>
</div>

<FormGroup label='Description:'>
<InputField {...formConnector('description')}/>
</FormGroup>
<div className={styles.button_row}>
<OutlineButton type="submit" className={styles.update_button} onClick={saveFileMetadata} disabled={!isFormAltered}>
{isFormAltered ? 'UPDATE' : 'SAVED'}
</OutlineButton>
</div>
</form>
</section>
<FormGroup label='Description:'>
<InputField {...formConnector('description')}/>
</FormGroup>
<div className={styles.button_row}>
<OutlineButton type="submit" className={styles.update_button} disabled={!isFormAltered}>
{isFormAltered ? 'UPDATE' : 'UPDATED'}
</OutlineButton>
</div>
</form>
</section>

<section>
<h2>
Pipettes
</h2>
<InstrumentGroup {...instruments} showMountLabel />
</section>
</div>
)
<section>
<h2>
Pipettes
</h2>
<InstrumentGroup {...instruments} showMountLabel />
</section>
</div>
)
}

export default FilePage

0 comments on commit 71e29c4

Please sign in to comment.