impress-2020/src/app/components/WIPCallout.js

63 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-10-10 02:07:49 -07:00
import React from "react";
2020-12-25 09:08:33 -08:00
import { Box, Flex, Tooltip } from "@chakra-ui/react";
2020-10-10 02:07:49 -07:00
import { useCommonStyles } from "../util";
import WIPXweeImg from "../images/wip-xwee.png";
import WIPXweeImg2x from "../images/wip-xwee@2x.png";
2020-10-10 02:07:49 -07:00
function WIPCallout({ children, details, placement = "bottom", ...props }) {
const { brightBackground } = useCommonStyles();
2020-10-10 02:17:21 -07:00
let content = (
<Flex
alignItems="center"
border="1px solid"
borderColor="green.600"
background={brightBackground}
transition="all 0.2s"
2020-10-10 02:17:21 -07:00
borderRadius="full"
boxShadow="md"
paddingLeft="2"
paddingRight="4"
paddingY="1"
fontSize="sm"
{...props}
2020-10-10 02:17:21 -07:00
>
<Box
as="img"
src={WIPXweeImg}
srcSet={`${WIPXweeImg} 1x, ${WIPXweeImg2x} 2x`}
alt=""
width="36px"
height="36px"
marginRight="2"
/>
{children || (
<>
<Box display={{ base: "none", md: "block" }}>
We're working on this page!
</Box>
<Box display={{ base: "block", md: "none" }}>WIP!</Box>
</>
)}
</Flex>
2020-10-10 02:07:49 -07:00
);
2020-10-10 02:17:21 -07:00
if (details) {
content = (
<Tooltip
label={<Box textAlign="center">{details}</Box>}
placement={placement}
2020-10-10 02:17:21 -07:00
shouldWrapChildren
>
<Box cursor="help">{content}</Box>
2020-10-10 02:17:21 -07:00
</Tooltip>
);
}
return content;
2020-10-10 02:07:49 -07:00
}
export default WIPCallout;