Skip to content

Commit

Permalink
chore: adding junior's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
macci001 committed Jan 21, 2025
1 parent 05e06b9 commit 10d9612
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 246 deletions.
6 changes: 3 additions & 3 deletions .changeset/shaggy-beers-breathe.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
"@nextui-org/shared-icons": patch
"@nextui-org/toast": patch
"@nextui-org/theme": patch
"@heroui/shared-icons": patch
"@heroui/toast": patch
"@heroui/theme": patch
---

Introducing the toast component(#2560)
40 changes: 18 additions & 22 deletions apps/docs/content/components/toast/color.raw.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,23 @@ import {addToast, Button} from "@heroui/react";

export default function App() {
return (
<>
<div className="flex flex-wrap gap-x-2">
{["default", "primary", "secondary", "success", "warning", "danger"].map((color) => (
<Button
key={color}
// @ts-ignore
color={color}
variant={"solid"}
onPress={() =>
addToast({
title: "Toast title",
description: "Toast displayed successfully",
// @ts-ignore
color: color,
})
}
>
{color}
</Button>
))}
</div>
</>
<div className="flex flex-wrap gap-x-2">
{["default", "primary", "secondary", "success", "warning", "danger"].map((color) => (
<Button
key={color}
color={color}
variant={"flat"}
onPress={() =>
addToast({
title: "Toast title",
description: "Toast displayed successfully",
color: color,
})
}
>
{color}
</Button>
))}
</div>
);
}
82 changes: 39 additions & 43 deletions apps/docs/content/components/toast/custom-styles.raw.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,49 @@ import {addToast, Button, cn} from "@heroui/react";

const CustomToastComponent = () => {
return (
<>
<Button
variant="solid"
onPress={() => {
addToast({
title: "Sucessful!",
description: "Document uploaded to cloud successful.",
classNames: {
base: cn([
"bg-default-50 dark:bg-background shadow-sm",
"border-1",
"relative before:content-[''] before:absolute before:z-10",
"before:left-0 before:top-[-1px] before:bottom-[-1px] before:w-1",
"rounded-l-none border-l-0",
"min-w-[350px]",
"rounded-md",
"flex flex-col items-start",
"before:bg-primary border-primary-200 dark:border-primary-100",
,
]),
icon: "w-6 h-6 fill-current",
},
endContent: (
<div className="ms-11 my-2 flex gap-x-2">
<Button color={"primary"} size="sm" variant="bordered">
View Document
</Button>
<Button className="underline-offset-2" color={"primary"} size="sm" variant="light">
Maybe Later
</Button>
</div>
),
});
}}
>
Show Toast
</Button>
</>
<Button
variant="flat"
onPress={() => {
addToast({
title: "Sucessful!",
description: "Document uploaded to cloud successful.",
classNames: {
base: cn([
"bg-default-50 dark:bg-background shadow-sm",
"border-1",
"relative before:content-[''] before:absolute before:z-10",
"before:left-0 before:top-[-1px] before:bottom-[-1px] before:w-1",
"rounded-l-none border-l-0",
"min-w-[350px]",
"rounded-md",
"flex flex-col items-start",
"before:bg-primary border-primary-200 dark:border-primary-100",
,
]),
icon: "w-6 h-6 fill-current",
},
endContent: (
<div className="ms-11 my-2 flex gap-x-2">
<Button color={"primary"} size="sm" variant="bordered">
View Document
</Button>
<Button className="underline-offset-2" color={"primary"} size="sm" variant="light">
Maybe Later
</Button>
</div>
),
});
}}
>
Show Toast
</Button>
);
};

export default function App() {
return (
<>
<div className="flex gap-2">
<CustomToastComponent />
</div>
</>
<div className="flex gap-2">
<CustomToastComponent />
</div>
);
}
4 changes: 2 additions & 2 deletions apps/docs/content/components/toast/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import customStyles from "./custom-styles";
import radius from "./radius";
import placement from "./placement";
import provider from "./provider";
import types from "./types";
import usage from "./usage";

export const toastContent = {
color,
Expand All @@ -13,5 +13,5 @@ export const toastContent = {
radius,
placement,
provider,
types,
usage,
};
2 changes: 1 addition & 1 deletion apps/docs/content/components/toast/placement.raw.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function App() {
].map((position) => (
<Button
key={position}
variant={"solid"}
variant={"flat"}
onPress={() => {
setPlacement(position);
addToast({
Expand Down
39 changes: 18 additions & 21 deletions apps/docs/content/components/toast/radius.raw.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@ import {addToast, Button} from "@heroui/react";

export default function App() {
return (
<>
<div className="flex flex-wrap gap-x-2">
{["none", "sm", "md", "lg", "full"].map((radius) => (
<Button
key={radius}
radius={radius}
variant={"solid"}
onPress={() =>
addToast({
title: "Toast title",
description: "Toast displayed successfully",
// @ts-ignore
radius: radius,
})
}
>
{radius}
</Button>
))}
</div>
</>
<div className="flex flex-wrap gap-x-2">
{["none", "sm", "md", "lg", "full"].map((radius) => (
<Button
key={radius}
radius={radius}
variant={"flat"}
onPress={() =>
addToast({
title: "Toast title",
description: "Toast displayed successfully",
radius: radius,
})
}
>
{radius}
</Button>
))}
</div>
);
}
114 changes: 0 additions & 114 deletions apps/docs/content/components/toast/types.raw.jsx

This file was deleted.

9 changes: 0 additions & 9 deletions apps/docs/content/components/toast/types.ts

This file was deleted.

Loading

0 comments on commit 10d9612

Please sign in to comment.