generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a06c3dd
commit 30a491e
Showing
13 changed files
with
481 additions
and
144 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1 @@ | ||
export declare const useCopyToClipboard: (alertProps?: {}) => (textToCopy: string, content: string) => void; | ||
export declare const useCopyToClipboard: () => (textToCopy: string, content: string) => void; |
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 |
---|---|---|
@@ -1,14 +1,10 @@ | ||
import { enqueueSnackbar } from "notistack"; | ||
import { useCallback } from "react"; | ||
import { useAlert } from "../mui/components/custom/alert/hooks/useAlert"; | ||
import { copyToClipboard } from "../utils/clipboard"; | ||
export const useCopyToClipboard = (alertProps = {}) => { | ||
const alert = useAlert(); | ||
export const useCopyToClipboard = () => { | ||
return useCallback((textToCopy, content) => { | ||
copyToClipboard(textToCopy, () => { | ||
alert === null || alert === void 0 ? void 0 : alert.show({ | ||
content, | ||
...alertProps, | ||
}); | ||
enqueueSnackbar(content, { variant: "success" }); | ||
}); | ||
}, []); | ||
}; |
6 changes: 3 additions & 3 deletions
6
dist/mui/components/custom/widgets/info-widget/InfoWidget.styled.d.ts
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
4 changes: 2 additions & 2 deletions
4
dist/mui/components/custom/widgets/total-widget/TotalWidget.styled.d.ts
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,4 @@ | ||
import React from "react"; | ||
export declare function AlertProvider({ children }: { | ||
children: React.ReactNode; | ||
}): React.JSX.Element; |
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,26 @@ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import Alert from "@mui/material/Alert"; | ||
import { makeStyles } from "@mui/styles"; | ||
import { SnackbarContent, SnackbarProvider, useSnackbar } from "notistack"; | ||
import React, { forwardRef } from "react"; | ||
const useStyles = makeStyles({ | ||
root: { | ||
maxWidth: "500px", | ||
}, | ||
}); | ||
const customBasicAlert = forwardRef(({ id, variant, ...props }, ref) => { | ||
const { closeSnackbar } = useSnackbar(); | ||
const mappedVariant = variant === "default" ? "info" : variant; | ||
return (React.createElement(SnackbarContent, { ref: ref }, | ||
React.createElement(Alert, { severity: mappedVariant, className: `alert alert-${mappedVariant}`, onClose: () => closeSnackbar(id), variant: "filled" }, props.message))); | ||
}); | ||
export function AlertProvider({ children }) { | ||
const classes = useStyles(); | ||
return (React.createElement(SnackbarProvider, { maxSnack: 3, autoHideDuration: 4000, Components: { | ||
error: customBasicAlert, | ||
warning: customBasicAlert, | ||
info: customBasicAlert, | ||
success: customBasicAlert, | ||
default: customBasicAlert, | ||
}, anchorOrigin: { vertical: "bottom", horizontal: "right" }, classes: { containerRoot: classes.root } }, children)); | ||
} |
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 |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import { StyledEngineProvider, ThemeProvider as BaseThemeProvider } from "@mui/material/styles"; | ||
import React from "react"; | ||
import { AlertContextProvider } from "../../mui/components/custom/alert/AlertContextProvider"; | ||
import { LightMaterialUITheme } from "../theme"; | ||
export default function ThemeProvider({ children, theme = LightMaterialUITheme, }) { | ||
return (React.createElement(StyledEngineProvider, { injectFirst: true }, | ||
React.createElement(BaseThemeProvider, { theme: theme }, | ||
React.createElement(AlertContextProvider, null, children)))); | ||
React.createElement(BaseThemeProvider, { theme: theme }, children))); | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default } from "./ThemeProvider"; | ||
export { AlertProvider } from "./AlertProvider"; |
Oops, something went wrong.