Skip to content

Commit d19c1c3

Browse files
Scrollable Population Panel (#504)
Co-authored-by: fangge518 <fangge518@gmail.com>
1 parent 335e04e commit d19c1c3

3 files changed

Lines changed: 410 additions & 246 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import {ScrollArea} from '@radix-ui/themes';
3+
4+
export const ConditionalScrollArea: React.FC<{
5+
children: React.ReactNode;
6+
shouldUseScrollableRows: boolean;
7+
maxHeight: string;
8+
}> = ({children, shouldUseScrollableRows, maxHeight}) => {
9+
if (shouldUseScrollableRows) {
10+
return (
11+
// type="always" keeps the scrollbar visible even while not scrolling — it is the
12+
// sole affordance that more rows exist below (no fade-out effect).
13+
<ScrollArea
14+
scrollbars="vertical"
15+
type="always"
16+
size="2"
17+
className="flex-grow-1"
18+
style={{maxHeight}}
19+
>
20+
{children}
21+
</ScrollArea>
22+
);
23+
}
24+
return children;
25+
};

0 commit comments

Comments
 (0)