Skip to content

Commit

Permalink
Add styles to make panel scrollable
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbyul-here committed Oct 5, 2023
1 parent dbb3e22 commit 2d0a44d
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 46 deletions.
124 changes: 78 additions & 46 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 PositionPlaceHoderForScroll = 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 @@ -557,7 +584,7 @@ function DatasetsExplore() {
}}
hideFooter
/>
<PageMainContent>
<PageMainContent id='page-main-content'>
<PageHero title={`${dataset.data.name} Exploration`} isHidden />
<Explorer>
<Panel revealed={panelRevealed} onClick={onPanelClick}>
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)}
<PositionPlaceHoderForScroll />
<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

0 comments on commit 2d0a44d

Please sign in to comment.