mirror of https://github.com/buster-so/buster.git
added scroll ability
This commit is contained in:
parent
fa0c10c86c
commit
e69c90a876
|
@ -50,7 +50,6 @@ export const AppPageLayout: React.FC<
|
||||||
<AppPageLayoutHeader
|
<AppPageLayoutHeader
|
||||||
className={cn(headerBorderVariant === 'ghost' && '-mt-[0.5px]', headerClassName)}
|
className={cn(headerBorderVariant === 'ghost' && '-mt-[0.5px]', headerClassName)}
|
||||||
sizeVariant={headerSizeVariant}
|
sizeVariant={headerSizeVariant}
|
||||||
borderVariant={headerBorderVariant}
|
|
||||||
>
|
>
|
||||||
{header}
|
{header}
|
||||||
</AppPageLayoutHeader>
|
</AppPageLayoutHeader>
|
||||||
|
@ -60,7 +59,6 @@ export const AppPageLayout: React.FC<
|
||||||
<AppPageLayoutHeader
|
<AppPageLayoutHeader
|
||||||
className={cn(headerBorderVariant === 'ghost' && '-mt-[0.5px]', headerClassName)}
|
className={cn(headerBorderVariant === 'ghost' && '-mt-[0.5px]', headerClassName)}
|
||||||
sizeVariant={headerSizeVariant}
|
sizeVariant={headerSizeVariant}
|
||||||
borderVariant={headerBorderVariant}
|
|
||||||
>
|
>
|
||||||
{secondaryHeader}
|
{secondaryHeader}
|
||||||
</AppPageLayoutHeader>
|
</AppPageLayoutHeader>
|
||||||
|
@ -71,9 +69,12 @@ export const AppPageLayout: React.FC<
|
||||||
scrollable={scrollable}
|
scrollable={scrollable}
|
||||||
id={contentContainerId}
|
id={contentContainerId}
|
||||||
>
|
>
|
||||||
{header && scrollable && headerBorderVariant === 'ghost' && (
|
<div
|
||||||
<div className="scroll-header" />
|
className={cn(
|
||||||
)}
|
'pointer-events-none top-[0px] z-10 right-0 left-0 h-[0.5px] w-full sticky bg-border',
|
||||||
|
headerBorderVariant === 'ghost' && 'scroll-header'
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
</AppPageLayoutContent>
|
</AppPageLayoutContent>
|
||||||
|
|
|
@ -10,22 +10,10 @@ const headerVariants = cva(
|
||||||
default: 'px-4.5',
|
default: 'px-4.5',
|
||||||
list: 'px-7.5',
|
list: 'px-7.5',
|
||||||
},
|
},
|
||||||
borderVariant: {
|
|
||||||
default: 'border-b',
|
|
||||||
ghost: 'border-b-0',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
borderVariant: 'default',
|
|
||||||
sizeVariant: 'default',
|
sizeVariant: 'default',
|
||||||
},
|
},
|
||||||
compoundVariants: [
|
|
||||||
{
|
|
||||||
borderVariant: 'ghost',
|
|
||||||
sizeVariant: 'default',
|
|
||||||
className: 'max-h-[37.5px] min-h-[37.5px]', // hack. figure out a better way to do this
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -35,8 +23,6 @@ export const AppPageLayoutHeader: React.FC<
|
||||||
className?: string;
|
className?: string;
|
||||||
} & VariantProps<typeof headerVariants>
|
} & VariantProps<typeof headerVariants>
|
||||||
>
|
>
|
||||||
> = ({ children, className = '', sizeVariant = 'default', borderVariant = 'default' }) => {
|
> = ({ children, className = '', sizeVariant = 'default' }) => {
|
||||||
return (
|
return <div className={cn(headerVariants({ sizeVariant }), className)}>{children}</div>;
|
||||||
<div className={cn(headerVariants({ sizeVariant, borderVariant }), className)}>{children}</div>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,20 @@
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
|
|
||||||
|
import { AppPageLayout } from '@/components/ui/layouts/AppPageLayout';
|
||||||
|
import { AppPageLayoutHeader } from '@/components/ui/layouts/AppPageLayoutHeader';
|
||||||
|
|
||||||
export const AssetContainer: React.FC<{
|
export const AssetContainer: React.FC<{
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}> = ({ children }) => {
|
header?: React.ReactNode;
|
||||||
return <div className="bg-red-100 h-full w-full">{children}</div>;
|
}> = ({ children, header }) => {
|
||||||
|
return (
|
||||||
|
<AppPageLayout
|
||||||
|
header={header}
|
||||||
|
headerBorderVariant="ghost"
|
||||||
|
headerSizeVariant="default"
|
||||||
|
scrollable={false}
|
||||||
|
>
|
||||||
|
<div className="h-full flex flex-col w-full">{children}</div>
|
||||||
|
</AppPageLayout>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,9 +5,5 @@ export const MetricAssetContainer: React.FC<{
|
||||||
metricId: string;
|
metricId: string;
|
||||||
metric_version_number: number | undefined;
|
metric_version_number: number | undefined;
|
||||||
}> = ({ children, metricId, metric_version_number }) => {
|
}> = ({ children, metricId, metric_version_number }) => {
|
||||||
return (
|
return <AssetContainer header={<div>Metric ID: {metricId}</div>}>{children}</AssetContainer>;
|
||||||
<AssetContainer>
|
|
||||||
METRIC {children} {metricId} {metric_version_number}
|
|
||||||
</AssetContainer>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,21 +10,12 @@
|
||||||
scroll-timeline-name: --scrollShadowContainer;
|
scroll-timeline-name: --scrollShadowContainer;
|
||||||
|
|
||||||
.scroll-header {
|
.scroll-header {
|
||||||
@apply pointer-events-none absolute top-[0px] right-0 left-0 h-[0.5px] w-full border-b border-transparent;
|
@apply pointer-events-none top-[0px] z-10 right-0 left-0 h-[0.5px] w-full sticky;
|
||||||
animation: shadowAnimation linear;
|
animation-name: scrollShowAnimation;
|
||||||
animation-range: 0px 120px;
|
animation-duration: 1ms; /* Firefox requires this to apply the animation */
|
||||||
animation-timeline: --scrollShadowContainer;
|
animation-timeline: --scrollShadowContainer;
|
||||||
|
animation-range: 0px 140px;
|
||||||
animation-fill-mode: forwards;
|
animation-fill-mode: forwards;
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes shadowAnimation {
|
|
||||||
from {
|
|
||||||
border-color: transparent;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
border-color: var(--color-border);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,3 +40,14 @@
|
||||||
scrollbar-color: color-mix(in srgb, var(--color-border) 50%, transparent)
|
scrollbar-color: color-mix(in srgb, var(--color-border) 50%, transparent)
|
||||||
transparent;
|
transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes scrollShowAnimation {
|
||||||
|
from {
|
||||||
|
background-color: transparent;
|
||||||
|
min-height: 0px;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
background-color: var(--color-border);
|
||||||
|
min-height: 0.5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue