Skip to content

Commit 0e83b57

Browse files
committed
react-toastify
1 parent 55d5a31 commit 0e83b57

File tree

7 files changed

+67
-42
lines changed

7 files changed

+67
-42
lines changed

Helper/Context.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

app/Components/Header.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/globals.css

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
4-
1+
*{
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
font-family:'Courier New', Courier, monospace;
6+
}
7+
html,body{
8+
width: 100%;
9+
height: 100%;
10+
}
511
body{
6-
padding: 5px;
12+
padding: 20px;
13+
}
14+
button{
15+
padding: 15px 30px;
16+
background-color: lightseagreen;
17+
color: #fff;
18+
border-radius: 5px;
19+
border: none;
20+
font-size: 30px;
21+
font-weight: 600;
722
}

app/layout.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import MyContext from "@/Helper/Context";
21
import "./globals.css";
32
export const metadata = {
43
title: "React Advanced",
@@ -9,7 +8,7 @@ export default function RootLayout({ children }) {
98
return (
109
<html lang="en">
1110
<body suppressContentEditableWarning>
12-
<MyContext>{children}</MyContext>
11+
{children}
1312
</body>
1413
</html>
1514
);

app/page.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
"use client"
2-
import React, { useContext } from 'react'
3-
import { MyContext } from '@/Helper/Context'
4-
import Header from './Components/Header'
5-
const page = () => {
6-
const user = useContext(MyContext)
2+
import React from 'react'
3+
import { ToastContainer, toast } from 'react-toastify';
4+
import 'react-toastify/dist/ReactToastify.css';
5+
6+
export const page = () => {
7+
const notify = () => {
8+
toast('🦄 Wow so cute!', {
9+
position: "top-right",
10+
autoClose: 5000,
11+
hideProgressBar: false,
12+
closeOnClick: true,
13+
pauseOnHover: true,
14+
draggable: true,
15+
progress: undefined,
16+
theme: "dark",
17+
// transition: Bounce,
18+
});
19+
}
720
return (
8-
<>
9-
<Header />
10-
<div className='text-black'>{user}
11-
</div></>
21+
<div>
22+
<button onClick={notify}>Login</button>
23+
<ToastContainer />
24+
</div>
1225
)
1326
}
14-
1527
export default page

package-lock.json

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"axios": "^1.7.2",
1313
"next": "14.2.4",
1414
"react": "^18",
15-
"react-dom": "^18"
15+
"react-dom": "^18",
16+
"react-toastify": "^10.0.5"
1617
},
1718
"devDependencies": {
1819
"postcss": "^8",

0 commit comments

Comments
 (0)