@redocly/theme 0.55.0-next.7 → 0.55.0-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Breadcrumbs/Breadcrumbs.d.ts +2 -0
- package/lib/components/Breadcrumbs/Breadcrumbs.js +2 -1
- package/lib/components/Catalog/Catalog.d.ts +11 -0
- package/lib/components/Catalog/Catalog.js +138 -0
- package/lib/components/Catalog/CatalogActionsRow.d.ts +15 -0
- package/lib/components/Catalog/CatalogActionsRow.js +34 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCard.d.ts +8 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCard.js +179 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCardView.d.ts +8 -0
- package/lib/components/Catalog/CatalogCardView/CatalogCardView.js +20 -0
- package/lib/components/Catalog/CatalogEntities.d.ts +18 -0
- package/lib/components/Catalog/CatalogEntities.js +63 -0
- package/lib/components/Catalog/CatalogEntitiesEmptyState.d.ts +2 -0
- package/lib/components/Catalog/CatalogEntitiesEmptyState.js +38 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +12 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +133 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityInfoBar.js +49 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityLinks.js +48 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityMetadata.js +111 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.js +25 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +69 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +48 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.js +19 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +20 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +20 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.js +23 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.js +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.js +24 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.js +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.d.ts +21 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +37 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.d.ts +10 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.js +31 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.d.ts +25 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.js +27 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.d.ts +22 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.js +60 -0
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +5 -0
- package/lib/components/Catalog/CatalogEntityIcon.js +38 -0
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +5 -0
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +42 -0
- package/lib/components/Catalog/CatalogHighlight.d.ts +4 -0
- package/lib/components/Catalog/CatalogHighlight.js +48 -0
- package/lib/components/Catalog/CatalogPageDescription.d.ts +9 -0
- package/lib/components/Catalog/CatalogPageDescription.js +52 -0
- package/lib/components/Catalog/CatalogSelector.d.ts +12 -0
- package/lib/components/Catalog/CatalogSelector.js +48 -0
- package/lib/components/Catalog/CatalogSortButton.d.ts +10 -0
- package/lib/components/Catalog/CatalogSortButton.js +71 -0
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogDomainsCell.js +19 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.d.ts +6 -0
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +63 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.d.ts +5 -0
- package/lib/components/Catalog/CatalogTableView/CatalogOwnersCell.js +19 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +11 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.js +101 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +31 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +106 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +27 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +127 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.d.ts +6 -0
- package/lib/components/Catalog/CatalogTableView/CatalogTagsCell.js +20 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.d.ts +7 -0
- package/lib/components/Catalog/CatalogTableView/CatalogUserEntityCell.js +66 -0
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +9 -0
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +46 -0
- package/lib/components/Catalog/CatalogViewModeToggle.d.ts +7 -0
- package/lib/components/Catalog/CatalogViewModeToggle.js +67 -0
- package/lib/components/Catalog/variables.d.ts +1 -0
- package/lib/components/Catalog/variables.dark.d.ts +1 -0
- package/lib/components/Catalog/variables.dark.js +8 -0
- package/lib/components/Catalog/variables.js +354 -0
- package/lib/components/CatalogClassic/CatalogClassicHighlight.js +1 -1
- package/lib/components/Filter/Filter.d.ts +1 -1
- package/lib/components/Filter/Filter.js +2 -2
- package/lib/components/Filter/FilterCheckboxes.d.ts +1 -1
- package/lib/components/Filter/FilterCheckboxes.js +4 -4
- package/lib/components/Filter/FilterContent.d.ts +3 -1
- package/lib/components/Filter/FilterContent.js +34 -4
- package/lib/components/Filter/FilterInput.js +35 -3
- package/lib/components/Filter/FilterSelect.d.ts +1 -1
- package/lib/components/Filter/FilterSelect.js +4 -4
- package/lib/components/LoadMore/LoadMore.d.ts +8 -0
- package/lib/components/LoadMore/LoadMore.js +18 -0
- package/lib/components/Markdown/Markdown.js +1 -1
- package/lib/components/PageNavigation/NavigationButton.d.ts +13 -0
- package/lib/components/PageNavigation/NavigationButton.js +32 -0
- package/lib/components/PageNavigation/NextButton.js +10 -29
- package/lib/components/PageNavigation/PageNavigation.js +1 -1
- package/lib/components/PageNavigation/PreviousButton.js +11 -27
- package/lib/components/Search/SearchAiConversationInput.js +2 -1
- package/lib/components/Select/Select.js +3 -3
- package/lib/components/Sidebar/Sidebar.d.ts +3 -0
- package/lib/components/Sidebar/Sidebar.js +3 -2
- package/lib/components/Tag/Tag.d.ts +3 -1
- package/lib/components/Tag/Tag.js +54 -2
- package/lib/components/Tag/variables.js +21 -0
- package/lib/components/Tooltip/Tooltip.d.ts +2 -1
- package/lib/components/Tooltip/Tooltip.js +26 -19
- package/lib/components/Tooltip/variables.js +17 -0
- package/lib/core/constants/catalog.d.ts +1 -0
- package/lib/core/constants/catalog.js +5 -0
- package/lib/core/constants/index.d.ts +1 -0
- package/lib/core/constants/index.js +1 -0
- package/lib/core/constants/search.d.ts +1 -0
- package/lib/core/constants/search.js +2 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -0
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -0
- package/lib/core/hooks/catalog/useCatalogEntities.d.ts +4 -0
- package/lib/core/hooks/catalog/useCatalogEntities.js +17 -0
- package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.d.ts +15 -0
- package/lib/core/hooks/catalog/useCatalogTableHeaderCellActions.js +23 -0
- package/lib/core/hooks/catalog/useCatalogTableViewRow.d.ts +11 -0
- package/lib/core/hooks/catalog/useCatalogTableViewRow.js +26 -0
- package/lib/core/hooks/index.d.ts +2 -0
- package/lib/core/hooks/index.js +2 -0
- package/lib/core/hooks/use-user-teams.d.ts +1 -0
- package/lib/core/hooks/use-user-teams.js +10 -0
- package/lib/core/styles/dark.js +2 -0
- package/lib/core/styles/global.js +63 -60
- package/lib/core/types/catalog.d.ts +118 -5
- package/lib/core/types/filter.d.ts +1 -0
- package/lib/core/types/hooks.d.ts +11 -4
- package/lib/core/types/index.d.ts +1 -0
- package/lib/core/types/index.js +1 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/core/types/telemetry.d.ts +32 -0
- package/lib/core/types/telemetry.js +3 -0
- package/lib/icons/AscSortIcon/AscSortIcon.d.ts +9 -0
- package/lib/icons/AscSortIcon/AscSortIcon.js +25 -0
- package/lib/icons/CardsIcon/CardsIcon.d.ts +9 -0
- package/lib/icons/CardsIcon/CardsIcon.js +25 -0
- package/lib/icons/CaretDownIcon/CaretDownIcon.d.ts +9 -0
- package/lib/icons/CaretDownIcon/CaretDownIcon.js +22 -0
- package/lib/icons/CaretUpIcon/CaretUpIcon.d.ts +9 -0
- package/lib/icons/CaretUpIcon/CaretUpIcon.js +22 -0
- package/lib/icons/DescSortIcon/DescSortIcon.d.ts +9 -0
- package/lib/icons/DescSortIcon/DescSortIcon.js +25 -0
- package/lib/icons/EntityTypeIcon/EntityTypeIcon.d.ts +9 -0
- package/lib/icons/EntityTypeIcon/EntityTypeIcon.js +26 -0
- package/lib/icons/GithubIcon/GithubIcon.d.ts +9 -0
- package/lib/icons/GithubIcon/GithubIcon.js +22 -0
- package/lib/icons/GraphIcon/GraphIcon.d.ts +9 -0
- package/lib/icons/GraphIcon/GraphIcon.js +22 -0
- package/lib/icons/PeopleIcon/PeopleIcon.d.ts +9 -0
- package/lib/icons/PeopleIcon/PeopleIcon.js +27 -0
- package/lib/icons/SlackIcon/SlackIcon.d.ts +9 -0
- package/lib/icons/SlackIcon/SlackIcon.js +29 -0
- package/lib/icons/SortIcon/SortIcon.d.ts +9 -0
- package/lib/icons/SortIcon/SortIcon.js +25 -0
- package/lib/icons/TableIcon/TableIcon.d.ts +9 -0
- package/lib/icons/TableIcon/TableIcon.js +22 -0
- package/lib/icons/TagsIcon/TagsIcon.d.ts +9 -0
- package/lib/icons/TagsIcon/TagsIcon.js +24 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +19 -0
- package/lib/markdoc/components/Tabs/Tab.d.ts +2 -1
- package/lib/markdoc/components/Tabs/Tab.js +10 -2
- package/lib/markdoc/components/Tabs/TabList.js +2 -2
- package/lib/markdoc/components/Tabs/Tabs.d.ts +3 -1
- package/lib/markdoc/components/Tabs/Tabs.js +2 -2
- package/package.json +2 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +7 -2
- package/src/components/Catalog/Catalog.tsx +235 -0
- package/src/components/Catalog/CatalogActionsRow.tsx +58 -0
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +227 -0
- package/src/components/Catalog/CatalogCardView/CatalogCardView.tsx +29 -0
- package/src/components/Catalog/CatalogEntities.tsx +107 -0
- package/src/components/Catalog/CatalogEntitiesEmptyState.tsx +38 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +207 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityInfoBar.tsx +60 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityLinks.tsx +67 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityMetadata.tsx +93 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx +35 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +83 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +62 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty.tsx +36 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +38 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +33 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty.tsx +41 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty.tsx +42 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty.tsx +39 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty.tsx +31 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +97 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations.tsx +80 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable.tsx +92 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityTeamRelations.tsx +127 -0
- package/src/components/Catalog/CatalogEntityIcon.tsx +41 -0
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +48 -0
- package/src/components/Catalog/CatalogHighlight.tsx +56 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +72 -0
- package/src/components/Catalog/CatalogSelector.tsx +67 -0
- package/src/components/Catalog/CatalogSortButton.tsx +78 -0
- package/src/components/Catalog/CatalogTableView/CatalogDomainsCell.tsx +26 -0
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +77 -0
- package/src/components/Catalog/CatalogTableView/CatalogOwnersCell.tsx +26 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +120 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +176 -0
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +180 -0
- package/src/components/Catalog/CatalogTableView/CatalogTagsCell.tsx +28 -0
- package/src/components/Catalog/CatalogTableView/CatalogUserEntityCell.tsx +77 -0
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +83 -0
- package/src/components/Catalog/CatalogViewModeToggle.tsx +65 -0
- package/src/components/Catalog/variables.dark.ts +5 -0
- package/src/components/Catalog/variables.ts +351 -0
- package/src/components/CatalogClassic/CatalogClassicHighlight.tsx +1 -1
- package/src/components/Filter/Filter.tsx +10 -2
- package/src/components/Filter/FilterCheckboxes.tsx +8 -4
- package/src/components/Filter/FilterContent.tsx +21 -5
- package/src/components/Filter/FilterInput.tsx +16 -4
- package/src/components/Filter/FilterSelect.tsx +8 -4
- package/src/components/LoadMore/LoadMore.tsx +38 -0
- package/src/components/Markdown/Markdown.tsx +1 -1
- package/src/components/PageNavigation/NavigationButton.tsx +68 -0
- package/src/components/PageNavigation/NextButton.tsx +20 -43
- package/src/components/PageNavigation/PageNavigation.tsx +1 -1
- package/src/components/PageNavigation/PreviousButton.tsx +20 -43
- package/src/components/Search/SearchAiConversationInput.tsx +3 -0
- package/src/components/Select/Select.tsx +5 -3
- package/src/components/Sidebar/Sidebar.tsx +1 -1
- package/src/components/Tag/Tag.tsx +67 -1
- package/src/components/Tag/variables.ts +21 -0
- package/src/components/Tooltip/Tooltip.tsx +31 -22
- package/src/components/Tooltip/variables.ts +17 -0
- package/src/core/constants/catalog.ts +1 -0
- package/src/core/constants/index.ts +1 -0
- package/src/core/constants/search.ts +2 -0
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -0
- package/src/core/hooks/catalog/useCatalogEntities.ts +16 -0
- package/src/core/hooks/catalog/useCatalogTableHeaderCellActions.ts +38 -0
- package/src/core/hooks/catalog/useCatalogTableViewRow.ts +40 -0
- package/src/core/hooks/index.ts +2 -0
- package/src/core/hooks/use-user-teams.ts +8 -0
- package/src/core/styles/dark.ts +2 -0
- package/src/core/styles/global.ts +3 -0
- package/src/core/types/catalog.ts +143 -5
- package/src/core/types/filter.ts +1 -0
- package/src/core/types/hooks.ts +32 -5
- package/src/core/types/index.ts +1 -0
- package/src/core/types/l10n.ts +20 -0
- package/src/core/types/telemetry.ts +36 -0
- package/src/core/utils/load-and-navigate.ts +5 -4
- package/src/icons/AscSortIcon/AscSortIcon.tsx +29 -0
- package/src/icons/CardsIcon/CardsIcon.tsx +38 -0
- package/src/icons/CaretDownIcon/CaretDownIcon.tsx +26 -0
- package/src/icons/CaretUpIcon/CaretUpIcon.tsx +26 -0
- package/src/icons/DescSortIcon/DescSortIcon.tsx +29 -0
- package/src/icons/EntityTypeIcon/EntityTypeIcon.tsx +49 -0
- package/src/icons/GithubIcon/GithubIcon.tsx +35 -0
- package/src/icons/GraphIcon/GraphIcon.tsx +26 -0
- package/src/icons/PeopleIcon/PeopleIcon.tsx +46 -0
- package/src/icons/SlackIcon/SlackIcon.tsx +61 -0
- package/src/icons/SortIcon/SortIcon.tsx +29 -0
- package/src/icons/TableIcon/TableIcon.tsx +26 -0
- package/src/icons/TagsIcon/TagsIcon.tsx +41 -0
- package/src/index.ts +20 -0
- package/src/markdoc/components/Tabs/Tab.tsx +12 -1
- package/src/markdoc/components/Tabs/TabList.tsx +2 -1
- package/src/markdoc/components/Tabs/Tabs.tsx +8 -3
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
|
+
|
|
5
|
+
import type { BffCatalogEntity, BffCatalogRelatedEntityList } from '@redocly/theme/core/types';
|
|
6
|
+
|
|
7
|
+
import { breakpoints } from '@redocly/theme/core/utils';
|
|
8
|
+
import { ArrowLeftIcon } from '@redocly/theme/icons/ArrowLeftIcon/ArrowLeftIcon';
|
|
9
|
+
import { CatalogPageDescription } from '@redocly/theme/components/Catalog/CatalogPageDescription';
|
|
10
|
+
import { CatalogEntityProperties } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties';
|
|
11
|
+
import { CatalogEntityMetadata } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityMetadata';
|
|
12
|
+
import { CatalogEntityLinks } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityLinks';
|
|
13
|
+
import { Breadcrumbs } from '@redocly/theme/components/Breadcrumbs/Breadcrumbs';
|
|
14
|
+
import { Sidebar } from '@redocly/theme/components/Sidebar/Sidebar';
|
|
15
|
+
import { Menu } from '@redocly/theme/components/Menu/Menu';
|
|
16
|
+
import { Button } from '@redocly/theme/components/Button/Button';
|
|
17
|
+
import { CatalogEntityRelations } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelations';
|
|
18
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
19
|
+
|
|
20
|
+
import { SidebarActions } from '../../SidebarActions/SidebarActions';
|
|
21
|
+
|
|
22
|
+
export type CatalogEntityProps = {
|
|
23
|
+
entity: BffCatalogEntity;
|
|
24
|
+
entitiesCatalogConfig: EntitiesCatalogConfig;
|
|
25
|
+
catalogConfig: CatalogEntityConfig;
|
|
26
|
+
initialRelations: BffCatalogRelatedEntityList;
|
|
27
|
+
mainCatalogLabelTranslationKey?: string;
|
|
28
|
+
mainCatalogSlug?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function CatalogEntity({
|
|
32
|
+
entity,
|
|
33
|
+
entitiesCatalogConfig,
|
|
34
|
+
catalogConfig,
|
|
35
|
+
initialRelations,
|
|
36
|
+
mainCatalogLabelTranslationKey,
|
|
37
|
+
mainCatalogSlug,
|
|
38
|
+
}: CatalogEntityProps) {
|
|
39
|
+
const { useTranslate, useCatalog } = useThemeHooks();
|
|
40
|
+
const { translate } = useTranslate();
|
|
41
|
+
const linkToMainCatalog = `catalogs/${catalogConfig.slug}`;
|
|
42
|
+
const linkToMainCatalogLabel = translate(catalogConfig.titleTranslationKey);
|
|
43
|
+
|
|
44
|
+
const { layout, collapsedSidebar, onChangeViewClick, onChangeCollapseSidebarClick } =
|
|
45
|
+
useCatalog();
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<CatalogPageWrapper data-component-name="Catalog/CatalogEntity/CatalogEntity">
|
|
49
|
+
<CatalogSidebar
|
|
50
|
+
collapsed={collapsedSidebar}
|
|
51
|
+
header={
|
|
52
|
+
<BackLink
|
|
53
|
+
icon={<ArrowLeftIcon />}
|
|
54
|
+
iconPosition="left"
|
|
55
|
+
variant="ghost"
|
|
56
|
+
size="medium"
|
|
57
|
+
data-component-name="Sidebar/BackButton"
|
|
58
|
+
to={linkToMainCatalog}
|
|
59
|
+
>
|
|
60
|
+
{collapsedSidebar ? (
|
|
61
|
+
''
|
|
62
|
+
) : (
|
|
63
|
+
<div data-translation-key="sidebar.menu.backLabel">
|
|
64
|
+
{translate('sidebar.menu.backLabel')}
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
67
|
+
</BackLink>
|
|
68
|
+
}
|
|
69
|
+
menu={
|
|
70
|
+
<Menu
|
|
71
|
+
items={[
|
|
72
|
+
{
|
|
73
|
+
label: 'Overview',
|
|
74
|
+
link: `${linkToMainCatalog}/entities/${entity.key}`,
|
|
75
|
+
active: true,
|
|
76
|
+
items: [],
|
|
77
|
+
hasActiveSubItem: false,
|
|
78
|
+
},
|
|
79
|
+
]}
|
|
80
|
+
/>
|
|
81
|
+
}
|
|
82
|
+
footer={
|
|
83
|
+
<SidebarActions
|
|
84
|
+
layout={layout}
|
|
85
|
+
collapsedSidebar={collapsedSidebar}
|
|
86
|
+
isApiDocs={false}
|
|
87
|
+
onChangeViewClick={onChangeViewClick}
|
|
88
|
+
onChangeCollapseSidebarClick={onChangeCollapseSidebarClick}
|
|
89
|
+
/>
|
|
90
|
+
}
|
|
91
|
+
/>
|
|
92
|
+
<CatalogPageContent>
|
|
93
|
+
<Breadcrumbs
|
|
94
|
+
additionalBreadcrumbs={[
|
|
95
|
+
...(mainCatalogLabelTranslationKey
|
|
96
|
+
? [
|
|
97
|
+
{
|
|
98
|
+
label: translate(mainCatalogLabelTranslationKey),
|
|
99
|
+
link: `catalogs/${mainCatalogSlug}`,
|
|
100
|
+
},
|
|
101
|
+
]
|
|
102
|
+
: []),
|
|
103
|
+
{ label: linkToMainCatalogLabel, link: linkToMainCatalog },
|
|
104
|
+
{ label: entity.title },
|
|
105
|
+
]}
|
|
106
|
+
/>
|
|
107
|
+
<CatalogEntityPageWrapper>
|
|
108
|
+
<CatalogPageDescription
|
|
109
|
+
title={entity.title}
|
|
110
|
+
description={entity.summary ?? ''}
|
|
111
|
+
tag={entity.key}
|
|
112
|
+
/>
|
|
113
|
+
<CatalogEntityProperties entity={entity} />
|
|
114
|
+
<CatalogTwoColumnsSection>
|
|
115
|
+
<CatalogEntityMetadata entity={entity} />
|
|
116
|
+
<CatalogEntityLinks entity={entity} />
|
|
117
|
+
</CatalogTwoColumnsSection>
|
|
118
|
+
<CatalogEntityRelations
|
|
119
|
+
entity={entity}
|
|
120
|
+
entitiesCatalogConfig={entitiesCatalogConfig}
|
|
121
|
+
catalogConfig={catalogConfig}
|
|
122
|
+
initialRelations={initialRelations}
|
|
123
|
+
/>
|
|
124
|
+
</CatalogEntityPageWrapper>
|
|
125
|
+
</CatalogPageContent>
|
|
126
|
+
</CatalogPageWrapper>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const CatalogPageWrapper = styled.div`
|
|
131
|
+
--sidebar-width: var(--catalog-sidebar-width);
|
|
132
|
+
--link-color-primary: var(--breadcrumbs-text-color);
|
|
133
|
+
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
|
|
137
|
+
font-weight: var(--font-weight-regular);
|
|
138
|
+
|
|
139
|
+
color: var(--text-color-secondary);
|
|
140
|
+
font-size: var(--font-size-base);
|
|
141
|
+
font-family: var(--font-family-base);
|
|
142
|
+
line-height: var(--line-height-base);
|
|
143
|
+
|
|
144
|
+
hr {
|
|
145
|
+
border: 0;
|
|
146
|
+
width: calc(100% + 48px);
|
|
147
|
+
margin: auto -24px 0 -24px;
|
|
148
|
+
border-top: 1px solid var(--border-color-primary);
|
|
149
|
+
}
|
|
150
|
+
a:not([role='button']) {
|
|
151
|
+
text-decoration: none;
|
|
152
|
+
color: var(--link-color-primary);
|
|
153
|
+
font-weight: var(--link-font-weight);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@media screen and (min-width: ${breakpoints.medium}) {
|
|
157
|
+
flex-direction: row;
|
|
158
|
+
padding: 0;
|
|
159
|
+
}
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
const CatalogPageContent = styled.main`
|
|
163
|
+
flex: 1;
|
|
164
|
+
width: 90%;
|
|
165
|
+
margin: 0 auto;
|
|
166
|
+
|
|
167
|
+
@media screen and (min-width: ${breakpoints.medium}) {
|
|
168
|
+
width: 100%;
|
|
169
|
+
padding: var(--catalog-page-padding);
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
const CatalogSidebar = styled(Sidebar)`
|
|
174
|
+
display: none;
|
|
175
|
+
|
|
176
|
+
@media screen and (min-width: ${breakpoints.medium}) {
|
|
177
|
+
display: flex;
|
|
178
|
+
}
|
|
179
|
+
--menu-container-padding-top: 0;
|
|
180
|
+
`;
|
|
181
|
+
|
|
182
|
+
const CatalogEntityPageWrapper = styled.div`
|
|
183
|
+
display: flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
|
|
186
|
+
font-weight: var(--font-weight-regular);
|
|
187
|
+
|
|
188
|
+
color: var(--text-color-secondary);
|
|
189
|
+
font-size: var(--font-size-base);
|
|
190
|
+
font-family: var(--font-family-base);
|
|
191
|
+
line-height: var(--line-height-base);
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
const CatalogTwoColumnsSection = styled.section`
|
|
195
|
+
display: grid;
|
|
196
|
+
grid-template-columns: 1fr 1fr;
|
|
197
|
+
gap: 24px;
|
|
198
|
+
align-items: start;
|
|
199
|
+
`;
|
|
200
|
+
|
|
201
|
+
const BackLink = styled(Button)`
|
|
202
|
+
padding: var(--spacing-unit) 0;
|
|
203
|
+
height: calc(var(--line-height-base) + var(--spacing-unit) * 2);
|
|
204
|
+
justify-content: flex-start;
|
|
205
|
+
width: 100%;
|
|
206
|
+
margin-bottom: 0px;
|
|
207
|
+
`;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React, { ReactNode, JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export type CatalogEntityInfoBarProps = {
|
|
5
|
+
leftContent: ReactNode;
|
|
6
|
+
rightContent: ReactNode;
|
|
7
|
+
withSeparator?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function CatalogEntityInfoBar({
|
|
11
|
+
leftContent,
|
|
12
|
+
rightContent,
|
|
13
|
+
withSeparator = true,
|
|
14
|
+
}: CatalogEntityInfoBarProps): JSX.Element {
|
|
15
|
+
return (
|
|
16
|
+
<InfoBarWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityInfoBar">
|
|
17
|
+
<LeftColumn withSeparator={withSeparator}>{leftContent}</LeftColumn>
|
|
18
|
+
<RightColumn>{rightContent}</RightColumn>
|
|
19
|
+
</InfoBarWrapper>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const InfoBarWrapper = styled.div`
|
|
24
|
+
display: grid;
|
|
25
|
+
grid-template-columns: 1fr 1fr;
|
|
26
|
+
grid-template-areas: 'left right';
|
|
27
|
+
align-items: center;
|
|
28
|
+
|
|
29
|
+
color: var(--catalog-card-text-color, inherit);
|
|
30
|
+
background-color: var(--catalog-card-bg-color, white);
|
|
31
|
+
border: var(--catalog-card-border-width, 1px) var(--catalog-card-border-style)
|
|
32
|
+
var(--catalog-card-border-color);
|
|
33
|
+
border-radius: var(--catalog-card-border-radius);
|
|
34
|
+
transition: all 0.2s ease-in-out;
|
|
35
|
+
height: 100%;
|
|
36
|
+
padding: var(--catalog-card-gap);
|
|
37
|
+
|
|
38
|
+
&:hover {
|
|
39
|
+
border-color: var(--catalog-card-border-color-hover);
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
|
|
43
|
+
const LeftColumn = styled.div<{ withSeparator?: boolean }>`
|
|
44
|
+
font-weight: var(--font-weight-medium);
|
|
45
|
+
color: var(--catalog-metadata-label-color);
|
|
46
|
+
width: 100%;
|
|
47
|
+
grid-area: left;
|
|
48
|
+
justify-self: start;
|
|
49
|
+
text-align: left;
|
|
50
|
+
border-right: ${({ withSeparator }) =>
|
|
51
|
+
withSeparator ? '1px solid var(--border-color-primary)' : 'none'};
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const RightColumn = styled.div`
|
|
55
|
+
color: var(--catalog-metadata-value-color);
|
|
56
|
+
font-weight: var(--font-weight-medium);
|
|
57
|
+
grid-area: right;
|
|
58
|
+
justify-self: end;
|
|
59
|
+
text-align: right;
|
|
60
|
+
`;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { LaunchIcon } from '@redocly/theme/icons/LaunchIcon/LaunchIcon';
|
|
6
|
+
import { DocumentIcon } from '@redocly/theme/icons/DocumentIcon/DocumentIcon';
|
|
7
|
+
import { CatalogEntityInfoBar } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityInfoBar';
|
|
8
|
+
import { Link } from '@redocly/theme/components/Link/Link';
|
|
9
|
+
|
|
10
|
+
export type CatalogEntityLinksProps = {
|
|
11
|
+
entity: BffCatalogEntity;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function CatalogEntityLinks({ entity }: CatalogEntityLinksProps) {
|
|
15
|
+
const links = Object.entries(entity.links || []);
|
|
16
|
+
|
|
17
|
+
if (!links.length) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<LinksWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityLinks">
|
|
23
|
+
<Heading>Links</Heading>
|
|
24
|
+
{links.map(([key, value]) => (
|
|
25
|
+
<CatalogEntityInfoBar
|
|
26
|
+
key={key}
|
|
27
|
+
leftContent={
|
|
28
|
+
<Label>
|
|
29
|
+
<DocumentIcon /> {value.label}
|
|
30
|
+
</Label>
|
|
31
|
+
}
|
|
32
|
+
rightContent={
|
|
33
|
+
<Link color="var(--catalog-metadata-link-color)" to={value.url} target="_blank">
|
|
34
|
+
<LaunchIcon />
|
|
35
|
+
</Link>
|
|
36
|
+
}
|
|
37
|
+
withSeparator={false}
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
40
|
+
</LinksWrapper>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const LinksWrapper = styled.div`
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: var(--spacing-xs);
|
|
48
|
+
border-radius: var(--border-radius);
|
|
49
|
+
background-color: var(--catalog-metadata-bg-color);
|
|
50
|
+
transition: all 0.2s ease-in-out;
|
|
51
|
+
margin: var(--spacing-lg) 0;
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const Label = styled.span`
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: var(--spacing-unit);
|
|
58
|
+
font-weight: var(--font-weight-medium);
|
|
59
|
+
color: var(--catalog-metadata-label-color);
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
const Heading = styled.h2`
|
|
63
|
+
margin-bottom: var(--spacing-sm);
|
|
64
|
+
margin-top: 0;
|
|
65
|
+
font-size: var(--font-size-md);
|
|
66
|
+
color: var(--catalog-metadata-heading-color);
|
|
67
|
+
`;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { ChevronDownIcon } from '@redocly/theme/icons/ChevronDownIcon/ChevronDownIcon';
|
|
6
|
+
import { capitalize } from '@redocly/theme/core/utils';
|
|
7
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
8
|
+
import { CatalogEntityInfoBar } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityInfoBar';
|
|
9
|
+
|
|
10
|
+
const MAX_INITIAL_ITEMS = 4;
|
|
11
|
+
|
|
12
|
+
export type CatalogEntityMetadataProps = {
|
|
13
|
+
entity: BffCatalogEntity;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function CatalogEntityMetadata({ entity }: CatalogEntityMetadataProps) {
|
|
17
|
+
const { useTranslate } = useThemeHooks();
|
|
18
|
+
const { translate } = useTranslate();
|
|
19
|
+
const { schema, ...metadataToShow } = entity.metadata || {};
|
|
20
|
+
const metadata = Object.entries(metadataToShow);
|
|
21
|
+
const [isOn, setIsOn] = useState(false);
|
|
22
|
+
const hasMoreItems = metadata.length > MAX_INITIAL_ITEMS;
|
|
23
|
+
const visibleMetadata = isOn ? metadata : metadata.slice(0, MAX_INITIAL_ITEMS);
|
|
24
|
+
|
|
25
|
+
if (!metadata.length) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return (
|
|
29
|
+
<MetadataWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityMetadata">
|
|
30
|
+
<Heading>{translate('catalog.entity.metadata.title')}</Heading>
|
|
31
|
+
{visibleMetadata.map(([key, value]) => (
|
|
32
|
+
<CatalogEntityInfoBar
|
|
33
|
+
key={key}
|
|
34
|
+
leftContent={<Label>{capitalize(key)}:</Label>}
|
|
35
|
+
rightContent={<Value>{value}</Value>}
|
|
36
|
+
/>
|
|
37
|
+
))}
|
|
38
|
+
{hasMoreItems && (
|
|
39
|
+
<ShowMoreButton onClick={() => setIsOn(!isOn)}>
|
|
40
|
+
{isOn ? 'Show less' : 'Show more'} <ChevronIcon $isExpanded={isOn} />
|
|
41
|
+
</ShowMoreButton>
|
|
42
|
+
)}
|
|
43
|
+
</MetadataWrapper>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const MetadataWrapper = styled.div`
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: var(--spacing-xs);
|
|
51
|
+
border-radius: var(--border-radius);
|
|
52
|
+
background-color: var(--catalog-metadata-bg-color);
|
|
53
|
+
transition: all 0.2s ease-in-out;
|
|
54
|
+
margin: var(--spacing-lg) 0;
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const Label = styled.span`
|
|
58
|
+
font-weight: var(--font-weight-medium);
|
|
59
|
+
color: var(--catalog-metadata-label-color);
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
const Value = styled.span`
|
|
63
|
+
color: var(--catalog-metadata-value-color);
|
|
64
|
+
font-weight: var(--font-weight-medium);
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
const Heading = styled.h2`
|
|
68
|
+
margin-bottom: var(--spacing-base);
|
|
69
|
+
margin-top: 0;
|
|
70
|
+
font-size: var(--catalog-metadata-heading-size);
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
const ChevronIcon = styled(ChevronDownIcon)<{ $isExpanded: boolean }>`
|
|
74
|
+
transform: ${({ $isExpanded }) => ($isExpanded ? 'rotate(180deg)' : 'rotate(0)')};
|
|
75
|
+
transition: transform 0.2s ease;
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
const ShowMoreButton = styled.button`
|
|
79
|
+
background: none;
|
|
80
|
+
border: none;
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: var(--catalog-metadata-button-gap, 0.5rem);
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
color: var(--catalog-metadata-button-color);
|
|
86
|
+
padding: 0;
|
|
87
|
+
font-weight: var(--font-weight-medium);
|
|
88
|
+
margin-top: var(--spacing-unit);
|
|
89
|
+
|
|
90
|
+
&:hover {
|
|
91
|
+
color: var(--catalog-metadata-button-color-hover);
|
|
92
|
+
}
|
|
93
|
+
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { DocumentIcon, getPathPrefix, Tag, useThemeHooks } from '@redocly/theme';
|
|
6
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
7
|
+
|
|
8
|
+
export type ApiDescriptionPropertyProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function ApiDescriptionProperty({ entity }: ApiDescriptionPropertyProps): JSX.Element {
|
|
13
|
+
const { useTranslate } = useThemeHooks();
|
|
14
|
+
const { translate } = useTranslate();
|
|
15
|
+
const navigate = useNavigate();
|
|
16
|
+
const pathPrefix = getPathPrefix();
|
|
17
|
+
const descriptionFile = entity.metadata?.descriptionFile;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty">
|
|
21
|
+
<CatalogEntityPropertyCard
|
|
22
|
+
header={
|
|
23
|
+
<>
|
|
24
|
+
<DocumentIcon />
|
|
25
|
+
{translate('catalog.entity.properties.apiDescription.title')}
|
|
26
|
+
</>
|
|
27
|
+
}
|
|
28
|
+
content={<Tag>{descriptionFile}</Tag>}
|
|
29
|
+
onClick={() => {
|
|
30
|
+
navigate(`${pathPrefix}/${descriptionFile}`);
|
|
31
|
+
}}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { EntityTypeProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty';
|
|
6
|
+
import { GitProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/GitProperty';
|
|
7
|
+
import { TagsProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/TagsProperty';
|
|
8
|
+
import { ApiDescriptionProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/ApiDescriptionProperty';
|
|
9
|
+
import { UserEmailProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/UserEmailProperty';
|
|
10
|
+
import { DomainsProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty';
|
|
11
|
+
import { OwnersProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/OwnersProperty';
|
|
12
|
+
import { ContactProperty } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty';
|
|
13
|
+
|
|
14
|
+
type PropertyRenderer = {
|
|
15
|
+
key: string;
|
|
16
|
+
condition: (entity: BffCatalogEntity) => boolean;
|
|
17
|
+
component: React.ComponentType<{ entity: BffCatalogEntity }>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const propertyRenderers: PropertyRenderer[] = [
|
|
21
|
+
{
|
|
22
|
+
key: 'type',
|
|
23
|
+
condition: (entity) => !!entity.type,
|
|
24
|
+
component: EntityTypeProperty,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
key: 'contact',
|
|
28
|
+
condition: (entity) => !!entity.contact?.slack?.channels,
|
|
29
|
+
component: ContactProperty,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'git',
|
|
33
|
+
condition: (entity) => !!entity.git,
|
|
34
|
+
component: GitProperty,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
key: 'tags',
|
|
38
|
+
condition: (entity) => !!entity.tags,
|
|
39
|
+
component: TagsProperty,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: 'api-description',
|
|
43
|
+
condition: (entity) => entity.type === 'api-description' && !!entity.metadata?.descriptionFile,
|
|
44
|
+
component: ApiDescriptionProperty,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: 'user-email',
|
|
48
|
+
condition: (entity) => entity.type === 'user' && !!entity.metadata?.email,
|
|
49
|
+
component: UserEmailProperty,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: 'domains',
|
|
53
|
+
condition: (entity) => (entity.domains?.length ?? 0) > 0,
|
|
54
|
+
component: DomainsProperty,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
key: 'owners',
|
|
58
|
+
condition: (entity) => (entity.owners?.length ?? 0) > 0,
|
|
59
|
+
component: OwnersProperty,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export type CatalogEntityPropertiesProps = {
|
|
64
|
+
entity: BffCatalogEntity;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export function CatalogEntityProperties({ entity }: CatalogEntityPropertiesProps): JSX.Element {
|
|
68
|
+
return (
|
|
69
|
+
<CatalogEntityPropertiesGridWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties">
|
|
70
|
+
{propertyRenderers
|
|
71
|
+
.filter((renderer) => renderer.condition(entity))
|
|
72
|
+
.map((renderer) => (
|
|
73
|
+
<renderer.component key={renderer.key + entity.id} entity={entity} />
|
|
74
|
+
))}
|
|
75
|
+
</CatalogEntityPropertiesGridWrapper>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const CatalogEntityPropertiesGridWrapper = styled.div`
|
|
80
|
+
display: grid;
|
|
81
|
+
grid-template-columns: repeat(auto-fill, minmax(325px, 1fr));
|
|
82
|
+
gap: var(--spacing-base);
|
|
83
|
+
`;
|
package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { ReactNode, JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export type CatalogEntityPropertyCardProps = {
|
|
5
|
+
header: ReactNode;
|
|
6
|
+
content: ReactNode;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function CatalogEntityPropertyCard({
|
|
11
|
+
header,
|
|
12
|
+
content,
|
|
13
|
+
onClick,
|
|
14
|
+
}: CatalogEntityPropertyCardProps): JSX.Element {
|
|
15
|
+
return (
|
|
16
|
+
<CatalogEntityPropertyWrapper
|
|
17
|
+
data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard"
|
|
18
|
+
onClick={onClick}
|
|
19
|
+
>
|
|
20
|
+
<CardHeader>{header}</CardHeader>
|
|
21
|
+
<CardContent>{content}</CardContent>
|
|
22
|
+
</CatalogEntityPropertyWrapper>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const CatalogEntityPropertyWrapper = styled.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
color: var(--catalog-card-text-color);
|
|
30
|
+
background-color: var(--catalog-card-bg-color);
|
|
31
|
+
border: var(--catalog-card-border-width) var(--catalog-card-border-style)
|
|
32
|
+
var(--catalog-card-border-color);
|
|
33
|
+
border-radius: var(--catalog-card-border-radius, 8px);
|
|
34
|
+
transition: all 0.2s ease-in-out;
|
|
35
|
+
height: 100%;
|
|
36
|
+
padding: var(--catalog-card-padding-vertical) var(--catalog-card-padding-horizontal);
|
|
37
|
+
gap: var(--catalog-card-content-gap-vertical);
|
|
38
|
+
|
|
39
|
+
&:hover {
|
|
40
|
+
border-color: var(--catalog-card-border-color-hover);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${(props) =>
|
|
44
|
+
props.onClick &&
|
|
45
|
+
`
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
`}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
const CardHeader = styled.div`
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: var(--catalog-card-content-gap);
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
const CardContent = styled.div`
|
|
57
|
+
flex: 1;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
gap: var(--catalog-card-content-gap);
|
|
61
|
+
flex-wrap: wrap;
|
|
62
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { SlackIcon } from '@redocly/theme/icons/SlackIcon/SlackIcon';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
7
|
+
|
|
8
|
+
export type ContactPropertyProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function ContactProperty({ entity }: ContactPropertyProps): JSX.Element {
|
|
13
|
+
const channels = entity.contact?.slack?.channels;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/ContactProperty">
|
|
17
|
+
<CatalogEntityPropertyCard
|
|
18
|
+
header={
|
|
19
|
+
<>
|
|
20
|
+
<SlackIcon />
|
|
21
|
+
Slack channels
|
|
22
|
+
</>
|
|
23
|
+
}
|
|
24
|
+
content={
|
|
25
|
+
<>
|
|
26
|
+
{channels?.map((channel) => (
|
|
27
|
+
<Tag key={channel.name} style={{ backgroundColor: 'var(--bg-color)' }}>
|
|
28
|
+
{channel.name}
|
|
29
|
+
</Tag>
|
|
30
|
+
))}
|
|
31
|
+
</>
|
|
32
|
+
}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
5
|
+
import { Tag } from '@redocly/theme';
|
|
6
|
+
|
|
7
|
+
import { CatalogEntityPropertyCard } from './CatalogEntityPropertyCard';
|
|
8
|
+
|
|
9
|
+
export type DomainsPropertyProps = {
|
|
10
|
+
entity: BffCatalogEntity;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export function DomainsProperty({ entity }: DomainsPropertyProps): JSX.Element {
|
|
14
|
+
const { domains = [] } = entity;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty">
|
|
18
|
+
<CatalogEntityPropertyCard
|
|
19
|
+
header={
|
|
20
|
+
<>
|
|
21
|
+
<GraphIcon />
|
|
22
|
+
Domains
|
|
23
|
+
</>
|
|
24
|
+
}
|
|
25
|
+
content={
|
|
26
|
+
<>
|
|
27
|
+
{domains?.map((domain) => (
|
|
28
|
+
<Tag key={domain?.id} style={{ backgroundColor: 'var(--bg-color)' }}>
|
|
29
|
+
<GraphIcon />
|
|
30
|
+
{domain?.title}
|
|
31
|
+
</Tag>
|
|
32
|
+
))}
|
|
33
|
+
</>
|
|
34
|
+
}
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|