@servicetitan/assist-ui
Version:
ServiceTitan Atlas UI Components
56 lines (55 loc) • 2.29 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Flex, Icon, Text } from '@servicetitan/anvil2';
import IconAtlasLogo from '@servicetitan/anvil2/assets/icons/st/atlas_logo.svg';
import { core } from '@servicetitan/anvil2/token';
import { Loader } from '../loader';
import { ErrorMessage } from './error-message';
export const AssistantMessage = ({ error, onRetry, message, className, assistant, svgIcon })=>{
return /*#__PURE__*/ _jsxs(Flex, {
direction: "column",
className: className,
children: [
/*#__PURE__*/ _jsxs(Flex, {
children: [
/*#__PURE__*/ _jsx("span", {
className: "m-inline-end-1",
style: {
color: core.semantic.ForegroundColorPrimary.value
},
children: svgIcon ? /*#__PURE__*/ _jsx(Icon, {
svg: svgIcon,
size: "large",
inherit: true
}) : /*#__PURE__*/ _jsx(Icon, {
svg: IconAtlasLogo,
size: "large",
inherit: true
})
}),
/*#__PURE__*/ _jsx(Text, {
inline: true,
children: /*#__PURE__*/ _jsx("b", {
children: assistant !== null && assistant !== void 0 ? assistant : 'Atlas'
})
})
]
}),
/*#__PURE__*/ _jsxs(Flex, {
direction: "column",
children: [
message && !error && /*#__PURE__*/ _jsx(Text, {
size: "medium",
children: message
}),
error && /*#__PURE__*/ _jsx(ErrorMessage, {
error: error,
message: message,
onRetry: onRetry
}),
!message && !error && /*#__PURE__*/ _jsx(Loader, {})
]
})
]
});
};
//# sourceMappingURL=assistant-message.js.map