import * as React from "react"; import gql from "graphql-tag"; import { useQuery } from "@apollo/react-hooks"; import { Badge, Box, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerHeader, DrawerOverlay, FormControl, FormErrorMessage, FormHelperText, FormLabel, Link, Select, Spinner, useBreakpointValue, } from "@chakra-ui/core"; import { ExternalLinkIcon } from "@chakra-ui/icons"; /** * ItemSupportDrawer shows Support UI for the item when open. * * This component controls the drawer element. The actual content is imported * from another lazy-loaded component! */ function ItemSupportDrawer({ item, isOpen, onClose }) { const placement = useBreakpointValue({ base: "bottom", lg: "right", // TODO: There's a bug in the Chakra RC that doesn't read the breakpoint // specification correctly - we need these extra keys until it's fixed! // https://github.com/chakra-ui/chakra-ui/issues/1444 0: "bottom", 1: "bottom", 2: "right", 3: "right", }); return ( {item.name} Support ); } function SpecialColorFields({ item }) { const { loading, error, data } = useQuery(gql` query ItemSupportDrawer { allColors { id name isStandard } } `); const nonStandardColors = data?.allColors?.filter((c) => !c.isStandard) || []; nonStandardColors.sort((a, b) => a.name.localeCompare(b.name)); return ( Special color {error && {error.message}} {!error && ( This controls which previews we show on the{" "} item page . )} ); } export default ItemSupportDrawer;