Skip to content

Commit c5dfd56

Browse files
niktverdaeksandla
authored andcommitted
feat: update foldable-list
1 parent 8b7af83 commit c5dfd56

File tree

2 files changed

+42
-14
lines changed

2 files changed

+42
-14
lines changed

src/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.scss

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,25 @@ $block: '.#{$ns}FoldableListBlockItem';
1212
}
1313

1414
&__title {
15-
@include reset-button-style();
16-
@include heading4();
17-
@include focusable();
15+
@include add-specificity(&) {
16+
@include heading4();
17+
@include focusable();
1818

19+
cursor: pointer;
20+
border-radius: var(--g-focus-border-radius);
21+
22+
a {
23+
@include link();
24+
}
25+
}
26+
}
27+
28+
&__title-container {
29+
margin: 0;
1930
position: relative;
2031
display: block;
2132
width: 100%;
22-
padding-right: 24px;
33+
padding-right: $indentSM;
2334
text-align: start;
2435
cursor: pointer;
2536
border-radius: var(--g-focus-border-radius);
@@ -57,4 +68,10 @@ $block: '.#{$ns}FoldableListBlockItem';
5768

5869
margin-top: $indentXXS;
5970
}
71+
72+
&__button {
73+
@include reset-button-style();
74+
75+
width: 100%;
76+
}
6077
}

src/blocks/FoldableList/FoldableListBlockItem/FoldableListBlockItem.tsx

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {useActionHandlers} from '@gravity-ui/uikit';
22

3-
import {Foldable, HTML, ToggleArrow, YFMWrapper} from '../../../components';
3+
import {Foldable, ToggleArrow, YFMWrapper} from '../../../components';
44
import Link from '../../../components/Link/Link';
55
import {FoldableListBlockItemProps} from '../../../models';
66
import {block} from '../../../utils';
@@ -22,19 +22,30 @@ export const FoldableListBlockItem = ({
2222
return (
2323
<div className={b()} itemScope role={'listitem'}>
2424
<button
25-
className={b('title')}
25+
className={b('button')}
2626
onClick={onClick}
2727
aria-expanded={isOpened}
2828
onKeyDown={onKeyDown}
2929
>
30-
<HTML>{itemTitle}</HTML>
31-
<ToggleArrow
32-
open={isOpened}
33-
size={16}
34-
type={'vertical'}
35-
iconType="navigation"
36-
className={b('arrow')}
37-
/>
30+
<YFMWrapper
31+
tagName="h3"
32+
className={b('title-container')}
33+
contentClassName={b('title')}
34+
content={itemTitle}
35+
modifiers={{
36+
constructor: true,
37+
}}
38+
onClick={onClick}
39+
tabIndex={0}
40+
>
41+
<ToggleArrow
42+
open={isOpened}
43+
size={16}
44+
type={'vertical'}
45+
iconType="navigation"
46+
className={b('arrow')}
47+
/>
48+
</YFMWrapper>
3849
</button>
3950
<Foldable isOpened={isOpened}>
4051
<div className={b('text')} aria-hidden={!isOpened}>

0 commit comments

Comments
 (0)