kopia lustrzana https://github.com/bugout-dev/moonstream
improved TrustedBadge
rodzic
fe5dafc6cf
commit
0f82b709f5
|
@ -1,5 +1,12 @@
|
||||||
import { React } from "react";
|
import { React } from "react";
|
||||||
import { Flex, Image, Link, LinkBox, LinkOverlay } from "@chakra-ui/react";
|
import {
|
||||||
|
Flex,
|
||||||
|
Image,
|
||||||
|
Link,
|
||||||
|
LinkBox,
|
||||||
|
LinkOverlay,
|
||||||
|
chakra,
|
||||||
|
} from "@chakra-ui/react";
|
||||||
|
|
||||||
const TrustedBadge = ({
|
const TrustedBadge = ({
|
||||||
name,
|
name,
|
||||||
|
@ -8,10 +15,15 @@ const TrustedBadge = ({
|
||||||
scale,
|
scale,
|
||||||
isGrayScale,
|
isGrayScale,
|
||||||
boxURL,
|
boxURL,
|
||||||
|
invertColors,
|
||||||
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const _scale = scale ?? 1;
|
const _scale = scale ?? 1;
|
||||||
|
const _isGrayScale = isGrayScale ? "grayscale(100%)" : "";
|
||||||
|
const _invert = invertColors ? "invert(100%)" : "";
|
||||||
|
const filterStr = _isGrayScale + " " + _invert;
|
||||||
return (
|
return (
|
||||||
<LinkBox m={2} bgColor="blue.300" borderRadius="md">
|
<LinkBox m={2} borderRadius="md" {...props}>
|
||||||
<LinkOverlay href={boxURL} isExternal>
|
<LinkOverlay href={boxURL} isExternal>
|
||||||
<Flex
|
<Flex
|
||||||
m={1}
|
m={1}
|
||||||
|
@ -23,7 +35,7 @@ const TrustedBadge = ({
|
||||||
direction="column"
|
direction="column"
|
||||||
>
|
>
|
||||||
<Image
|
<Image
|
||||||
sx={isGrayScale && { filter: "grayscale(100%)" }}
|
sx={{ filter: filterStr }}
|
||||||
h={[
|
h={[
|
||||||
`${2.25 * _scale}rem`,
|
`${2.25 * _scale}rem`,
|
||||||
null,
|
null,
|
||||||
|
@ -51,4 +63,4 @@ const TrustedBadge = ({
|
||||||
</LinkBox>
|
</LinkBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default TrustedBadge;
|
export default chakra(TrustedBadge);
|
||||||
|
|
Ładowanie…
Reference in New Issue