This repository has been archived by the owner on Dec 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from reactioncommerce/feat-12-mikemurray-notis…
…tack feat: Add notistack
- Loading branch information
Showing
11 changed files
with
162 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* eslint-disable react/display-name */ | ||
/* eslint-disable react/no-multi-comp */ | ||
import React from "react"; | ||
import TagIcon from "mdi-material-ui/Tag"; | ||
import { Box, Card, CardContent, CardHeader } from "@material-ui/core"; | ||
import { Button } from "@reactioncommerce/catalyst"; | ||
import { useSnackbar } from "../../../package/src"; | ||
|
||
/** | ||
* Register sample tags plugin | ||
* @param {Object} params Params provided by `registerPlugin` | ||
* @returns {undefined} | ||
*/ | ||
export default function ({ registerRoute }) { | ||
// Register routes | ||
registerRoute({ | ||
path: "/snackbars", | ||
group: "navigation", | ||
navigationItemLabel: "Snackbars", | ||
IconComponent: TagIcon, | ||
MainComponent: () => { | ||
const { enqueueSnackbar } = useSnackbar(); | ||
|
||
const handleSuccess = () => { | ||
enqueueSnackbar("Success", { | ||
variant: "success" | ||
}); | ||
}; | ||
|
||
const handleError = () => { | ||
enqueueSnackbar("Error", { | ||
variant: "error" | ||
}); | ||
}; | ||
|
||
const handleWarning = () => { | ||
enqueueSnackbar("Error", { | ||
variant: "warning" | ||
}); | ||
}; | ||
|
||
const handleInfo = () => { | ||
enqueueSnackbar("Error", { | ||
variant: "info" | ||
}); | ||
}; | ||
|
||
return ( | ||
<Card> | ||
<CardHeader title="Snackbar examples" /> | ||
<CardContent> | ||
<Box paddingBottom={1}> | ||
<Button | ||
color="primary" | ||
variant="contained" | ||
onClick={handleSuccess} | ||
> | ||
Open success snackbar | ||
</Button> | ||
</Box> | ||
|
||
<Box paddingBottom={1}> | ||
<Button | ||
color="error" | ||
variant="contained" | ||
onClick={handleError} | ||
> | ||
Open error snackbar | ||
</Button> | ||
</Box> | ||
|
||
<Box paddingBottom={1}> | ||
<Button | ||
color="primary" | ||
onClick={handleWarning} | ||
> | ||
Open warning snackbar | ||
</Button> | ||
</Box> | ||
|
||
<Box paddingBottom={1}> | ||
<Button | ||
color="primary" | ||
onClick={handleInfo} | ||
> | ||
Open info snackbar | ||
</Button> | ||
</Box> | ||
|
||
</CardContent> | ||
</Card> | ||
); | ||
} | ||
}); | ||
} |