Skip to content

Commit 41b2b36

Browse files
authored
Merge pull request #375 from eccenca/fix/disabledLinkSize-CMEM-7133
Fix font-size issues of Link component
2 parents e0b0e11 + 562d5e1 commit 41b2b36

3 files changed

Lines changed: 61 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2626
- take Markdown rendering into account before testing the maximum preview length
2727
- `<NodeContent />`
2828
- header-menu items are vertically centered now
29+
- `<Link />`
30+
- stabilize font size for on hover state
31+
- use correct font sizes when `size` property is set
2932
- `Typography`
3033
- adjust displaying fallback symbols in different browsers
3134

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from "react";
2+
import { Meta, StoryFn } from "@storybook/react";
3+
4+
import { Link } from "../../../index";
5+
6+
export default {
7+
title: "Components/Link",
8+
component: Link,
9+
argTypes: {
10+
target: {
11+
control: "select",
12+
options: ["_self", "_blank", "_parent", "_top"],
13+
},
14+
},
15+
} as Meta<typeof Link>;
16+
17+
const Template: StoryFn<typeof Link> = (args) => <Link {...args} />;
18+
19+
export const Default = Template.bind({});
20+
Default.args = {
21+
children: "Example link",
22+
href: "https://example.com/",
23+
};
24+
25+
export const Disabled = Template.bind({});
26+
Disabled.args = {
27+
children: "Disabled link",
28+
href: "https://example.com/",
29+
disabled: true,
30+
};

src/components/Link/link.scss

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,34 @@
22
@include link.link;
33

44
.#{$prefix}--link {
5-
font-size: 1em;
6-
line-height: inherit;
5+
&,
6+
&:hover {
7+
// default case: use font size from context
8+
font-size: inherit;
9+
line-height: inherit;
10+
}
11+
12+
&.#{$prefix}--link--sm {
13+
&,
14+
&:hover {
15+
font-size: $eccgui-size-typo-caption;
16+
line-height: $eccgui-size-typo-caption-lineheight;
17+
}
18+
}
19+
&.#{$prefix}--link--md {
20+
&,
21+
&:hover {
22+
font-size: $eccgui-size-typo-text;
23+
line-height: $eccgui-size-typo-text-lineheight;
24+
}
25+
}
26+
&.#{$prefix}--link--lg {
27+
&,
28+
&:hover {
29+
font-size: $eccgui-size-typo-subtitle;
30+
line-height: $eccgui-size-typo-subtitle-lineheight;
31+
}
32+
}
733

834
&:focus {
935
outline: none;

0 commit comments

Comments
 (0)