UNPKG

@porsche-design-system/components-react

Version:

Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.

13 lines (10 loc) 677 B
import { jsx, jsxs, Fragment } from 'react/jsx-runtime'; import 'react'; import '../../provider.mjs'; import { PIcon } from '../components/icon.wrapper.mjs'; const messageId = 'message'; const StateMessage = ({ hasMessage, state, message }) => { const isErrorState = state === 'error'; return (jsx("span", { id: messageId, className: "message", role: state === 'success' ? 'status' : 'alert', children: hasMessage && (jsxs(Fragment, { children: [jsx(PIcon, { name: isErrorState ? 'exclamation' : 'check', color: isErrorState ? 'error' : 'success', "aria-hidden": "true" }), message || jsx("slot", { name: "message" })] })) })); }; export { StateMessage, messageId };