Skip to content

Commit 5beff90

Browse files
ECHOES-1017 Allow discreet standalone links and default to them in breadcrumbs
1 parent 0fa2443 commit 5beff90

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

src/components/breadcrumbs/BreadcrumbLink.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ export const BreadcrumbLink = forwardRef<HTMLAnchorElement, BreadcrumbLinkProps>
3636
{...linkProps}
3737
className={classNames(className, breadcrumbItemStyle)}
3838
highlight={LinkHighlight.Subtle}
39+
isDiscreet
3940
ref={ref}
4041
title={title}>
4142
{linkElement}
4243
</LinkStandalone>
4344
</BreadcrumbItemBase>
4445
);
4546
});
47+
4648
BreadcrumbLink.displayName = 'BreadcrumbLink';

src/components/links/LinkStandalone.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { LinkStandaloneProps } from './LinkTypes';
2727
import { cssVar } from '~utils/design-tokens';
2828

2929
const LinkStandaloneBase = forwardRef<HTMLAnchorElement, LinkStandaloneProps>((props, ref) => {
30-
const { children, iconLeft, ...linkProps } = props;
30+
const { children, iconLeft, isDiscreet, ...linkProps } = props;
3131

3232
return (
3333
<LinkBaseStyled {...linkProps} ref={ref}>
@@ -41,19 +41,25 @@ const LinkStandaloneBase = forwardRef<HTMLAnchorElement, LinkStandaloneProps>((p
4141
LinkStandaloneBase.displayName = 'LinkStandaloneBase';
4242

4343
export const LinkStandalone = styled(LinkStandaloneBase)`
44+
${({ isDiscreet }) =>
45+
isDiscreet &&
46+
css`
47+
font-weight: ${cssVar('font-weight-regular')};
48+
`}
49+
4450
text-decoration-line: ${cssVar('text-decoration-none')};
4551
52+
&:hover {
53+
text-decoration-line: ${cssVar('text-decoration-underline')};
54+
}
55+
4656
&:hover,
4757
&:focus,
4858
&:active {
4959
color: var(--color);
5060
text-decoration-color: var(--color);
5161
}
5262
53-
&:hover {
54-
text-decoration-line: ${cssVar('text-decoration-underline')};
55-
}
56-
5763
${({ iconLeft }) =>
5864
iconLeft &&
5965
css`

src/components/links/LinkTypes.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ interface LinkAsButtonProps extends LinkCommonProps, LinkPropsForbiddenForButton
6565

6666
export type LinkProps = LinkAsLinkProps | LinkAsButtonProps;
6767

68-
export type LinkStandaloneBaseProps = { iconLeft?: ReactNode };
68+
export type LinkStandaloneBaseProps = {
69+
iconLeft?: ReactNode;
70+
isDiscreet?: boolean;
71+
};
6972

7073
export type LinkStandaloneProps = LinkProps & LinkStandaloneBaseProps;
7174

stories/link/LinkStandalone-stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ const meta: Meta<typeof LinkStandaloneComp> = {
3232
component: LinkStandaloneComp,
3333
title: 'Echoes/Link/LinkStandalone',
3434
argTypes: {
35+
isDiscreet: {
36+
control: {
37+
type: 'boolean',
38+
},
39+
},
3540
highlight: {
3641
control: {
3742
type: 'select',
@@ -51,7 +56,7 @@ export default meta;
5156
type Story = StoryObj<typeof LinkStandaloneComp>;
5257

5358
const defaultArgs = {
54-
highlight: undefined,
59+
highlight: LinkHighlight.Accent,
5560
to: '/projects/new',
5661
};
5762

0 commit comments

Comments
 (0)