Skip to content

Commit 6c3110c

Browse files
committed
fix: link arrow position
1 parent 792be1b commit 6c3110c

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

src/components/Link/Link.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,22 @@ $block: '.#{$ns}link-block';
2222
}
2323

2424
&_has-arrow {
25+
display: inherit;
26+
white-space: nowrap;
27+
2528
&:hover,
2629
&:active {
2730
--pc-text-header-color: inherit;
2831
color: var(--yc-color-text-link);
2932
}
33+
34+
.yc-icon {
35+
vertical-align: text-bottom;
36+
}
37+
38+
#{$root}__content {
39+
white-space: normal;
40+
}
3041
}
3142

3243
&:hover {

src/components/Link/Link.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useContext} from 'react';
1+
import React, {Fragment, useContext} from 'react';
22
import {Icon} from '@gravity-ui/uikit';
33

44
import {block, getLinkProps, setUrlTld} from '../../utils';
@@ -13,6 +13,7 @@ import {useMetrika} from '../../hooks/useMetrika';
1313
import './Link.scss';
1414

1515
const b = block('link-block');
16+
const WORD_JOINER_SYM = '\u200b';
1617

1718
export type LinkFullProps = LinkProps & ClassNameProps;
1819

@@ -23,9 +24,9 @@ function getArrowSize(size: TextSize) {
2324
case 'm':
2425
return 18;
2526
case 's':
26-
return 12;
27+
return 14;
2728
default:
28-
return 12;
29+
return 14;
2930
}
3031
}
3132

@@ -79,13 +80,16 @@ const LinkBlock = (props: WithChildren<LinkFullProps>) => {
7980
onClick={onClick}
8081
{...linkProps}
8182
>
82-
{children || text}
83+
<span className={b('content')}>{children || text}</span>
8384
{arrow && (
84-
<Icon
85-
className={b('arrow')}
86-
data={Chevron}
87-
size={getArrowSize(textSize)}
88-
/>
85+
<Fragment>
86+
{WORD_JOINER_SYM}
87+
<Icon
88+
className={b('arrow')}
89+
data={Chevron}
90+
size={getArrowSize(textSize)}
91+
/>
92+
</Fragment>
8993
)}
9094
</a>
9195
);

0 commit comments

Comments
 (0)