@redocly/theme 0.56.0-next.3 → 0.56.0-next.4
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/Catalog/CatalogCardView/CatalogCard.js +4 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.d.ts +1 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntity.js +4 -11
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.js +7 -1
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.js +4 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.js +3 -3
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.js +7 -2
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.js +19 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.js +2 -8
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.d.ts +6 -0
- package/lib/components/Catalog/CatalogEntity/CatalogEntitySchema.js +55 -0
- package/lib/components/Catalog/CatalogEntityIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityIcon.js +22 -29
- package/lib/components/Catalog/CatalogEntityTypeIcon.d.ts +2 -1
- package/lib/components/Catalog/CatalogEntityTypeIcon.js +11 -23
- package/lib/components/Catalog/CatalogEntityTypeTag.d.ts +7 -0
- package/lib/components/Catalog/CatalogEntityTypeTag.js +36 -0
- package/lib/components/Catalog/CatalogPageDescription.js +2 -2
- package/lib/components/Catalog/CatalogTableView/CatalogEntityCell.js +2 -14
- package/lib/components/Catalog/CatalogTableView/CatalogTableHeaderCell.d.ts +1 -1
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.d.ts +1 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableView.js +3 -30
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.d.ts +0 -2
- package/lib/components/Catalog/CatalogTableView/CatalogTableViewRow.js +5 -30
- package/lib/components/Catalog/CatalogTagsWithTooltip.d.ts +1 -1
- package/lib/components/Catalog/CatalogTagsWithTooltip.js +3 -3
- package/lib/components/Catalog/variables.js +34 -5
- package/lib/components/Menu/variables.js +2 -0
- package/lib/components/Tag/Tag.d.ts +2 -1
- package/lib/components/Tag/Tag.js +3 -3
- package/lib/components/Tag/variables.js +14 -0
- package/lib/core/types/l10n.d.ts +1 -1
- package/lib/icons/MoleculesIcon/MoleculesIcon.d.ts +9 -0
- package/lib/icons/MoleculesIcon/MoleculesIcon.js +22 -0
- package/lib/icons/NetworkIcon/NetworkIcon.d.ts +9 -0
- package/lib/icons/NetworkIcon/NetworkIcon.js +23 -0
- package/lib/icons/NotesIcon/NotesIcon.d.ts +9 -0
- package/lib/icons/NotesIcon/NotesIcon.js +26 -0
- package/package.json +2 -2
- package/src/components/Catalog/CatalogCardView/CatalogCard.tsx +6 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntity.tsx +7 -15
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityProperties.tsx +7 -1
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard.tsx +4 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/DomainsProperty.tsx +2 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/EntityTypeProperty.tsx +10 -3
- package/src/components/Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty.tsx +36 -0
- package/src/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityDefaultRelations.tsx +4 -22
- package/src/components/Catalog/CatalogEntity/CatalogEntitySchema.tsx +52 -0
- package/src/components/Catalog/CatalogEntityIcon.tsx +33 -33
- package/src/components/Catalog/CatalogEntityTypeIcon.tsx +23 -28
- package/src/components/Catalog/CatalogEntityTypeTag.tsx +43 -0
- package/src/components/Catalog/CatalogPageDescription.tsx +4 -3
- package/src/components/Catalog/CatalogTableView/CatalogEntityCell.tsx +2 -16
- package/src/components/Catalog/CatalogTableView/CatalogTableHeaderCell.tsx +4 -2
- package/src/components/Catalog/CatalogTableView/CatalogTableView.tsx +3 -35
- package/src/components/Catalog/CatalogTableView/CatalogTableViewRow.tsx +5 -35
- package/src/components/Catalog/CatalogTagsWithTooltip.tsx +3 -4
- package/src/components/Catalog/variables.ts +34 -5
- package/src/components/Menu/variables.ts +2 -0
- package/src/components/Tag/Tag.tsx +11 -2
- package/src/components/Tag/variables.ts +14 -0
- package/src/core/types/l10n.ts +4 -0
- package/src/icons/MoleculesIcon/MoleculesIcon.tsx +23 -0
- package/src/icons/NetworkIcon/NetworkIcon.tsx +31 -0
- package/src/icons/NotesIcon/NotesIcon.tsx +43 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
4
|
+
import { NotesIcon } from '@redocly/theme/icons/NotesIcon/NotesIcon';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { CatalogEntityPropertyCard } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityProperties/CatalogEntityPropertyCard';
|
|
7
|
+
|
|
8
|
+
export type FormatPropertyProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function FormatProperty({ entity }: FormatPropertyProps): JSX.Element {
|
|
13
|
+
return (
|
|
14
|
+
<div data-component-name="Catalog/CatalogEntity/CatalogEntityProperties/FormatProperty">
|
|
15
|
+
<CatalogEntityPropertyCard
|
|
16
|
+
header={
|
|
17
|
+
<>
|
|
18
|
+
<NotesIcon />
|
|
19
|
+
Format
|
|
20
|
+
</>
|
|
21
|
+
}
|
|
22
|
+
content={
|
|
23
|
+
<>
|
|
24
|
+
<Tag
|
|
25
|
+
textTransform="none"
|
|
26
|
+
key={entity.metadata?.specType}
|
|
27
|
+
style={{ backgroundColor: 'var(--bg-color)' }}
|
|
28
|
+
>
|
|
29
|
+
{entity.metadata?.specType}
|
|
30
|
+
</Tag>
|
|
31
|
+
</>
|
|
32
|
+
}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import React, { JSX } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
2
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
3
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
BffCatalogRelatedEntity,
|
|
8
|
-
EntityType,
|
|
9
|
-
SortOption,
|
|
10
|
-
} from '@redocly/theme/core/types';
|
|
11
|
-
import {
|
|
12
|
-
CatalogColumn,
|
|
13
|
-
getEntityTagColor,
|
|
14
|
-
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
4
|
+
import { BffCatalogEntity, BffCatalogRelatedEntity, SortOption } from '@redocly/theme/core/types';
|
|
5
|
+
import { CatalogColumn } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
15
6
|
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
16
|
-
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
17
7
|
import { CatalogEntityRelationsTable } from '@redocly/theme/components/Catalog/CatalogEntity/CatalogEntityRelations/CatalogEntityRelationsTable';
|
|
8
|
+
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
18
9
|
import { CatalogEntityRelationCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityRelationCell';
|
|
19
10
|
|
|
20
11
|
const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
@@ -29,11 +20,7 @@ const columns: CatalogColumn<BffCatalogRelatedEntity>[] = [
|
|
|
29
20
|
{
|
|
30
21
|
key: 'type',
|
|
31
22
|
title: 'Type',
|
|
32
|
-
render: (entity) =>
|
|
33
|
-
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
34
|
-
{entity.type}
|
|
35
|
-
</EntityTypeTag>
|
|
36
|
-
),
|
|
23
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
37
24
|
sortable: true,
|
|
38
25
|
sortKey: 'type',
|
|
39
26
|
width: '1fr',
|
|
@@ -105,8 +92,3 @@ export function CatalogEntityDefaultRelations({
|
|
|
105
92
|
</div>
|
|
106
93
|
);
|
|
107
94
|
}
|
|
108
|
-
|
|
109
|
-
const EntityTypeTag = styled(Tag)`
|
|
110
|
-
font-size: var(--font-size-base);
|
|
111
|
-
background-color: transparent;
|
|
112
|
-
`;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
5
|
+
import { useThemeHooks } from '@redocly/theme/core/hooks';
|
|
6
|
+
import { JsonViewer } from '@redocly/theme/components/JsonViewer/JsonViewer';
|
|
7
|
+
|
|
8
|
+
export type CatalogEntitySchemaProps = {
|
|
9
|
+
entity: BffCatalogEntity;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export function CatalogEntitySchema({ entity }: CatalogEntitySchemaProps) {
|
|
13
|
+
const { useTranslate } = useThemeHooks();
|
|
14
|
+
const { translate } = useTranslate();
|
|
15
|
+
const { schema, ...metadataToShow } = entity.metadata || {};
|
|
16
|
+
const metadata = Object.entries(metadataToShow);
|
|
17
|
+
|
|
18
|
+
if (!metadata.length) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let parsedSchema;
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
parsedSchema = JSON.parse(schema);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<MetadataWrapper data-component-name="Catalog/CatalogEntity/CatalogEntityMetadata">
|
|
32
|
+
<Heading>{translate('catalog.entity.metadata.title')}</Heading>
|
|
33
|
+
<JsonViewer data={parsedSchema} expandLevel={3} title="JSON" />
|
|
34
|
+
</MetadataWrapper>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const MetadataWrapper = styled.div`
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
gap: var(--spacing-xs);
|
|
42
|
+
border-radius: var(--border-radius);
|
|
43
|
+
background-color: var(--catalog-metadata-bg-color);
|
|
44
|
+
transition: all 0.2s ease-in-out;
|
|
45
|
+
margin: var(--spacing-lg) 0;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const Heading = styled.h2`
|
|
49
|
+
margin-bottom: var(--spacing-base);
|
|
50
|
+
margin-top: 0;
|
|
51
|
+
font-size: var(--catalog-metadata-heading-size);
|
|
52
|
+
`;
|
|
@@ -5,43 +5,43 @@ import { CodeIcon } from '@redocly/theme/icons/CodeIcon/CodeIcon';
|
|
|
5
5
|
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
6
|
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
7
|
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const entityIconMap: Record<EntityType, JSX.Element> = {
|
|
12
|
-
service: <CodeIcon color={iconColor} />,
|
|
13
|
-
domain: <GraphIcon color={iconColor} />,
|
|
14
|
-
team: <PeopleIcon color={iconColor} />,
|
|
15
|
-
user: <UserIcon color={iconColor} />,
|
|
16
|
-
'api-description': <CodeIcon color={iconColor} />,
|
|
17
|
-
'data-schema': <CodeIcon color={iconColor} />,
|
|
18
|
-
'api-operation': <CodeIcon color={iconColor} />,
|
|
19
|
-
};
|
|
8
|
+
import { NetworkIcon } from '@redocly/theme/icons/NetworkIcon/NetworkIcon';
|
|
9
|
+
import { MoleculesIcon } from '@redocly/theme/icons/MoleculesIcon/MoleculesIcon';
|
|
20
10
|
|
|
21
11
|
export type CatalogEntityIconProps = {
|
|
22
12
|
entityType: string;
|
|
13
|
+
defaultColor?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getIconColor = (entityType: EntityType) => `var(--catalog-entity-icon-color-${entityType})`;
|
|
17
|
+
|
|
18
|
+
const getEntityIcon = ({ entityType, defaultColor }: CatalogEntityIconProps) => {
|
|
19
|
+
const iconColor = defaultColor
|
|
20
|
+
? `var(--catalog-entity-icon-color)`
|
|
21
|
+
: getIconColor(entityType as EntityType);
|
|
22
|
+
|
|
23
|
+
const entityIconMap: Record<EntityType, JSX.Element> = {
|
|
24
|
+
service: <CodeIcon color={iconColor} />,
|
|
25
|
+
domain: <GraphIcon color={iconColor} />,
|
|
26
|
+
team: <PeopleIcon color={iconColor} />,
|
|
27
|
+
user: <UserIcon color={iconColor} />,
|
|
28
|
+
'api-description': <CodeIcon color={iconColor} />,
|
|
29
|
+
'data-schema': <NetworkIcon color={iconColor} />,
|
|
30
|
+
'api-operation': <MoleculesIcon color={iconColor} />,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return entityIconMap[entityType as EntityType];
|
|
23
34
|
};
|
|
24
35
|
|
|
25
|
-
export function CatalogEntityIcon({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
case 'team':
|
|
34
|
-
return entityIconMap.team;
|
|
35
|
-
case 'user':
|
|
36
|
-
return entityIconMap.user;
|
|
37
|
-
case 'api-description':
|
|
38
|
-
return entityIconMap['api-description'];
|
|
39
|
-
case 'data-schema':
|
|
40
|
-
return entityIconMap.service;
|
|
41
|
-
case 'api-operation':
|
|
42
|
-
return entityIconMap.service;
|
|
43
|
-
default:
|
|
44
|
-
const exhaustiveCheck: never = key;
|
|
45
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
36
|
+
export function CatalogEntityIcon({
|
|
37
|
+
entityType,
|
|
38
|
+
defaultColor = false,
|
|
39
|
+
}: CatalogEntityIconProps): JSX.Element {
|
|
40
|
+
const icon = getEntityIcon({ entityType, defaultColor });
|
|
41
|
+
|
|
42
|
+
if (!icon) {
|
|
43
|
+
throw new Error(`Unhandled entity type: ${entityType}`);
|
|
46
44
|
}
|
|
45
|
+
|
|
46
|
+
return icon;
|
|
47
47
|
}
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { GraphIcon } from '@redocly/theme/icons/GraphIcon/GraphIcon';
|
|
6
|
-
import { PeopleIcon } from '@redocly/theme/icons/PeopleIcon/PeopleIcon';
|
|
7
|
-
import { UserIcon } from '@redocly/theme/icons/UserIcon/UserIcon';
|
|
8
|
-
|
|
9
|
-
const getEntityIcon = (entityType: string): ReactNode => {
|
|
10
|
-
const iconColor = 'var(--catalog-entity-icon-color)';
|
|
11
|
-
|
|
12
|
-
switch (entityType.toLowerCase()) {
|
|
13
|
-
case 'service':
|
|
14
|
-
return <CodeIcon color={iconColor} />;
|
|
15
|
-
case 'domain':
|
|
16
|
-
return <GraphIcon color={iconColor} />;
|
|
17
|
-
case 'team':
|
|
18
|
-
return <PeopleIcon color={iconColor} />;
|
|
19
|
-
case 'user':
|
|
20
|
-
return <UserIcon color={iconColor} />;
|
|
21
|
-
default:
|
|
22
|
-
return <CodeIcon color={iconColor} />;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
4
|
+
import { CatalogEntityIcon } from '@redocly/theme/components/Catalog/CatalogEntityIcon';
|
|
25
5
|
|
|
26
6
|
export type CatalogEntityTypeIconProps = {
|
|
27
7
|
entityType: string;
|
|
8
|
+
defaultColor?: boolean;
|
|
28
9
|
};
|
|
29
10
|
|
|
30
|
-
export function CatalogEntityTypeIcon({
|
|
11
|
+
export function CatalogEntityTypeIcon({
|
|
12
|
+
entityType,
|
|
13
|
+
defaultColor = false,
|
|
14
|
+
}: CatalogEntityTypeIconProps) {
|
|
31
15
|
return (
|
|
32
|
-
<IconContainer
|
|
33
|
-
|
|
16
|
+
<IconContainer
|
|
17
|
+
data-component-name="Catalog/CatalogEntityTypeIcon"
|
|
18
|
+
entityType={entityType}
|
|
19
|
+
defaultColor={defaultColor}
|
|
20
|
+
>
|
|
21
|
+
<CatalogEntityIcon entityType={entityType} defaultColor={defaultColor} />
|
|
34
22
|
</IconContainer>
|
|
35
23
|
);
|
|
36
24
|
}
|
|
37
25
|
|
|
38
|
-
const IconContainer = styled.div
|
|
26
|
+
const IconContainer = styled.div<{ entityType: string; defaultColor: boolean }>`
|
|
39
27
|
display: flex;
|
|
40
28
|
align-items: center;
|
|
41
29
|
justify-content: center;
|
|
42
30
|
width: var(--catalog-table-icon-width);
|
|
43
31
|
height: var(--catalog-table-icon-height);
|
|
44
32
|
border-radius: var(--catalog-table-icon-border-radius);
|
|
45
|
-
background-color:
|
|
33
|
+
background-color: ${({ defaultColor, entityType }) =>
|
|
34
|
+
defaultColor
|
|
35
|
+
? 'var(--catalog-entity-bg-color)'
|
|
36
|
+
: `var(--catalog-entity-bg-color-${entityType})`};
|
|
46
37
|
flex-shrink: 0;
|
|
47
|
-
border:
|
|
38
|
+
border: 1px solid
|
|
39
|
+
${({ defaultColor, entityType }) =>
|
|
40
|
+
defaultColor
|
|
41
|
+
? 'var(--catalog-entity-border-color)'
|
|
42
|
+
: `var(--catalog-entity-border-color-${entityType})`};
|
|
48
43
|
`;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React, { JSX } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import { EntityType } from '@redocly/theme/core/types';
|
|
5
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
|
|
7
|
+
export type CatalogEntityTypeTagProps = {
|
|
8
|
+
entityType: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const entityTagColorMap: Record<EntityType, string> = {
|
|
12
|
+
service: 'blue',
|
|
13
|
+
domain: 'grass',
|
|
14
|
+
team: 'purple',
|
|
15
|
+
user: 'yellow',
|
|
16
|
+
'api-description': 'sky',
|
|
17
|
+
'data-schema': 'carrot',
|
|
18
|
+
'api-operation': 'raspberry',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getEntityTagColor = (type: EntityType): string => {
|
|
22
|
+
const color = entityTagColorMap[type];
|
|
23
|
+
|
|
24
|
+
if (!color) {
|
|
25
|
+
throw new Error(`Unhandled entity type: ${type}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return color;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function CatalogEntityTypeTag({ entityType }: CatalogEntityTypeTagProps): JSX.Element {
|
|
32
|
+
return (
|
|
33
|
+
<EntityTypeTagWrapper color={getEntityTagColor(entityType as EntityType)}>
|
|
34
|
+
{entityType}
|
|
35
|
+
</EntityTypeTagWrapper>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const EntityTypeTagWrapper = styled(Tag)`
|
|
40
|
+
font-size: var(--font-size-base);
|
|
41
|
+
background-color: transparent;
|
|
42
|
+
text-transform: lowercase;
|
|
43
|
+
`;
|
|
@@ -3,8 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
|
|
4
4
|
import { breakpoints } from '@redocly/theme/core/utils';
|
|
5
5
|
import { H3 } from '@redocly/theme/components/Typography/H3';
|
|
6
|
-
|
|
7
|
-
import { CounterTag } from '../Tags/CounterTag';
|
|
6
|
+
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
8
7
|
|
|
9
8
|
export type CatalogPageDescriptionProps = {
|
|
10
9
|
title: string;
|
|
@@ -25,7 +24,9 @@ export function CatalogPageDescription({
|
|
|
25
24
|
<CatalogPageDescriptionWrapper>
|
|
26
25
|
<CatalogTitleWrapper>
|
|
27
26
|
<CatalogTitle data-translation-key={titleTranslationKey}>{title}</CatalogTitle>
|
|
28
|
-
<
|
|
27
|
+
<Tag borderless textTransform="none">
|
|
28
|
+
{tag}
|
|
29
|
+
</Tag>
|
|
29
30
|
</CatalogTitleWrapper>
|
|
30
31
|
<CatalogDescription data-translation-key={descriptionTranslationKey}>
|
|
31
32
|
{description}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
5
|
-
import {
|
|
5
|
+
import { CatalogEntityTypeIcon } from '@redocly/theme/components/Catalog/CatalogEntityTypeIcon';
|
|
6
6
|
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
7
|
|
|
8
8
|
type Entity = Pick<BffCatalogEntity, 'type' | 'title' | 'summary'>;
|
|
@@ -13,9 +13,7 @@ export type CatalogEntityCellProps<T extends Entity> = {
|
|
|
13
13
|
export function CatalogEntityCell<T extends Entity>({ entity }: CatalogEntityCellProps<T>) {
|
|
14
14
|
return (
|
|
15
15
|
<EntityTitleCellWrapper data-component-name="Catalog/CatalogTableView/CatalogEntityCell">
|
|
16
|
-
<
|
|
17
|
-
<CatalogEntityIcon entityType={entity.type} />
|
|
18
|
-
</IconContainer>
|
|
16
|
+
<CatalogEntityTypeIcon entityType={entity.type} defaultColor={true} />
|
|
19
17
|
<EntityTitleContent>
|
|
20
18
|
<EntityTitle>
|
|
21
19
|
<CatalogHighlight>{entity.title}</CatalogHighlight>
|
|
@@ -37,18 +35,6 @@ const EntityTitleCellWrapper = styled.div`
|
|
|
37
35
|
max-width: 100%;
|
|
38
36
|
`;
|
|
39
37
|
|
|
40
|
-
const IconContainer = styled.div`
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
width: var(--catalog-table-icon-width);
|
|
45
|
-
height: var(--catalog-table-icon-height);
|
|
46
|
-
border-radius: var(--catalog-table-icon-border-radius);
|
|
47
|
-
background-color: var(--catalog-table-icon-bg-color);
|
|
48
|
-
flex-shrink: 0;
|
|
49
|
-
border: var(--catalog-table-icon-border-width) solid var(--catalog-table-icon-border-color);
|
|
50
|
-
`;
|
|
51
|
-
|
|
52
38
|
const EntityTitleContent = styled.div`
|
|
53
39
|
display: flex;
|
|
54
40
|
flex-direction: column;
|
|
@@ -5,8 +5,10 @@ import { SortOption } from '@redocly/theme/core/types';
|
|
|
5
5
|
import { CaretDownIcon } from '@redocly/theme/icons/CaretDownIcon/CaretDownIcon';
|
|
6
6
|
import { CaretUpIcon } from '@redocly/theme/icons/CaretUpIcon/CaretUpIcon';
|
|
7
7
|
import { useCatalogTableHeaderCellActions } from '@redocly/theme/core/hooks/catalog/useCatalogTableHeaderCellActions';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
BaseEntity,
|
|
10
|
+
CatalogColumn,
|
|
11
|
+
} from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableView';
|
|
10
12
|
|
|
11
13
|
export type CatalogTableHeaderCellProps<T extends BaseEntity> = {
|
|
12
14
|
column: CatalogColumn<T>;
|
|
@@ -2,14 +2,14 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
5
|
+
import { SortOption, BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
6
|
import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
|
|
8
7
|
import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
|
|
9
8
|
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
10
9
|
import { CatalogTableHeaderCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableHeaderCell';
|
|
11
10
|
import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
|
|
12
11
|
import { CatalogTableViewRow } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTableViewRow';
|
|
12
|
+
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
13
13
|
|
|
14
14
|
export type BaseEntity = {
|
|
15
15
|
id: string;
|
|
@@ -40,28 +40,6 @@ export type CatalogColumn<T> = {
|
|
|
40
40
|
sortKey?: string;
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
export const getEntityTagColor = (type: EntityType): string => {
|
|
44
|
-
switch (type) {
|
|
45
|
-
case 'service':
|
|
46
|
-
return 'blue';
|
|
47
|
-
case 'domain':
|
|
48
|
-
return 'grass';
|
|
49
|
-
case 'team':
|
|
50
|
-
return 'purple';
|
|
51
|
-
case 'user':
|
|
52
|
-
return 'yellow';
|
|
53
|
-
case 'api-description':
|
|
54
|
-
return 'sky';
|
|
55
|
-
case 'data-schema':
|
|
56
|
-
return 'sky';
|
|
57
|
-
case 'api-operation':
|
|
58
|
-
return 'sky';
|
|
59
|
-
default:
|
|
60
|
-
const exhaustiveCheck: never = type;
|
|
61
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
43
|
const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
66
44
|
{
|
|
67
45
|
key: 'entity',
|
|
@@ -75,11 +53,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
75
53
|
{
|
|
76
54
|
key: 'type',
|
|
77
55
|
title: 'Type',
|
|
78
|
-
render: (entity) =>
|
|
79
|
-
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
80
|
-
{entity.type}
|
|
81
|
-
</EntityTypeTag>
|
|
82
|
-
),
|
|
56
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
83
57
|
width: '2fr',
|
|
84
58
|
minWidth: '120px',
|
|
85
59
|
sortable: true,
|
|
@@ -154,12 +128,6 @@ export const CatalogTableView = <T extends BaseEntity>({
|
|
|
154
128
|
);
|
|
155
129
|
};
|
|
156
130
|
|
|
157
|
-
const EntityTypeTag = styled(Tag)`
|
|
158
|
-
font-size: var(--font-size-base);
|
|
159
|
-
background-color: transparent;
|
|
160
|
-
text-transform: lowercase;
|
|
161
|
-
`;
|
|
162
|
-
|
|
163
131
|
const CatalogTableWrapper = styled.div`
|
|
164
132
|
width: 100%;
|
|
165
133
|
border-bottom: 1px solid var(--catalog-table-border-color);
|
|
@@ -2,13 +2,13 @@ import React, { ReactNode } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { CatalogEntityConfig, EntitiesCatalogConfig } from '@redocly/config';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { Tag } from '@redocly/theme/components/Tag/Tag';
|
|
5
|
+
import { BffCatalogEntity } from '@redocly/theme/core/types';
|
|
7
6
|
import { CatalogOwnersCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogOwnersCell';
|
|
8
7
|
import { CatalogDomainsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogDomainsCell';
|
|
9
8
|
import { CatalogEntityCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogEntityCell';
|
|
10
9
|
import { CatalogTagsCell } from '@redocly/theme/components/Catalog/CatalogTableView/CatalogTagsCell';
|
|
11
10
|
import { useCatalogTableViewRow } from '@redocly/theme/core/hooks/catalog/useCatalogTableViewRow';
|
|
11
|
+
import { CatalogEntityTypeTag } from '@redocly/theme/components/Catalog/CatalogEntityTypeTag';
|
|
12
12
|
|
|
13
13
|
export type BaseEntity = {
|
|
14
14
|
id: string;
|
|
@@ -35,28 +35,6 @@ export type CatalogColumn<T> = {
|
|
|
35
35
|
sortKey?: string;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export const getEntityTagColor = (type: EntityType): string => {
|
|
39
|
-
switch (type) {
|
|
40
|
-
case 'service':
|
|
41
|
-
return 'blue';
|
|
42
|
-
case 'domain':
|
|
43
|
-
return 'grass';
|
|
44
|
-
case 'team':
|
|
45
|
-
return 'purple';
|
|
46
|
-
case 'user':
|
|
47
|
-
return 'yellow';
|
|
48
|
-
case 'api-description':
|
|
49
|
-
return 'sky';
|
|
50
|
-
case 'data-schema':
|
|
51
|
-
return 'sky';
|
|
52
|
-
case 'api-operation':
|
|
53
|
-
return 'sky';
|
|
54
|
-
default:
|
|
55
|
-
const exhaustiveCheck: never = type;
|
|
56
|
-
throw new Error(`Unhandled entity type: ${exhaustiveCheck}`);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
38
|
const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
61
39
|
{
|
|
62
40
|
key: 'entity',
|
|
@@ -70,11 +48,7 @@ const baseColumns: CatalogColumn<BffCatalogEntity>[] = [
|
|
|
70
48
|
{
|
|
71
49
|
key: 'type',
|
|
72
50
|
title: 'Type',
|
|
73
|
-
render: (entity) =>
|
|
74
|
-
<EntityTypeTag color={getEntityTagColor(entity.type as EntityType)}>
|
|
75
|
-
{entity.type}
|
|
76
|
-
</EntityTypeTag>
|
|
77
|
-
),
|
|
51
|
+
render: (entity) => <CatalogEntityTypeTag entityType={entity.type} />,
|
|
78
52
|
width: '2fr',
|
|
79
53
|
minWidth: '120px',
|
|
80
54
|
sortable: true,
|
|
@@ -143,12 +117,6 @@ export const CatalogTableViewRow = <T extends BaseEntity>({
|
|
|
143
117
|
);
|
|
144
118
|
};
|
|
145
119
|
|
|
146
|
-
const EntityTypeTag = styled(Tag)`
|
|
147
|
-
font-size: var(--font-size-base);
|
|
148
|
-
background-color: transparent;
|
|
149
|
-
text-transform: lowercase;
|
|
150
|
-
`;
|
|
151
|
-
|
|
152
120
|
const TableRow = styled.div<{ columnsWidths: string[]; columnsMinWidths: string[] }>`
|
|
153
121
|
display: grid;
|
|
154
122
|
grid-template-columns: ${({ columnsWidths, columnsMinWidths }) =>
|
|
@@ -181,4 +149,6 @@ const TableCell = styled.div`
|
|
|
181
149
|
&.tooltip-cell-container {
|
|
182
150
|
overflow: visible;
|
|
183
151
|
}
|
|
152
|
+
|
|
153
|
+
height: 52px;
|
|
184
154
|
`;
|
|
@@ -2,10 +2,9 @@ import React, { JSX } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { CATALOG_TAG_MAX_LENGTH } from '@redocly/theme/core/constants';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import { CatalogHighlight } from '
|
|
8
|
-
import { TooltipComponent } from '../Tooltip/Tooltip';
|
|
5
|
+
import { Tag, TagProps } from '@redocly/theme/components/Tag/Tag';
|
|
6
|
+
import { TooltipComponent } from '@redocly/theme/components/Tooltip/Tooltip';
|
|
7
|
+
import { CatalogHighlight } from '@redocly/theme/components/Catalog/CatalogHighlight';
|
|
9
8
|
|
|
10
9
|
export type CatalogTagsWithTooltipProps = {
|
|
11
10
|
items: string[];
|
|
@@ -99,6 +99,36 @@ export const catalog = css`
|
|
|
99
99
|
* @tokens Catalog entity icon
|
|
100
100
|
*/
|
|
101
101
|
--catalog-entity-icon-color: var(--color-primary-base);
|
|
102
|
+
--catalog-entity-border-color: var(--border-color-secondary);
|
|
103
|
+
--catalog-entity-bg-color: var(--bg-color-tonal);
|
|
104
|
+
|
|
105
|
+
--catalog-entity-icon-color-service: var(--color-blue-6);
|
|
106
|
+
--catalog-entity-border-color-service: var(--color-blueberry-3);
|
|
107
|
+
--catalog-entity-bg-color-service: var(--color-blue-1);
|
|
108
|
+
|
|
109
|
+
--catalog-entity-icon-color-domain: var(--color-grass-8);
|
|
110
|
+
--catalog-entity-border-color-domain: var(--color-grass-4);
|
|
111
|
+
--catalog-entity-bg-color-domain: var(--color-grass-1);
|
|
112
|
+
|
|
113
|
+
--catalog-entity-icon-color-team: var(--color-purple-7);
|
|
114
|
+
--catalog-entity-border-color-team: var(--color-purple-4);
|
|
115
|
+
--catalog-entity-bg-color-team: var(--color-purple-1);
|
|
116
|
+
|
|
117
|
+
--catalog-entity-icon-color-user: var(--color-orange-7);
|
|
118
|
+
--catalog-entity-border-color-user: var(--color-orange-4);
|
|
119
|
+
--catalog-entity-bg-color-user: var(--color-orange-1);
|
|
120
|
+
|
|
121
|
+
--catalog-entity-icon-color-api-description: var(--color-sky-8);
|
|
122
|
+
--catalog-entity-border-color-api-description: var(--color-sky-5);
|
|
123
|
+
--catalog-entity-bg-color-api-description: var(--color-sky-1);
|
|
124
|
+
|
|
125
|
+
--catalog-entity-icon-color-data-schema: var(--color-carrot-8);
|
|
126
|
+
--catalog-entity-border-color-data-schema: var(--color-carrot-6);
|
|
127
|
+
--catalog-entity-bg-color-data-schema: var(--color-carrot-1);
|
|
128
|
+
|
|
129
|
+
--catalog-entity-icon-color-api-operation: var(--color-raspberry-7);
|
|
130
|
+
--catalog-entity-border-color-api-operation: var(--color-raspberry-3);
|
|
131
|
+
--catalog-entity-bg-color-api-operation: var(--color-raspberry-1);
|
|
102
132
|
|
|
103
133
|
/**
|
|
104
134
|
* @tokens Catalog tags
|
|
@@ -255,8 +285,8 @@ export const catalog = css`
|
|
|
255
285
|
--catalog-table-border-color: var(--border-color-primary);
|
|
256
286
|
--catalog-table-header-bg-color: var(--bg-color-secondary);
|
|
257
287
|
--catalog-table-header-font-weight: var(--font-weight-medium);
|
|
258
|
-
--catalog-table-header-cell-padding:
|
|
259
|
-
--catalog-table-cell-padding:
|
|
288
|
+
--catalog-table-header-cell-padding: 4px 8px;
|
|
289
|
+
--catalog-table-cell-padding: 4px 8px;
|
|
260
290
|
--catalog-table-row-hover-bg-color: var(--bg-color-hover, rgba(0, 0, 0, 0.04));
|
|
261
291
|
--catalog-table-empty-state-padding: 32px;
|
|
262
292
|
--catalog-table-empty-state-color: var(--text-color-secondary);
|
|
@@ -274,8 +304,8 @@ export const catalog = css`
|
|
|
274
304
|
/**
|
|
275
305
|
* @tokens Catalog table icon
|
|
276
306
|
*/
|
|
277
|
-
--catalog-table-icon-width:
|
|
278
|
-
--catalog-table-icon-height:
|
|
307
|
+
--catalog-table-icon-width: 32px;
|
|
308
|
+
--catalog-table-icon-height: 32px;
|
|
279
309
|
--catalog-table-icon-border-radius: 4px;
|
|
280
310
|
--catalog-table-icon-bg-color: var(--bg-color-tonal);
|
|
281
311
|
--catalog-table-icon-border-color: var(--border-color-secondary);
|
|
@@ -345,7 +375,6 @@ export const catalog = css`
|
|
|
345
375
|
--catalog-empty-state-font-size: var(--font-size-base);
|
|
346
376
|
--catalog-empty-state-line-height: var(--line-height-base);
|
|
347
377
|
|
|
348
|
-
|
|
349
378
|
--catalog-avatar-bg-color: #ededf2;
|
|
350
379
|
// @tokens End
|
|
351
380
|
`;
|
|
@@ -128,7 +128,9 @@ export const mobileMenu = css`
|
|
|
128
128
|
/**
|
|
129
129
|
* @tokens Mobile Menu
|
|
130
130
|
* */
|
|
131
|
+
/* Fallback for older browsers. dvh accounts for dynamic UI elements like mobile address bars */
|
|
131
132
|
--menu-mobile-height: calc(100vh - var(--navbar-height));
|
|
133
|
+
--menu-mobile-height: calc(100dvh - var(--navbar-height));
|
|
132
134
|
--menu-mobile-width: 100%;
|
|
133
135
|
--menu-mobile-z-index: var(--z-index-raised);
|
|
134
136
|
--menu-mobile-left: 0;
|