@finos/legend-data-cube
Version:
30 lines • 2.48 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { cn, DataCubeIcon } from '@finos/legend-art';
import { FormButton } from './DataCubeFormUtils.js';
import { AlertType, } from '../../stores/services/DataCubeAlertService.js';
export function Alert(props) {
const { message, type, text, actions = [], onClose } = props;
return (_jsxs("div", { className: "h-full w-full", children: [_jsxs("div", { className: cn('flex w-full overflow-auto p-6', {
'h-[calc(100%_-_40px)]': actions.length !== 0,
'h-full': !actions.length,
}), children: [_jsxs("div", { className: "mr-3", children: [type === AlertType.ERROR && (_jsx(DataCubeIcon.AlertError, { className: "flex-shrink-0 stroke-[0.5px] text-[40px] text-red-500" })), type === AlertType.INFO && (_jsx(DataCubeIcon.AlertInfo, { className: "flex-shrink-0 stroke-[0.5px] text-[40px] text-sky-500" })), type === AlertType.SUCCESS && (_jsx(DataCubeIcon.AlertSuccess, { className: "flex-shrink-0 stroke-[0.5px] text-[40px] text-green-500" })), type === AlertType.WARNING && (_jsx(DataCubeIcon.AlertWarning, { className: "flex-shrink-0 stroke-[0.3px] text-[40px] text-amber-500" }))] }), _jsxs("div", { children: [_jsx("div", { className: "whitespace-break-spaces text-lg", children: message }), _jsx("div", { className: "mt-1 whitespace-break-spaces text-neutral-500", children: text })] })] }), actions.length !== 0 && (_jsx("div", { className: "flex h-10 items-center justify-end border border-t-neutral-300 px-2", children: actions.map((action, idx) => (_jsx(FormButton, { className: "ml-2 first-of-type:ml-0", onClick: () => {
action.handler();
onClose?.();
}, autoFocus: idx === 0, children: action.label }, idx))) }))] }));
}
//# sourceMappingURL=DataCubeAlert.js.map