Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add styles to make panel scrollable #692

Merged
merged 2 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 77 additions & 45 deletions app/scripts/components/datasets/s-explore/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ const DatesWrapper = styled.div`
position: relative;
z-index: 10;
box-shadow: 0 1px 0 0 ${themeVal('color.base-100a')};

> ${PanelWidget} {
width: 100%;
position: relative;
Expand All @@ -109,6 +108,34 @@ const DatesWrapper = styled.div`
}
`;

const PositionPlaceHolderForScroll = styled.div`
position: absolute;
pointer-events: none;
z-index: 1000;
top: 0px;
left: 0px;
width: 1.5rem;
height: 100%;
background: linear-gradient(
to left,
rgba(255, 255, 255, 0) 0%,
rgb(255, 255, 255) 100%
);
`;

const ScrollArea = styled.div`
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
`;

const ScrollAreaInner = styled.div`
position: absolute;
inset: 0px;
overflow: scroll;
`;

const isSelectedDateValid = (dateList, selectedDate) => {
if (dateList) {
// Since the available dates changes, check if the currently selected
Expand Down Expand Up @@ -587,52 +614,57 @@ function DatasetsExplore() {
</PanelActions>
</PanelHeader>
<PanelBody>
<DatesWrapper>
{activeLayerTimeseries && (
<PanelDateWidget
title='Date'
value={datePickerValue}
onConfirm={datePickerConfirm}
timeDensity={activeLayerTimeseries.timeDensity}
availableDates={availableActiveLayerDates}
>
{activeLayerCompareTimeseries && (
<FormSwitch
id='compare-date-toggle'
name='compare-date-toggle'
value='compare-date-toggle'
checked={isComparing}
textPlacement='right'
onChange={() => setIsComparing((v) => !v)}
<PositionPlaceHolderForScroll />
<ScrollArea>
<ScrollAreaInner>
<DatesWrapper>
{activeLayerTimeseries && (
<PanelDateWidget
title='Date'
value={datePickerValue}
onConfirm={datePickerConfirm}
timeDensity={activeLayerTimeseries.timeDensity}
availableDates={availableActiveLayerDates}
>
Toggle date comparison
</FormSwitch>
{activeLayerCompareTimeseries && (
<FormSwitch
id='compare-date-toggle'
name='compare-date-toggle'
value='compare-date-toggle'
checked={isComparing}
textPlacement='right'
onChange={() => setIsComparing((v) => !v)}
>
Toggle date comparison
</FormSwitch>
)}
</PanelDateWidget>
)}
{isComparing && activeLayerCompareTimeseries && (
<PanelDateWidget
title='Date comparison'
value={datePickerCompareValue}
onConfirm={datePickerCompareConfirm}
timeDensity={activeLayerCompareTimeseries.timeDensity}
availableDates={availableActiveLayerCompareDates}
/>
)}
</PanelDateWidget>
)}
{isComparing && activeLayerCompareTimeseries && (
<PanelDateWidget
title='Date comparison'
value={datePickerCompareValue}
onConfirm={datePickerCompareConfirm}
timeDensity={activeLayerCompareTimeseries.timeDensity}
availableDates={availableActiveLayerCompareDates}
/>
)}
</DatesWrapper>
<PanelWidget>
<PanelWidgetHeader>
<PanelWidgetTitle>Layers</PanelWidgetTitle>
</PanelWidgetHeader>
<PanelWidgetBody>
<DatasetLayers
datasetId={dataset.data.id}
asyncLayers={asyncLayers}
selectedLayerId={selectedLayerId ?? undefined}
onAction={onLayerAction}
/>
</PanelWidgetBody>
</PanelWidget>
</DatesWrapper>
<PanelWidget id='panel-widget'>
<PanelWidgetHeader>
<PanelWidgetTitle>Layers</PanelWidgetTitle>
</PanelWidgetHeader>
<PanelWidgetBody>
<DatasetLayers
datasetId={dataset.data.id}
asyncLayers={asyncLayers}
selectedLayerId={selectedLayerId ?? undefined}
onAction={onLayerAction}
/>
</PanelWidgetBody>
</PanelWidget>
</ScrollAreaInner>
</ScrollArea>
</PanelBody>
</PanelInner>
</Panel>
Expand Down
1 change: 1 addition & 0 deletions app/scripts/styles/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export const PanelBody = styled.div`
display: flex;
flex-direction: column;
flex-grow: 1;
position:relative;
> div > div:nth-child(2),
> div > div:nth-child(3) {
Expand Down
Loading