UNPKG

@jbrowse/core

Version:

JBrowse 2 core libraries used by plugins

12 lines (11 loc) 1.04 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import CloseIcon from '@mui/icons-material/Close'; import Report from '@mui/icons-material/Report'; import { Alert, Button, IconButton, Snackbar as MUISnackbar, } from '@mui/material'; export default function SnackbarContents({ onClose, contents, }) { const { actions } = contents; return (_jsx(MUISnackbar, { open: true, onClose: onClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, children: _jsx(Alert, { onClose: onClose, action: actions?.length ? (_jsxs(_Fragment, { children: [actions.map((action, idx) => (_jsx(Button, { color: "inherit", onClick: e => { action.onClick(); onClose(e); }, children: action.name === 'report' ? _jsx(Report, {}) : action.name }, idx))), _jsx(IconButton, { color: "inherit", onClick: onClose, children: _jsx(CloseIcon, {}) })] })) : null, severity: contents.level || 'warning', children: contents.message }) })); }