Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [InstitutionHeading] Support rendering as a link (isProfileLink) to the institution profile #1021

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/pages/Filing/FilingApp/FileSubmission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ export function FileSubmission(): JSX.Element {
<WrapperPageContent className='my-[1.875rem]'>
<InstitutionHeading
headingType='4'
isProfileLink={true}
lei={institution?.lei}
name={institutionName}
filingPeriod={year}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Filing/FilingApp/FilingErrors/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ function FilingErrors(): JSX.Element {
<WrapperPageContent className='my-[1.875rem]'>
<InstitutionHeading
headingType='4'
isProfileLink={true}
lei={institution?.lei}
name={institution?.name}
filingPeriod={year}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Filing/FilingApp/FilingSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ export function FilingSubmit(): JSX.Element {
<WrapperPageContent className='my-[1.875rem]'>
<InstitutionHeading
headingType='4'
isProfileLink={true}
lei={institution.lei}
name={institution.name}
filingPeriod={year}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Filing/FilingApp/FilingWarnings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ function FilingWarnings(): JSX.Element {
<WrapperPageContent className='my-[1.875rem]'>
<InstitutionHeading
headingType='4'
isProfileLink={true}
lei={institution?.lei}
name={institution?.name}
filingPeriod={year}
/>
Expand Down
28 changes: 19 additions & 9 deletions src/pages/Filing/FilingApp/InstitutionHeading.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Link } from 'components/Link';
import { Heading } from 'design-system-react';
import type { HeadingType } from 'design-system-react/dist/components/Headings/Heading';
import type { InstitutionDataType } from './InstitutionCard.types';
Expand All @@ -8,18 +9,27 @@ function InstitutionHeading({
lei,
filingPeriod,
headingType = '5',
isProfileLink = false,
}: InstitutionDataType & {
// eslint-disable-next-line react/require-default-props
}: InstitutionDataType & { headingType?: HeadingType }): JSX.Element {
const content: (number | string)[] = [];
headingType?: HeadingType;
// eslint-disable-next-line react/require-default-props
isProfileLink?: boolean;
}): JSX.Element {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
for (const item of [name || lei, filingPeriod]) {
if (item) {
content.push(item);
}
}
const contentUsed = content
const content = [name || lei, filingPeriod]
.filter(Boolean)
.join(`${'\u00A0\u00A0'}|${'\u00A0\u00A0'}`);
return <Heading type={headingType}>{contentUsed}</Heading>;

if (isProfileLink && lei)
return (
<Heading type={headingType}>
<Link isRouterLink href={`/institution/${lei}`}>
{content}
</Link>
</Heading>
);

return <Heading type={headingType}>{content}</Heading>;
}
export default InstitutionHeading;
2 changes: 2 additions & 0 deletions src/pages/PointOfContact/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ function PointOfContact(): JSX.Element {
<WrapperPageContent className='my-[1.875rem]'>
<InstitutionHeading
headingType='4'
isProfileLink
lei={institution?.lei}
name={institution?.name}
filingPeriod={year}
/>
Expand Down