Skip to content
Snippets Groups Projects
Commit a2945280 authored by Johanna Szepanski's avatar Johanna Szepanski
Browse files

cleaned up IconBadge and added gap prop

parent 4f2069aa
No related branches found
No related tags found
1 merge request!221CE-3638: Migrate iconbadge and iconmenubutton
import { ReactNode } from "react";
import { Grid, Typography } from "@mui/material";
import { Typography } from "@mui/material";
import { Stack } from "@mui/system";
interface IconBadgeProps {
icon: ReactNode;
title: string;
subtitle?: string | ReactNode;
gap?: number;
}
export const IconBadge = ({ icon, title, subtitle }: IconBadgeProps) => (
<Grid
container
export const IconBadge = ({
icon,
title,
subtitle,
gap = 3
}: IconBadgeProps) => (
<Stack
flexDirection="row"
alignItems="center"
direction="row"
gap={gap}
>
<Grid
item
xs={3}
sm={2}
md={1}
>
<Grid
container
justifyContent="center"
direction="column"
alignItems="center"
{icon}
<Stack>
<Typography
variant="subtitle1"
component="p"
color="textPrimary"
>
{icon}
</Grid>
</Grid>
<Grid
item
xs={9}
sm={10}
md={11}
>
<Grid
container
justifyContent="flex-start"
>
<Grid
item
xs={12}
zeroMinWidth
>
<Typography
noWrap
variant="subtitle1"
component="p"
color="textPrimary"
>
{title}
</Typography>
</Grid>
<Grid
item
xs={12}
zeroMinWidth
{title}
</Typography>
{typeof subtitle === "string" ? (
<Typography
component="p"
variant="subtitle2"
>
<Typography
noWrap
component="p"
variant="subtitle2"
>
{subtitle}
</Typography>
</Grid>
</Grid>
</Grid>
</Grid>
{subtitle}
</Typography>
) : (
subtitle
)}
</Stack>
</Stack>
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment