Skip to content

Commit

Permalink
adding close success handler
Browse files Browse the repository at this point in the history
Signed-off-by: Nilesh Gupta <[email protected]>
  • Loading branch information
Nilesh Gupta committed Sep 5, 2024
1 parent 3dfa0ad commit 42a7993
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/components/Staff/MinStaffSuccess.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import {Alert, Box, Button} from "@mui/material";
import {Alert, Box, IconButton} from "@mui/material";
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
import React from "react";
import CloseIcon from "@mui/icons-material/Close";

export interface IMinStaffSuccess {
minStaffNumber: number | null,
message: string,
closeHandler: () => void
}

export const MinStaffSuccess = ({minStaffNumber, message}: IMinStaffSuccess) => {
export const MinStaffSuccess = ({minStaffNumber, message, closeHandler}: IMinStaffSuccess) => {
return <Box data-testid={`min-staff-form-success`} sx={{marginTop: '10px', backgroundColor: '#eeeff0'}}>
<Alert sx={{color: '#FFFFFF', backgroundColor: '#2E7D32'}} severity="success"
action={
<IconButton
aria-label="close"
color="inherit"
size="small"
onClick={closeHandler}
>
<CloseIcon fontSize="inherit"/>
</IconButton>
}
icon={<CheckCircleIcon style={{color: '#FFFFFF'}}/>}>{message} {minStaffNumber}</Alert>
</Box>
}
5 changes: 4 additions & 1 deletion src/components/Staff/MinStaffSucess.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ type Story = StoryObj<typeof MinStaffSuccessComponent>;
export const MinStaffSuccess: Story = {
args: {
minStaffNumber: 1,
message: "You updated the minimum staff number"
message: "You updated the minimum staff number",
closeHandler: () => {
console.log("Close handler")
}
}
};

0 comments on commit 42a7993

Please sign in to comment.