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

Remove shadow scroll #691

Merged
merged 5 commits into from
Oct 5, 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
21 changes: 5 additions & 16 deletions app/scripts/components/common/dropdown-scrollable.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, ReactNode } from 'react';
import React, { forwardRef } from 'react';
import styled from 'styled-components';
import { glsp } from '@devseed-ui/theme-provider';
import {
Expand All @@ -9,14 +9,14 @@ import {
DropTitle
} from '@devseed-ui/dropdown';

import { ShadowScrollbarImproved as ShadowScrollbar } from '$components/common/shadow-scrollbar-improved';

/**
* Override Dropdown styles to play well with the shadow scrollbar.
*/
const DropdownWithScroll = styled(Dropdown)`
padding: 0;
overflow: hidden;
max-height: 320px;
overflow-y: auto;

${DropTitle} {
margin: 0;
Expand All @@ -28,23 +28,12 @@ const DropdownWithScroll = styled(Dropdown)`
}
`;

const shadowScrollbarProps = {
autoHeight: true,
autoHeightMax: 320
};

interface DropdownScrollableProps extends DropdownProps {
children?: ReactNode;
}

export default forwardRef<DropdownRef, DropdownScrollableProps>(
export default forwardRef<DropdownRef, DropdownProps>(
function DropdownScrollable(props, ref) {
const { children, ...rest } = props;
return (
<DropdownWithScroll ref={ref} {...rest}>
<ShadowScrollbar scrollbarsProps={shadowScrollbarProps}>
{children}
</ShadowScrollbar>
{children}
</DropdownWithScroll>
);
}
Expand Down
16 changes: 5 additions & 11 deletions app/scripts/components/common/mapbox/layer-legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import {
WidgetItemHGroup
} from '$styles/panel';

import { ShadowScrollbarImproved as ShadowScrollbar } from '$components/common/shadow-scrollbar-improved';

interface LayerLegendCommonProps {
id: string;
title: string;
Expand Down Expand Up @@ -198,7 +196,9 @@ const LayerLegendTitle = styled.h3`

