Skip to content

Commit

Permalink
feat(glossary) Add Source section to sidebar for Glossary Terms (#5262)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscollins3456 authored Jun 28, 2022
1 parent 11f101e commit 99890cd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DescriptionTypography = styled(Typography.Paragraph)`
`;

const SidebarLinkList = styled.div`
margin-left: -15px;
margin: 0 0 10px -15px;
min-width: 0;
`;

Expand All @@ -32,10 +32,14 @@ const LinkButton = styled(Button)`
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
line-height: 1;
}
`;

const SourceButton = styled(LinkButton)`
padding: 0;
margin-top: -5px;
`;

interface Props {
hideLinksButton?: boolean;
}
Expand All @@ -49,6 +53,9 @@ export const SidebarAboutSection = ({ properties }: { properties?: Props }) => {
const description = entityData?.editableProperties?.description || entityData?.properties?.description;
const links = entityData?.institutionalMemory?.elements || [];

const sourceUrl = entityData?.properties?.sourceUrl;
const sourceRef = entityData?.properties?.sourceRef;

const isUntouched = !description && !(links?.length > 0);

return (
Expand Down Expand Up @@ -117,6 +124,23 @@ export const SidebarAboutSection = ({ properties }: { properties?: Props }) => {
)}
</SidebarLinkList>
)}
{sourceRef && (
<>
<SidebarHeader title="Source" />
<Typography.Paragraph>
{sourceUrl ? (
<SourceButton type="link" href={sourceUrl} target="_blank" rel="noreferrer">
<LinkOutlined />
{sourceRef}
</SourceButton>
) : (
{
sourceRef,
}
)}
</Typography.Paragraph>
</>
)}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'react-router-dom';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { message, Button, List, Typography } from 'antd';
import { LinkOutlined, DeleteOutlined } from '@ant-design/icons';
import { EntityType } from '../../../../../../types.generated';
Expand Down
2 changes: 2 additions & 0 deletions datahub-web-react/src/app/entity/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export type GenericEntityProperties = {
properties?: Maybe<{
description?: Maybe<string>;
qualifiedName?: Maybe<string>;
sourceUrl?: Maybe<string>;
sourceRef?: Maybe<string>;
}>;
globalTags?: Maybe<GlobalTags>;
glossaryTerms?: Maybe<GlossaryTerms>;
Expand Down

0 comments on commit 99890cd

Please sign in to comment.