-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #621 from systemli/Extract-Fields-from-TickerForm
♻️ Extract Fields from TickerForm
- Loading branch information
Showing
15 changed files
with
540 additions
and
300 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Checkbox, FormControlLabel } from '@mui/material' | ||
import { FC } from 'react' | ||
import { Controller, useFormContext } from 'react-hook-form' | ||
|
||
interface Props { | ||
defaultChecked?: boolean | ||
} | ||
|
||
const Active: FC<Props> = ({ defaultChecked }) => { | ||
const { control } = useFormContext() | ||
|
||
return ( | ||
<Controller | ||
name="active" | ||
control={control} | ||
render={({ field }) => <FormControlLabel control={<Checkbox {...field} defaultChecked={defaultChecked} />} label="Active" />} | ||
/> | ||
) | ||
} | ||
|
||
export default Active |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { faUser } from '@fortawesome/free-solid-svg-icons' | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
import { InputAdornment, TextField } from '@mui/material' | ||
import { FC } from 'react' | ||
import { Controller, useFormContext } from 'react-hook-form' | ||
|
||
const Author: FC = () => { | ||
const { control } = useFormContext() | ||
|
||
return ( | ||
<Controller | ||
name="information.author" | ||
control={control} | ||
render={({ field }) => ( | ||
<TextField | ||
{...field} | ||
InputProps={{ | ||
startAdornment: ( | ||
<InputAdornment position="start"> | ||
<FontAwesomeIcon icon={faUser} /> | ||
</InputAdornment> | ||
), | ||
}} | ||
label="Author" | ||
margin="dense" | ||
/> | ||
)} | ||
/> | ||
) | ||
} | ||
|
||
export default Author |
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { faBluesky } from '@fortawesome/free-brands-svg-icons' | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
import { InputAdornment, TextField } from '@mui/material' | ||
import { FC } from 'react' | ||
import { Controller, useFormContext } from 'react-hook-form' | ||
|
||
const Bluesky: FC = () => { | ||
const { control } = useFormContext() | ||
|
||
return ( | ||
<Controller | ||
name="information.bluesky" | ||
control={control} | ||
render={({ field }) => ( | ||
<TextField | ||
{...field} | ||
InputProps={{ | ||
startAdornment: ( | ||
<InputAdornment position="start"> | ||
<FontAwesomeIcon icon={faBluesky} /> | ||
</InputAdornment> | ||
), | ||
}} | ||
label="Bluesky" | ||
margin="dense" | ||
/> | ||
)} | ||
/> | ||
) | ||
} | ||
|
||
export default Bluesky |
Oops, something went wrong.