Skip to content

Commit 0ba3520

Browse files
committed
feat: refactor Island story to use addIslandNotification for toast management
1 parent 8dafc70 commit 0ba3520

1 file changed

Lines changed: 43 additions & 43 deletions

File tree

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {Meta} from "@storybook/react-vite";
22
import React from "react";
3-
import {Island, useIsland} from "./Island";
3+
import {Island} from "./Island";
44
import {ButtonGroup} from "../button-group/ButtonGroup";
55
import {Button} from "../button/Button";
66
import {Text} from "../text/Text";
77
import {IconCircleCheck, IconCircleX, IconFileSpark} from "@tabler/icons-react";
8-
import {Card} from "../card/Card";
98
import {Flex} from "../flex/Flex";
109
import {FullScreen} from "../fullscreen/FullScreen";
1110
import {Progress} from "../progress/Progress";
11+
import {addIslandNotification} from "./Island.hook";
1212

1313
export default {
1414
title: "Island",
@@ -22,8 +22,6 @@ export default {
2222

2323
export const IslandExample = () => {
2424

25-
const island = useIsland()
26-
2725
return <FullScreen>
2826
<Flex pos={"fixed"} top={"1rem"} left={"0"} w={"100%"} justify={"center"} style={{zIndex: 9999}}>
2927
<Island>
@@ -40,45 +38,47 @@ export const IslandExample = () => {
4038
</ButtonGroup>
4139
</Island>
4240
</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>
41+
<Flex pos={"fixed"} bottom={"1rem"} left={"0"} w={"100%"} justify={"center"} style={{zIndex: 9999}}>
42+
<ButtonGroup color={"primary"}>
43+
<Button onClick={() => {
44+
addIslandNotification({
45+
icon: <Text c={"#70ffb2"}>Approaching limit</Text>,
46+
message: <Progress w={"100px"} h={"7.5px"} value={30} predictionValue={75} max={100} color={"#70ffb2"}/>,
47+
content: <Flex w={"100%"} style={{flexDirection: "column", gap: "0.7rem"}}>
48+
<Text>
49+
You used 50% of your available workflow executions and will used 75% until its reseted.
50+
</Text>
51+
<Flex align={"center"} style={{gap: "0.7rem"}}>
52+
<Button w={"100%"}>
53+
Add new license
54+
</Button>
55+
<Button w={"100%"}>
56+
Buy new license
57+
</Button>
58+
</Flex>
6059
</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>
60+
})
61+
}}>
62+
Info
63+
</Button>
64+
<Button onClick={() => {
65+
addIslandNotification({
66+
icon: <IconCircleCheck color={"#29BF12"} size={16}/>,
67+
message: <Text c={"#29BF12"}>Added license</Text>,
68+
})
69+
}}>
70+
Success
71+
</Button>
72+
<Button onClick={() => {
73+
addIslandNotification({
74+
icon: <IconCircleX color={"#D90429"} size={16}/>,
75+
message: <Text c={"#D90429"}>Internal error</Text>,
76+
index: 1
77+
})
78+
}}>
79+
Error
80+
</Button>
81+
</ButtonGroup>
82+
</Flex>
8383
</FullScreen>
8484
}

0 commit comments

Comments
 (0)