Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { EuiLink, EuiText } from '@elastic/eui';
import Mustache from 'mustache';
import React from 'react';
import styled from 'styled-components';
import { CustomLink } from '../../../../../../../../plugins/apm/common/custom_link/custom_link_types';
import { Transaction } from '../../../../../../../../plugins/apm/typings/es_schemas/ui/transaction';
import {
SectionLinks,
SectionLink
} from '../../../../../../../../plugins/observability/public';
import { px, truncate, units } from '../../../../style/variables';

const LinkContainer = styled.li`
margin-top: ${px(units.half)};
&:first-of-type {
margin-top: 0;
}
`;

const TruncateText = styled(EuiText)`
font-weight: 500;
line-height: ${px(units.unit)};
${truncate(px(units.unit * 25))}
`;

export const CustomLinkSection = ({
customLinks,
Expand All @@ -19,7 +31,7 @@ export const CustomLinkSection = ({
customLinks: CustomLink[];
transaction: Transaction;
}) => (
<SectionLinks>
<ul>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this change not be made in the shared SectionLinks component?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agreed, but due to the deadline of the release I thought to do it here, and create a new issue to replace it later on SectionLinks, WDYT?

{customLinks.map(link => {
let href = link.url;
try {
Expand All @@ -28,13 +40,12 @@ export const CustomLinkSection = ({
// ignores any error that happens
}
return (
<SectionLink
key={link.id}
label={link.label}
href={href}
target="_blank"
/>
<LinkContainer key={link.id}>
<EuiLink href={href} target="_blank">
<TruncateText size="s">{link.label}</TruncateText>
</EuiLink>
</LinkContainer>
);
})}
</SectionLinks>
</ul>
);