Skip to content

Commit

Permalink
Add an animation for the error alert displaying
Browse files Browse the repository at this point in the history
  • Loading branch information
samau3 committed Oct 20, 2024
1 parent 7101186 commit 20603b2
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions client/src/pages/patients/register/inputs/RegisterPhysician.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import PropTypes from 'prop-types';

import { TextInput, InputBase, Button, Alert, Modal } from '@mantine/core';
import {
TextInput,
InputBase,
Button,
Alert,
Modal,
Transition,
} from '@mantine/core';
import { useForm, isNotEmpty } from '@mantine/form';
import { useDisclosure } from '@mantine/hooks';

Expand Down Expand Up @@ -102,11 +109,22 @@ export default function RegisterPhysician({
title="Register a new physician"
>
<form onSubmit={form.onSubmit(handleSubmit)}>
{error && (
<Alert title="Failed to register physician." color="red">
{error.message}
</Alert>
)}
<Transition
mounted={error}
transition="slide-right"
duration={400}
timingFunction="ease"
>
{(transitionStyle) => (
<Alert
title="Failed to register physician."
color="red"
style={{ ...transitionStyle }}
>
{error?.message}
</Alert>
)}
</Transition>
<TextInput
label="First Name"
placeholder="First Name"
Expand Down

0 comments on commit 20603b2

Please sign in to comment.