mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-24 22:36:22 +02:00
Update login and registration (#437)
This commit is contained in:
parent
4e67254022
commit
29eb477792
56 changed files with 1788 additions and 695 deletions
|
@ -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={
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue