Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | 35x 941x 941x 941x 35x 8504x 941x | import { styled, useAppTheme } from "@theme/v2/Provider";
import { Icon } from "@phosphor-icons/react";
import { Stack } from "@mui/material";
import GiveText from "@shared/Text/GiveText";
import GiveTooltip from "@shared/Tooltip/GiveTooltip";
import GiveIconButton from "@shared/IconButton/GiveIconButton";
import { GiveTooltipProps } from "@shared/Tooltip/GiveTooltip.types";
import { TextProps } from "@shared/Text/giveText.types";
interface IGiveLargeIconButton {
variant?: "primary" | "secondary";
Icon: Icon | JSX.ElementType;
label: string;
disabled?: boolean;
tooltipProps?: Partial<GiveTooltipProps>;
labelProps?: Partial<TextProps>;
onClick?: () => void;
defaultBgColor?: string;
highlightBgColor?: string;
customIconColor?: string;
iconSize?: number;
hug?: number;
}
const GiveLargeIconButton = ({
variant = "primary",
Icon,
label,
disabled,
tooltipProps,
labelProps,
onClick,
defaultBgColor,
highlightBgColor,
customIconColor,
iconSize = 36,
hug = 56,
}: IGiveLargeIconButton) => {
const { palette } = useAppTheme();
const iconColor = {
primary: palette?.icon?.["remain-light"],
secondary: palette?.primitive?.blue?.[100],
};
return (
<Stack spacing={1.5} alignItems="center">
<GiveTooltip
disableHoverListener={tooltipProps?.disableHoverListener || true}
title={tooltipProps?.title || ""}
color={tooltipProps?.color || "default"}
{...tooltipProps}
>
<StyledButton
CustomIcon={
<Icon
size={iconSize}
weight="light"
fill={customIconColor || iconColor[variant]}
/>
}
size="large"
onClick={onClick}
disabled={disabled}
isPrimary={variant === "primary"}
data-testid={`large-icon-button-${label}`}
bgColorDefault={defaultBgColor}
bgColorHighlight={highlightBgColor}
hug={hug}
/>
</GiveTooltip>
{label && (
<GiveText color="secondary" variant="bodyS" {...labelProps}>
{label}
</GiveText>
)}
</Stack>
);
};
export default GiveLargeIconButton;
const StyledButton = styled(GiveIconButton, {
shouldForwardProp: (prop) =>
prop !== "isPrimary" &&
prop !== "bgColorDefault" &&
prop !== "bgColorHighlight" &&
prop !== "hug",
})<{
isPrimary: boolean;
bgColorDefault?: string;
bgColorHighlight?: string;
hug?: number;
}>(({ theme, isPrimary, bgColorDefault, bgColorHighlight, hug }) => ({
height: hug,
width: hug,
borderRadius: "50%",
"&:hover": {
"& > svg": {
height: "32px",
width: "32px",
},
"&::after": {
background: isPrimary
? bgColorDefault || theme.palette.gradient["ocean-blue"]?.default
: bgColorHighlight || theme.palette.gradient["ocean-blue"]?.highlight,
animation: "rotate-gradient 2s linear infinite",
},
},
position: "relative",
overflow: "hidden",
"&::after": {
content: "''",
display: "block",
zIndex: -1,
position: "absolute",
top: 0,
right: 0,
bottom: 0,
left: 0,
borderRadius: "50%",
background: isPrimary
? bgColorDefault || theme.palette.gradient["ocean-blue"]?.default
: bgColorHighlight || theme.palette.gradient["ocean-blue"]?.highlight,
},
"@keyframes rotate-gradient": {
"100%": {
transform: "rotate(-360deg)",
},
},
zIndex: 9,
}));
|