mirror of
https://github.com/ente-io/ente.git
synced 2025-08-13 09:47:17 +00:00
Move into web/
This commit is contained in:
44
web/packages/shared/components/CaptionedText.tsx
Normal file
44
web/packages/shared/components/CaptionedText.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { VerticallyCenteredFlex } from "@ente/shared/components/Container";
|
||||
import { ButtonProps, Typography } from "@mui/material";
|
||||
|
||||
interface Iprops {
|
||||
mainText: string;
|
||||
subText?: string;
|
||||
subIcon?: React.ReactNode;
|
||||
color?: ButtonProps["color"];
|
||||
}
|
||||
|
||||
const getSubTextColor = (color: ButtonProps["color"]) => {
|
||||
switch (color) {
|
||||
case "critical":
|
||||
return "critical.main";
|
||||
default:
|
||||
return "text.faint";
|
||||
}
|
||||
};
|
||||
|
||||
export const CaptionedText = (props: Iprops) => {
|
||||
return (
|
||||
<VerticallyCenteredFlex gap={"4px"}>
|
||||
<Typography> {props.mainText}</Typography>
|
||||
<Typography variant="small" color={getSubTextColor(props.color)}>
|
||||
{"•"}
|
||||
</Typography>
|
||||
{props.subText ? (
|
||||
<Typography
|
||||
variant="small"
|
||||
color={getSubTextColor(props.color)}
|
||||
>
|
||||
{props.subText}
|
||||
</Typography>
|
||||
) : (
|
||||
<Typography
|
||||
variant="small"
|
||||
color={getSubTextColor(props.color)}
|
||||
>
|
||||
{props.subIcon}
|
||||
</Typography>
|
||||
)}
|
||||
</VerticallyCenteredFlex>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user