|
1 |
| -const App = `import {Alert} from "@nextui-org/react"; |
| 1 | +const App = `import {Alert, Button} from "@nextui-org/react"; |
2 | 2 |
|
3 | 3 | export default function App() {
|
4 |
| - const title = "Success"; |
5 |
| - const description = "Thanks for subscribing to our newsletter!"; |
6 |
| - |
| 4 | + const [isVisible, setIsVisible] = React.useState(true); |
| 5 | +
|
7 | 6 | return (
|
8 | 7 | <div className="flex items-center justify-center w-full">
|
| 8 | + {!isVisible && ( |
| 9 | + <Button |
| 10 | + className="bg-background text-default-700 font-medium border-1 shadow-small" |
| 11 | + size="sm" |
| 12 | + variant="bordered" |
| 13 | + onPress={() => setIsVisible(true)} |
| 14 | + > |
| 15 | + Show Alert |
| 16 | + </Button> |
| 17 | + )} |
9 | 18 | <Alert
|
10 |
| - title={title} |
11 |
| - description={description} |
12 | 19 | classNames={{
|
13 |
| - base: [ |
14 |
| - "bg-background", |
15 |
| - "border", |
16 |
| - "border-foreground-400", |
17 |
| - "shadow", |
18 |
| - "hover:bg-slate-200", |
19 |
| - "cursor-pointer", |
| 20 | + base: [ |
| 21 | + "bg-default-50 dark:bg-background", |
| 22 | + "relative before:content-[''] before:absolute before:z-10", |
| 23 | + "before:left-0 before:top-[-1px] before:bottom-[-1px] before:w-1 before:bg-secondary", |
| 24 | + "rounded-l-none border-l-0", |
20 | 25 | ],
|
21 |
| - title: ["text-base", "text-foreground", "font-semibold"], |
22 |
| - description: ["text-base", "text-foreground-600"], |
| 26 | + mainWrapper: "pt-1", |
| 27 | + iconWrapper: "border-1 border-secondary-200 dark:bg-transparent", |
| 28 | + alertIcon: "text-secondary", |
23 | 29 | }}
|
24 |
| - /> |
| 30 | + isVisible={isVisible} |
| 31 | + title="The documents you requested are ready to be viewed" |
| 32 | + variant="faded" |
| 33 | + onClose={() => setIsVisible(false)} |
| 34 | + > |
| 35 | + <div className="flex items-center gap-1 mt-3"> |
| 36 | + <Button |
| 37 | + className="bg-background text-default-700 font-medium border-1 shadow-small" |
| 38 | + size="sm" |
| 39 | + variant="bordered" |
| 40 | + > |
| 41 | + View documents |
| 42 | + </Button> |
| 43 | + <Button |
| 44 | + className="text-default-500 font-medium underline underline-offset-4" |
| 45 | + size="sm" |
| 46 | + variant="light" |
| 47 | + > |
| 48 | + Maybe later |
| 49 | + </Button> |
| 50 | + </div> |
| 51 | + </Alert> |
25 | 52 | </div>
|
26 | 53 | );
|
27 | 54 | }`;
|
|
0 commit comments