const LegendBody = styled(WidgetItemBodyInner)`
padding: 0;

min-height: 32px;
max-height: 120px;
overflow-y: auto;
.scroll-inner {
padding: ${variableGlsp(0.5, 0.75)};
}
Expand Down Expand Up @@ -252,17 +252,11 @@ export function LayerLegend(
)}
renderBody={() => (
<LegendBody>
<ShadowScrollbar
scrollbarsProps={{
autoHeight: true,
autoHeightMin: 32,
autoHeightMax: 120
}}
>

hanbyul-here marked this conversation as resolved.
Show resolved Hide resolved
<div className='scroll-inner'>
{description || <p>No info available for this layer.</p>}
</div>
</ShadowScrollbar>

</LegendBody>
)}
/>
Expand Down
13 changes: 4 additions & 9 deletions app/scripts/components/common/mapbox/map-options/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ import { MapOptionsProps } from './types';
import { projectionsList } from './utils';
import { BASEMAP_STYLES } from './basemaps';

import { ShadowScrollbarImproved as ShadowScrollbar } from '$components/common/shadow-scrollbar-improved';

const DropHeader = styled.div`
padding: ${glsp()};
box-shadow: inset 0 -1px 0 0 ${themeVal('color.base-100a')};
`;

const DropBody = styled.div`
padding: ${glsp(0, 0, 1, 0)};
max-height: 320px;
overflow-y: auto;
`;

/**
Expand Down Expand Up @@ -64,11 +64,6 @@ const SelectorButton = styled(Button)`
}
`;

const shadowScrollbarProps = {
autoHeight: true,
autoHeightMax: 320
};

const ContentGroup = styled.div`
display: flex;
flex-flow: column nowrap;
Expand Down Expand Up @@ -143,7 +138,7 @@ function MapOptions(props: MapOptionsProps) {
<DropTitle>Map options</DropTitle>
</DropHeader>
<DropBody>
<ShadowScrollbar scrollbarsProps={shadowScrollbarProps}>

<ContentGroup>
<ContentGroupHeader>
<ContentGroupTitle>Style</ContentGroupTitle>
Expand Down Expand Up @@ -258,7 +253,7 @@ function MapOptions(props: MapOptionsProps) {
</DropMenu>
</ContentGroupBody>
</ContentGroup>
</ShadowScrollbar>

</DropBody>
</MapOptionsDropdown>
);
Expand Down
16 changes: 11 additions & 5 deletions app/scripts/components/common/page-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from '@devseed-ui/theme-provider';
import { reveal } from '@devseed-ui/animation';
import { Heading, Overline } from '@devseed-ui/typography';
import { ShadowScrollbar } from '@devseed-ui/shadow-scrollbar';
import { Button } from '@devseed-ui/button';
import {
CollecticonEllipsisVertical,
Expand Down Expand Up @@ -214,6 +213,9 @@ const GlobalNavInner = styled.div`
const GlobalNavHeader = styled.div`
padding: ${variableGlsp(1)};
box-shadow: inset 0 -1px 0 0 ${themeVal('color.surface-200a')};
${media.largeUp`
display: none;
`}
`;

const GlobalNavTitle = styled(Heading).attrs({
Expand All @@ -225,16 +227,16 @@ const GlobalNavTitle = styled(Heading).attrs({

export const GlobalNavActions = styled.div`
align-self: start;
${media.largeUp`
display: none;
`}
`;

export const GlobalNavToggle = styled(Button)`
z-index: 2000;
`;

const GlobalNavBody = styled(ShadowScrollbar).attrs({
topShadowVariation: 'dark',
bottomShadowVariation: 'dark'
})`
const GlobalNavBody = styled.div`
display: flex;
flex: 1;

Expand Down Expand Up @@ -339,6 +341,10 @@ function PageHeader() {

useEffect(() => {
// Close global nav when media query changes.
// NOTE: isMediumDown is returning document.body's width, not the whole window width
// which conflicts with how mediaquery decides the width.
// JSX element susing isMediumDown is also protected with css logic because of this.
// ex. Look at GlobalNavActions
if (!isMediumDown) setGlobalNavRevealed(false);
}, [isMediumDown]);

Expand Down
3 changes: 1 addition & 2 deletions app/scripts/components/common/page-local-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { reveal } from '@devseed-ui/animation';
import { Overline } from '@devseed-ui/typography';
import { DropMenu, DropMenuItem } from '@devseed-ui/dropdown';
import { ShadowScrollbar } from '@devseed-ui/shadow-scrollbar';

import DropdownScrollable from './dropdown-scrollable';

Expand Down Expand Up @@ -57,7 +56,7 @@ const LocalBreadcrumb = styled.ol`
}
`;

const NavBlock = styled(ShadowScrollbar)`
const NavBlock = styled.div`
display: flex;
align-items: center;
flex-flow: row nowrap;
Expand Down
41 changes: 0 additions & 41 deletions app/scripts/components/common/shadow-scrollbar-improved.tsx

This file was deleted.

4 changes: 1 addition & 3 deletions app/scripts/styles/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { Button } from '@devseed-ui/button';
import { variableGlsp } from './variable-utils';
import { VarProse } from './variable-components';

import { ShadowScrollbarImproved as ShadowScrollbar } from '$components/common/shadow-scrollbar-improved';

const panelWidth = {
xsmall: '20rem',
small: '22rem',
Expand Down Expand Up @@ -103,7 +101,7 @@ export const PanelToggle = styled(Button)`
left: calc(100% + ${variableGlsp()});
`;

export const PanelBody = styled(ShadowScrollbar)`
export const PanelBody = styled.div`
display: flex;
flex-direction: column;
flex-grow: 1;
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"@devseed-ui/form": "4.1.0",
"@devseed-ui/global-loading": "4.1.0",
"@devseed-ui/modal": "^4.1.0",
"@devseed-ui/shadow-scrollbar": "4.1.0",
"@devseed-ui/theme-provider": "4.1.0",
"@devseed-ui/toolbar": "4.1.0",
"@devseed-ui/typography": "4.1.0",
Expand Down
Loading
Loading