Skip to content

Commit

Permalink
Merge pull request #49 from CryptoRodeo/kfluxui-246
Browse files Browse the repository at this point in the history
fix(KFLUXUI-246): allow highlightable links
  • Loading branch information
sahil143 authored Dec 9, 2024
2 parents 4022d75 + 1932b9e commit f80051c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const ComponentDetails: React.FC<React.PropsWithChildren<ComponentDetailsProps>>
: `https://${componentImageURL}`
}
text={componentImageURL}
isHighlightable
/>
</DescriptionListDescription>
</DescriptionListGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/components/GitLink/GitRepoLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const GitRepoLink: React.FC<React.PropsWithChildren<Props>> = ({

return (
<Tooltip content={fullUrl} position={TooltipPosition.bottom}>
<ExternalLink href={fullUrl} icon={icon} hideIcon dataTestID={dataTestID}>
<ExternalLink href={fullUrl} icon={icon} hideIcon dataTestID={dataTestID} isHighlightable>
{parsed.owner}/{parsed.name}
{revision ? (
<>
Expand Down
3 changes: 3 additions & 0 deletions src/shared/components/links/ExternalLink.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.highlightable-link {
user-select: text; /* Enables text selection */
}
6 changes: 5 additions & 1 deletion src/shared/components/links/ExternalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as React from 'react';
import { ButtonProps, ButtonVariant, Icon } from '@patternfly/react-core';
import { ExternalLinkAltIcon } from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
import { css } from '@patternfly/react-styles';
import AnalyticsButton from '../../../components/AnalyticsButton/AnalyticsButton';
import { AnalyticsButtonProperties } from '../../../utils/analytics';
import './ExternalLink.scss';

type ExternalLinkProps = {
href: string;
Expand All @@ -18,6 +20,7 @@ type ExternalLinkProps = {
onClick?: ButtonProps['onClick'];
analytics?: AnalyticsButtonProperties;
size?: 'sm' | 'md' | 'lg' | 'xl';
isHighlightable?: boolean;
};

const ExternalLink: React.FC<React.PropsWithChildren<ExternalLinkProps>> = ({
Expand All @@ -34,11 +37,12 @@ const ExternalLink: React.FC<React.PropsWithChildren<ExternalLinkProps>> = ({
icon,
onClick,
size = 'sm',
isHighlightable,
}) => (
<AnalyticsButton
component="a"
style={style}
className={additionalClassName}
className={css(additionalClassName, isHighlightable && 'highlightable-link')}
href={href}
target="_blank"
rel="noopener noreferrer"
Expand Down

0 comments on commit f80051c

Please sign in to comment.