()
| 15 | const butter = Butter(process.env.REACT_APP_BUTTER_ECOMMERCE); |
| 16 | |
| 17 | function App() { |
| 18 | const [products, setProducts] = useState([]); |
| 19 | |
| 20 | useEffect(() => { |
| 21 | async function fetchData() { |
| 22 | const res = await butter.content.retrieve(["cookies"], { |
| 23 | order: "name", |
| 24 | }); |
| 25 | const { data } = await res.data; |
| 26 | const allProducts = data.cookies; |
| 27 | setProducts(allProducts); |
| 28 | } |
| 29 | fetchData(); |
| 30 | }, []); |
| 31 | |
| 32 | return ( |
| 33 | <Container maxW="container.xl" h="100vh" > |
| 34 | <Flex justifyContent="space-between" alignContent="center"> |
| 35 | <Text |
| 36 | as="a" |
| 37 | href="/" |
| 38 | fontSize="2rem" |
| 39 | color="gray.900" |
| 40 | fontFamily="Robo" |
| 41 | my="5px" |
| 42 | > |
| 43 | Cookie Jar |
| 44 | </Text> |
| 45 | <Button |
| 46 | my="5px" |
| 47 | colorScheme="green" |
| 48 | variant="ghost" |
| 49 | leftIcon={<FiShoppingBag size="24px" />} |
| 50 | size="lg" |
| 51 | p={2} |
| 52 | className="snipcart-checkout" |
| 53 | > |
| 54 | View Cart |
| 55 | </Button> |
| 56 | </Flex> |
| 57 | <Divider /> |
| 58 | <Box mt={4}> |
| 59 | <SimpleGrid |
| 60 | minChildWidth="300px" |
| 61 | align="center" |
| 62 | justify="center" |
| 63 | spacing="40px" |
| 64 | mb={32} |
| 65 | > |
| 66 | {products.map((product) => ( |
| 67 | <Box |
| 68 | bg="white" |
| 69 | maxW="sm" |
| 70 | borderWidth="1px" |
| 71 | rounded="lg" |
| 72 | shadow="lg" |
| 73 | _hover={{ shadow: "dark-lg" }} |
| 74 | key={product.id} |
nothing calls this directly
no test coverage detected