|
| 1 | +import {Meta} from "@storybook/react-vite"; |
| 2 | +import React from "react"; |
| 3 | +import {Island, useIsland} from "./Island"; |
| 4 | +import {ButtonGroup} from "../button-group/ButtonGroup"; |
| 5 | +import {Button} from "../button/Button"; |
| 6 | +import {Text} from "../text/Text"; |
| 7 | +import {IconCircleCheck, IconCircleX, IconFileSpark} from "@tabler/icons-react"; |
| 8 | +import {Card} from "../card/Card"; |
| 9 | +import {Flex} from "../flex/Flex"; |
| 10 | +import {FullScreen} from "../fullscreen/FullScreen"; |
| 11 | +import {Progress} from "../progress/Progress"; |
| 12 | + |
| 13 | +export default { |
| 14 | + title: "Island", |
| 15 | + parameters: { |
| 16 | + visualTest: { |
| 17 | + selector: 'body' |
| 18 | + }, |
| 19 | + layout: "fullscreen" |
| 20 | + }, |
| 21 | +} as Meta |
| 22 | + |
| 23 | +export const IslandExample = () => { |
| 24 | + |
| 25 | + const island = useIsland() |
| 26 | + |
| 27 | + return <FullScreen> |
| 28 | + <Flex pos={"fixed"} top={"1rem"} left={"0"} w={"100%"} justify={"center"} style={{zIndex: 9999}}> |
| 29 | + <Island> |
| 30 | + <ButtonGroup color={"primary"} bg={"transparent"} style={{boxShadow: "none"}}> |
| 31 | + <Button paddingSize={"xxs"} variant={"none"}> |
| 32 | + <Text>Home</Text> |
| 33 | + </Button> |
| 34 | + <Button paddingSize={"xxs"} variant={"none"}> |
| 35 | + <Text>Organizations</Text> |
| 36 | + </Button> |
| 37 | + <Button paddingSize={"xxs"} variant={"none"}> |
| 38 | + <Text>Projects</Text> |
| 39 | + </Button> |
| 40 | + </ButtonGroup> |
| 41 | + </Island> |
| 42 | + </Flex> |
| 43 | + <Card color={"secondary"} mt={5}> |
| 44 | + <Button onClick={() => { |
| 45 | + island.addToast({ |
| 46 | + icon: <IconFileSpark color={"#70ffb2"} size={16}/>, |
| 47 | + message: <Text c={"#70ffb2"}>workflow limit almost reached</Text>, |
| 48 | + largeContent: <Flex w={"410px"} style={{flexDirection: "column", gap: "0.7rem"}}> |
| 49 | + <Progress value={30} predictionValue={120} max={100} color={"linear-gradient(to right, #29BF12 0%, #D90429 100%)"}/> |
| 50 | + <Text> |
| 51 | + You used 50% of your available workflow executions and will used 75% until its reseted. |
| 52 | + </Text> |
| 53 | + <Flex align={"center"} style={{gap: "0.7rem"}}> |
| 54 | + <Button w={"100%"}> |
| 55 | + Add new license |
| 56 | + </Button> |
| 57 | + <Button w={"100%"}> |
| 58 | + Buy new license |
| 59 | + </Button> |
| 60 | + </Flex> |
| 61 | + </Flex> |
| 62 | + }) |
| 63 | + }}> |
| 64 | + Info |
| 65 | + </Button> |
| 66 | + <Button onClick={() => { |
| 67 | + island.addToast({ |
| 68 | + icon: <IconCircleCheck color={"#29BF12"} size={16}/>, |
| 69 | + message: <Text c={"#29BF12"}>Added license</Text>, |
| 70 | + }) |
| 71 | + }}> |
| 72 | + Success |
| 73 | + </Button> |
| 74 | + <Button onClick={() => { |
| 75 | + island.addToast({ |
| 76 | + icon: <IconCircleX color={"#D90429"} size={16}/>, |
| 77 | + message: <Text c={"#D90429"}>Internal error</Text>, |
| 78 | + }) |
| 79 | + }}> |
| 80 | + Error |
| 81 | + </Button> |
| 82 | + </Card> |
| 83 | + </FullScreen> |
| 84 | +} |
0 commit comments