Update login and registration (#437)

This commit is contained in:
Luke Vella 2023-01-30 10:15:25 +00:00 committed by GitHub
parent 4e67254022
commit 29eb477792
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 1788 additions and 695 deletions

View file

@ -28,7 +28,11 @@ export const useModalContext = () => {
const ModalProvider: React.VoidFunctionComponent<ModalProviderProps> = ({
children,
}) => {
const [modals, { push, removeAt, updateAt }] = useList<ModalConfig>([]);
const counter = React.useRef(0);
const [modals, { push, removeAt, updateAt }] = useList<
ModalConfig & { id: number }
>([]);
const removeModalAt = (index: number) => {
updateAt(index, { ...modals[index], visible: false });
@ -40,14 +44,14 @@ const ModalProvider: React.VoidFunctionComponent<ModalProviderProps> = ({
<ModalContext.Provider
value={{
render: (props) => {
push(props);
push({ ...props, id: counter.current++ });
},
}}
>
{children}
{modals.map((props, i) => (
<Modal
key={i}
key={`modal-${props.id}`}
visible={true}
{...props}
content={