Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge latest changes to main #7

Merged
merged 10 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# mui-simple-toast - Simplified toaster/snackbar for MUI
A Simpler MUI Toast.
This reduces code to single line compared to Actual Toast Code from MUI
```
<Snackbar open={open} autoHideDuration={6000} onClose={handleClose}>
<Alert onClose={handleClose} severity="success" sx={{ width: '100%' }}>
This is a success message!
</Alert>
</Snackbar>
```

to

```
<MUISimpleToast toast={toast} setToast={setToast} />
```

# [Demo](https://codesandbox.io/s/mui-simple-toast-g5ei8i?file=/src/index.tsx)

Expand Down Expand Up @@ -30,7 +44,7 @@ fetch(url)

```
import React, { useEffect, useState } from 'react';
import MUISimpleToast, { defaultToast } from 'mui-simple-toast/cjs'
import MUISimpleToast, { defaultToast } from 'mui-simple-toast'
import './App.css';

function App() {
Expand Down Expand Up @@ -68,12 +82,11 @@ In return method of component, add ```<MUISimpleToast toast={toast} setToast={se
in index.js

```

import React, { createContext, useState } from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './index.css';
import { defaultToast } from 'mui-simple-toast/cjs';
import { defaultToast } from 'mui-simple-toast';

/** Create a Context for Toast Wrapper*/
export const ToastContext = createContext(defaultToast)
Expand Down Expand Up @@ -102,7 +115,6 @@ root.render(
In your App/ Child Component, add

```

const { toast, setToast }: any = useContext(ToastContext)

```
Expand Down
Loading