Skip to content

Commit 3d9920a

Browse files
committed
Adding ExpandableButton to notes that have more than 2 list items.
1 parent de0b0bd commit 3d9920a

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

src/modules/resource-acccess/components/Holder/index.js

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,37 @@ const notesList = (notes) => {
2222
}
2323

2424
return (
25-
<ul>
26-
{notes.map((note, index) => {
27-
return (
28-
<li
29-
key={note + index}
30-
className='text-grey__light padding-bottom__xs'
31-
>
32-
{note}
33-
</li>
34-
);
35-
})}
36-
</ul>
25+
<Expandable>
26+
<ul className='margin-bottom__none'>
27+
<ExpandableChildren show={2}>
28+
{notes.map((note, index) => {
29+
return (
30+
<li
31+
key={note + index}
32+
className='text-grey__light padding-bottom__xs'
33+
>
34+
{note}
35+
</li>
36+
);
37+
})}
38+
</ExpandableChildren>
39+
</ul>
40+
41+
{notes.length > 2 && (
42+
<ExpandableButton
43+
name='holdings notes'
44+
count={notes.length}
45+
/>
46+
)}
47+
</Expandable>
3748
);
3849
};
3950

4051
const Holder = ({ captionLink, headings, notes, preExpanded, rows, ...rest }) => {
4152
const isExpandable = rows.length > 10;
4253
return (
43-
<div {...rest}>
44-
{captionLink && (
54+
<div className='holder-content' {...rest}>
55+
{captionLink?.href && (
4556
<p className='margin__none'>
4657
<Anchor href={captionLink.href} className='btn--tertiary'>
4758
{captionLink.text}

src/modules/resource-acccess/components/Holder/styles.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
.holder-content > * + * {
2+
margin-top: 1rem;
3+
}
4+
5+
.holder-content > ul + .btn {
6+
margin-left: 2.5rem;
7+
margin-top: 0;
8+
}
9+
110
.holder-container {
211
overflow-x: auto;
312
}

0 commit comments

Comments
 (0)