Style scrollbars.

This commit is contained in:
Mike Cao 2023-03-31 21:31:58 -07:00
parent 14802afe8b
commit 17601c4dea
8 changed files with 56 additions and 15 deletions

View File

@ -1,4 +1,4 @@
import { Button, Icon, Tooltip, PopupTrigger, Popup, Form, FormRow } from 'react-basics';
import { Button, Icon, PopupTrigger, Popup, Form, FormRow } from 'react-basics';
import TimezoneSetting from 'components/pages/settings/profile/TimezoneSetting';
import DateRangeSetting from 'components/pages/settings/profile/DateRangeSetting';
import Icons from 'components/icons';
@ -10,13 +10,11 @@ export default function SettingsButton() {
return (
<PopupTrigger>
<Tooltip label={formatMessage(labels.settings)} position="bottom">
<Button variant="quiet">
<Icon>
<Icons.Gear />
</Icon>
</Button>
</Tooltip>
<Button variant="quiet">
<Icon>
<Icons.Gear />
</Icon>
</Button>
<Popup
className={styles.popup}
position="bottom"

View File

@ -19,3 +19,7 @@
height: calc(100vh - 60px);
overflow-y: auto;
}
.body::-webkit-scrollbar-track {
border: 0;
}

View File

@ -1,4 +1,5 @@
import { useState } from 'react';
import useMeasure from 'react-use-measure';
import { FixedSizeList } from 'react-window';
import { useSpring, animated, config } from 'react-spring';
import classNames from 'classnames';
@ -18,6 +19,7 @@ export default function DataTable({
virtualize = false,
showPercentage = true,
}) {
const [ref, bounds] = useMeasure();
const [format, setFormat] = useState(true);
const formatFunc = format ? formatLongNumber : formatNumber;
@ -56,10 +58,10 @@ export default function DataTable({
{metric}
</div>
</div>
<div className={styles.body} style={{ height }}>
<div ref={ref} className={styles.body}>
{data?.length === 0 && <NoData />}
{virtualize && data.length > 0 ? (
<FixedSizeList height={height} itemCount={data.length} itemSize={30}>
<FixedSizeList height={bounds.height} itemCount={data.length} itemSize={30}>
{Row}
</FixedSizeList>
) : (

View File

@ -4,6 +4,7 @@
height: 100%;
display: flex;
flex-direction: column;
flex: 1;
}
.footer {

View File

@ -35,12 +35,12 @@ export default function PagesTable({ websiteId, showFilters, ...props }) {
<>
{showFilters && <FilterButtons items={buttons} selectedKey={view} onSelect={handleSelect} />}
<MetricsTable
{...props}
title={formatMessage(labels.pages)}
type={view}
metric={formatMessage(labels.views)}
websiteId={websiteId}
renderLabel={renderLink}
{...props}
/>
</>
);

View File

@ -108,11 +108,10 @@ export default function WebsiteMenuView({ websiteId, websiteDomain }) {
</Link>
<SideNav items={items} selectedKey={view} shallow={true} />
</GridColumn>
<GridColumn xs={12} sm={12} md={12} defaultSize={9} className={styles.data}>
<GridColumn xs={12} sm={12} md={12} defaultSize={9} className={styles.content}>
<DetailsComponent
websiteId={websiteId}
websiteDomain={websiteDomain}
height={500}
limit={false}
animate={false}
showFilters={true}

View File

@ -1,3 +1,7 @@
.data {
min-height: 600px;
.menu {
position: relative;
}
.content {
min-height: 800px;
}

View File

@ -63,3 +63,36 @@ svg {
width: 100%;
height: 100%;
}
::-webkit-scrollbar {
width: 16px;
height: 16px;
background: transparent;
}
::-webkit-scrollbar-track {
background: transparent;
border-right: 2px solid var(--base200);
}
::-webkit-scrollbar-track:hover {
border-right: 2px solid var(--base300);
}
::-webkit-scrollbar-thumb {
position: relative;
border-right: 2px solid var(--base600);
}
::-webkit-scrollbar-thumb:hover {
border-right: 8px solid var(--base700);
}
::-webkit-scrollbar-thumb:horizontal {
position: relative;
border-bottom: 2px solid var(--base600);
}
::-webkit-scrollbar-thumb:horizontal:hover {
border-bottom: 8px solid var(--base700);
}