UNPKG

@finos/legend-extension-dsl-data-space

Version:
37 lines 2.74 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 { AnchorLinkIcon } from '@finos/legend-art'; import {} from '../stores/DataSpaceViewerState.js'; import { observer } from 'mobx-react-lite'; import { DataSpaceWikiPlaceholder } from './DataSpacePlaceholder.js'; import { DataSpaceMarkdownTextViewer } from './DataSpaceMarkdownTextViewer.js'; import { useEffect, useRef } from 'react'; import { DATA_SPACE_VIEWER_ACTIVITY_MODE, generateAnchorForActivity, } from '../stores/DataSpaceViewerNavigation.js'; export const DataSpaceDescription = observer((props) => { const { dataSpaceViewerState } = props; const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult; const sectionRef = useRef(null); const anchor = generateAnchorForActivity(DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION); useEffect(() => { if (sectionRef.current) { dataSpaceViewerState.layoutState.setWikiPageAnchor(anchor, sectionRef.current); } return () => dataSpaceViewerState.layoutState.unsetWikiPageAnchor(anchor); }, [dataSpaceViewerState, anchor]); return (_jsxs("div", { ref: sectionRef, className: "data-space__viewer__wiki__section", children: [_jsx("div", { className: "data-space__viewer__wiki__section__header", children: _jsxs("div", { className: "data-space__viewer__wiki__section__header__label", children: ["Description", _jsx("button", { className: "data-space__viewer__wiki__section__header__anchor", tabIndex: -1, onClick: () => dataSpaceViewerState.changeZone(anchor, true), children: _jsx(AnchorLinkIcon, {}) })] }) }), _jsxs("div", { className: "data-space__viewer__wiki__section__content", children: [analysisResult.description !== undefined && (_jsx("div", { className: "data-space__viewer__description", children: _jsx("div", { className: "data-space__viewer__description__content", children: _jsx(DataSpaceMarkdownTextViewer, { value: analysisResult.description }) }) })), analysisResult.description === undefined && (_jsx(DataSpaceWikiPlaceholder, { message: "(not specified)" }))] })] })); }); //# sourceMappingURL=DataSpaceDescription.js.map