-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WSTEAM1-969: Add Checkbox * WSTEAM1-969: Merge conflicts * WSTEAM1-969: Refactor * WSTEAM1-969: Update snapshots * WSTEAM1-969: Update margin
- Loading branch information
1 parent
2637ba8
commit 39cd6dd
Showing
11 changed files
with
231 additions
and
102 deletions.
There are no files selected for viewing
32 changes: 21 additions & 11 deletions
32
ws-nextjs-app/pages/[service]/send/[id]/FormField/Checkbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
import React from 'react'; | ||
/** @jsx jsx */ | ||
import { jsx } from '@emotion/react'; | ||
import { InputProps } from '../types'; | ||
import Label from './FieldLabel'; | ||
import styles from './styles'; | ||
|
||
export default ({ | ||
id, | ||
name, | ||
handleChange, | ||
inputState, | ||
describedBy, | ||
label, | ||
}: InputProps) => { | ||
const { isValid, value = false, required } = inputState; | ||
return ( | ||
<input | ||
id={id} | ||
name={name} | ||
type="checkbox" | ||
checked={value as boolean} | ||
onChange={e => handleChange(e.target.name, e.target.checked)} | ||
aria-invalid={!isValid} | ||
aria-required={required} | ||
aria-describedby={describedBy} | ||
/> | ||
<div css={[styles.checkboxContainer]}> | ||
<input | ||
css={[styles.checkbox, styles.focusIndicator]} | ||
id={id} | ||
name={name} | ||
type="checkbox" | ||
checked={value as boolean} | ||
onChange={e => handleChange(e.target.name, e.target.checked)} | ||
aria-invalid={!isValid} | ||
aria-required={required} | ||
aria-describedby={describedBy} | ||
/> | ||
<Label id={id} css={[styles.checkboxLabel]}> | ||
{label} | ||
</Label> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 17 additions & 12 deletions
29
ws-nextjs-app/pages/[service]/send/[id]/FormField/File.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
import React from 'react'; | ||
import { InputProps } from '../types'; | ||
import Label from './FieldLabel'; | ||
|
||
export default ({ | ||
id, | ||
name, | ||
handleChange, | ||
inputState, | ||
describedBy, | ||
label, | ||
}: InputProps) => { | ||
const { isValid, required } = inputState; | ||
return ( | ||
<input | ||
id={id} | ||
name={name} | ||
type="file" | ||
onChange={e => | ||
e.target.files && handleChange(e.target.name, e.target.files) | ||
} | ||
multiple | ||
aria-invalid={!isValid} | ||
aria-required={required} | ||
aria-describedby={describedBy} | ||
/> | ||
<> | ||
<Label id={id}>{label}</Label> | ||
<input | ||
id={id} | ||
name={name} | ||
type="file" | ||
onChange={e => | ||
e.target.files && handleChange(e.target.name, e.target.files) | ||
} | ||
multiple | ||
aria-invalid={!isValid} | ||
aria-required={required} | ||
aria-describedby={describedBy} | ||
/> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.