UNPKG

@finos/legend-application-marketplace

Version:
52 lines 4.35 kB
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 {} from '@finos/legend-server-marketplace'; import { Card, CardContent, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, } from '@mui/material'; import DOMPurify from 'dompurify'; export const LegendMarketplaceSearchResultDrawerContent = (props) => { const { productSearchResult } = props; if (productSearchResult === undefined) { return null; } const vendorNameHTML = { __html: DOMPurify.sanitize(productSearchResult.vendor_name), }; const dataProductNameHTML = { __html: DOMPurify.sanitize(productSearchResult.data_product_name), }; const dataProductDescriptionHTML = { __html: DOMPurify.sanitize(productSearchResult.data_product_description), }; return (_jsxs("div", { className: "legend-marketplace-search-results__drawer", children: [_jsx("div", { dangerouslySetInnerHTML: vendorNameHTML, className: "legend-marketplace-search-results__drawer__vendor-name" }), _jsx("div", { dangerouslySetInnerHTML: dataProductNameHTML, className: "legend-marketplace-search-results__drawer__data-product-name" }), _jsx("div", { dangerouslySetInnerHTML: dataProductDescriptionHTML, className: "legend-marketplace-search-results__drawer__data-product-description" }), _jsx("hr", {}), _jsx("div", { className: "legend-marketplace-search-results__drawer__tables", children: productSearchResult.tables.map((table) => { const tableNameHTML = { __html: DOMPurify.sanitize(table.table_name), }; const tableDescriptionHTML = { __html: DOMPurify.sanitize(table.table_description), }; return (_jsx(Card, { variant: "outlined", className: "legend-marketplace-search-results__drawer__table-card", children: _jsxs(CardContent, { className: "legend-marketplace-search-results__drawer__table-card__content", children: [_jsxs("div", { className: "legend-marketplace-search-results__drawer__table-card__name", children: [_jsx("strong", { children: "Table Name: " }), _jsx("span", { dangerouslySetInnerHTML: tableNameHTML })] }), _jsxs("div", { className: "legend-marketplace-search-results__drawer__table-card__description", children: [_jsx("strong", { children: "Description: " }), _jsx("span", { dangerouslySetInnerHTML: tableDescriptionHTML })] }), table.table_fields.length > 0 && (_jsx(TableContainer, { className: "legend-marketplace-search-results__drawer__table-card__table", children: _jsxs(Table, { children: [_jsx(TableHead, { children: _jsxs(TableRow, { children: [_jsx(TableCell, { children: "Field Name" }), _jsx(TableCell, { children: "Field Description" })] }) }), _jsx(TableBody, { children: table.table_fields.map((field) => { const fieldNameHTML = { __html: DOMPurify.sanitize(field.field_name), }; const fieldDescriptionHTML = { __html: DOMPurify.sanitize(field.field_description), }; return (_jsxs(TableRow, { children: [_jsx(TableCell, { dangerouslySetInnerHTML: fieldNameHTML }), _jsx(TableCell, { dangerouslySetInnerHTML: fieldDescriptionHTML })] }, field.field_name)); }) })] }) }))] }) }, table.table_name)); }) })] })); }; //# sourceMappingURL=LegendMarketplaceSearchResultDrawerContent.js.map