-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(group): update group page features per requirements (#113)
* feat(group): add terms link and consent checkbox clickup: https://app.clickup.com/t/8696ed8vp * feat(group): modify form fields per new requirements * feat(shared): add text with links component * feat(group): modify detailed per new requirement * feat(group): modify search per new requestments * feat(group): modify key description to content * feat(group): set activity category default value * feat(group): auto-focus on input field after error
- Loading branch information
1 parent
1ca8506
commit 82471f2
Showing
26 changed files
with
639 additions
and
48 deletions.
There are no files selected for viewing
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,41 @@ | ||
import Box from '@mui/material/Box'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import Checkbox from '@mui/material/Checkbox'; | ||
|
||
export default function CheckboxGroup({ | ||
options, | ||
name, | ||
value, | ||
control, | ||
handleValues, | ||
}) { | ||
const handleCheckboxChange = (_value) => { | ||
const hasValue = value.includes(_value); | ||
const updatedValue = hasValue | ||
? value.filter((v) => v !== _value) | ||
: [...value, _value]; | ||
const newValue = handleValues( | ||
hasValue ? 'remove' : 'add', | ||
_value, | ||
updatedValue, | ||
); | ||
|
||
control.onChange({ target: { name, value: newValue } }); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ display: 'flex', flexWrap: 'wrap' }}> | ||
{options.map((option) => ( | ||
<FormControlLabel | ||
key={option.value} | ||
sx={{ flex: '0 0 124px' }} | ||
control={ | ||
<Checkbox onClick={() => handleCheckboxChange(option.value)} /> | ||
} | ||
label={option.label} | ||
checked={value.includes(option.value)} | ||
/> | ||
))} | ||
</Box> | ||
); | ||
} |
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,68 @@ | ||
import dayjs from 'dayjs'; | ||
import { useEffect, useState } from 'react'; | ||
import Box from '@mui/material/Box'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import Checkbox from '@mui/material/Checkbox'; | ||
import TextField from '@mui/material/TextField'; | ||
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; | ||
import { MobileDatePicker } from '@mui/x-date-pickers/MobileDatePicker'; | ||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; | ||
|
||
export default function DateRadio({ | ||
name, | ||
customValueName, | ||
value, | ||
isCustomValue, | ||
control, | ||
}) { | ||
const [isCustomDate, setIsCustomDate] = useState(isCustomValue); | ||
const [date, setDate] = useState(value); | ||
|
||
useEffect(() => { | ||
control.onChange({ target: { name, value: date } }); | ||
control.onChange({ | ||
target: { name: customValueName, value: isCustomDate }, | ||
}); | ||
}, [name, date, customValueName, isCustomDate]); | ||
|
||
return ( | ||
<LocalizationProvider dateAdapter={AdapterDayjs}> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
label: { whiteSpace: 'nowrap' }, | ||
}} | ||
> | ||
<FormControlLabel | ||
control={<Checkbox onClick={() => setIsCustomDate(true)} />} | ||
label="自訂" | ||
checked={isCustomDate} | ||
/> | ||
<MobileDatePicker | ||
inputFormat="YYYY/MM/DD" | ||
value={date} | ||
onChange={setDate} | ||
onAccept={() => setIsCustomDate(true)} | ||
minDate={dayjs().add(1, 'day')} | ||
maxDate={dayjs().add(4, 'year')} | ||
renderInput={(params) => ( | ||
<TextField | ||
{...params} | ||
size="small" | ||
sx={{ '& legend': { display: 'none' } }} | ||
fullWidth | ||
/> | ||
)} | ||
/> | ||
</Box> | ||
<div> | ||
<FormControlLabel | ||
control={<Checkbox onClick={() => setIsCustomDate(false)} />} | ||
label="不限" | ||
checked={!isCustomDate} | ||
/> | ||
</div> | ||
</LocalizationProvider> | ||
); | ||
} |
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
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.