Refactor year options when register a user

This commit is contained in:
Leonardo Murça 2022-09-14 18:05:38 -03:00
parent 9a81380039
commit 4af2da5fe9

View file

@ -21,6 +21,7 @@ import LoadingIndicator from '../../components/LoadingIndicator';
import logoImage from '../../assets/if-salas-logo.svg'; import logoImage from '../../assets/if-salas-logo.svg';
import styles from './styles'; import styles from './styles';
import { createArrayFrom1ToN } from '../../utils/createArrayFrom1ToN';
function View({ function View({
isPending, isPending,
@ -110,12 +111,9 @@ function View({
label="Ano da turma" label="Ano da turma"
onChange={onChangeInput} onChange={onChangeInput}
> >
<MenuItem value={0}>{currentYear}</MenuItem> {createArrayFrom1ToN(8).map(i => (
<MenuItem value={1}>{currentYear - 1}</MenuItem> <MenuItem value={i}>{currentYear - i}</MenuItem>
<MenuItem value={2}>{currentYear - 2}</MenuItem> ))}
<MenuItem value={3}>{currentYear - 3}</MenuItem>
<MenuItem value={4}>{currentYear - 4}</MenuItem>
<MenuItem value={5}>{currentYear - 5}</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
{/* TODO: Add field mask */} {/* TODO: Add field mask */}