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

fix: update scrollbar style #8661

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
update scrollbars globally
  • Loading branch information
akash-codemonk committed Oct 20, 2021
commit 6e39e837c73811c81eb073df16f0951dadd66706
9 changes: 7 additions & 2 deletions app/client/src/comments/AppComments/AppCommentThreads.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useMemo } from "react";
import React, { useEffect, useMemo, useRef } from "react";
import { useDispatch, useSelector } from "react-redux";
import styled from "styled-components";

Expand All @@ -24,13 +24,16 @@ import { setShouldShowResolvedComments } from "actions/commentActions";
import { useSelectCommentThreadUsingQuery } from "../inlineComments/Comments";
import { Toaster } from "components/ads/Toast";
import { Variant } from "components/ads/common";
import ScrollIndicator from "components/ads/ScrollIndicator";
import { COMMENT_HAS_BEEN_DELETED, createMessage } from "constants/messages";
import { hideScrollbar } from "constants/DefaultTheme";

const Container = styled.div`
display: flex;
flex-direction: column;
flex: 1;
overflow: auto;
${hideScrollbar};
`;

export const useSortedCommentThreadIds = (commentThreadIds: string[]) => {
Expand Down Expand Up @@ -72,6 +75,7 @@ function AppCommentThreads() {
applicationCommentsSelector(applicationId),
);
const appCommentThreadIds = getAppCommentThreads(appCommentThreadsByRefMap);
const containerRef = useRef<HTMLDivElement>(null);

const commentThreadIds = useSortedCommentThreadIds(appCommentThreadIds);

Expand Down Expand Up @@ -100,7 +104,7 @@ function AppCommentThreads() {
}, [commentThreadIdFromUrl, appCommentThreadsFetched]);

return (
<Container>
<Container ref={containerRef}>
{commentThreadIds.length > 0 && (
<Virtuoso
data={commentThreadIds}
Expand All @@ -121,6 +125,7 @@ function AppCommentThreads() {
/>
)}
{commentThreadIds.length === 0 && <AppCommentsPlaceholder />}
<ScrollIndicator containerRef={containerRef} />
</Container>
);
}
Expand Down
21 changes: 21 additions & 0 deletions app/client/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,24 @@ div.bp3-popover-arrow {
.bp3-modal-widget .bp3-portal {
z-index: 21 !important;
}

/* To hide vertical scrollbar on deployed page */
body::-webkit-scrollbar {
width: 0px;
}

::-webkit-scrollbar {
width: 4px;
height: 4px;
}
::-webkit-scrollbar-track {
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: rgba(75,72,72,0.5);
border-radius: 10px;
visibility: hidden;
}
:hover::-webkit-scrollbar-thumb {
visibility: visible;
}
16 changes: 13 additions & 3 deletions app/client/src/pages/Editor/PropertyPane/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import React, { Component, ReactElement, useCallback, useMemo } from "react";
import React, {
Component,
ReactElement,
useCallback,
useMemo,
useRef,
} from "react";
import { connect, useDispatch, useSelector } from "react-redux";
import { AppState } from "reducers";
import {
Expand All @@ -10,7 +16,7 @@ import { PanelStack, IPanel, Classes, IPanelProps } from "@blueprintjs/core";
import Popper from "pages/Editor/Popper";
import { generateClassName } from "utils/generators";
import { ReduxActionTypes } from "constants/ReduxActionConstants";
import styled from "constants/DefaultTheme";
import styled, { hideScrollbar } from "constants/DefaultTheme";
import { WidgetProps } from "widgets/BaseWidget";
import PropertyPaneTitle from "pages/Editor/PropertyPaneTitle";
import AnalyticsUtil from "utils/AnalyticsUtil";
Expand All @@ -33,6 +39,7 @@ import { Layers } from "constants/Layers";
import ConnectDataCTA, { actionsExist } from "./ConnectDataCTA";
import PropertyPaneConnections from "./PropertyPaneConnections";
import { WidgetType } from "constants/WidgetConstants";
import ScrollIndicator from "components/ads/ScrollIndicator";

const PropertyPaneWrapper = styled(PaneWrapper)<{
themeMode?: EditorTheme;
Expand Down Expand Up @@ -90,6 +97,7 @@ export const PropertyPaneBodyWrapper = styled.div`
(props.theme.propertyPane.titleHeight +
props.theme.propertyPane.connectionsHeight)}px;
overflow: auto;
${hideScrollbar};
`;

// TODO(abhinav): The widget should add a flag in their configuration if they donot subscribe to data
Expand Down Expand Up @@ -131,6 +139,7 @@ function PropertyPaneView(
dispatch(deleteSelectedWidget(false));
}, [dispatch]);
const handleCopy = useCallback(() => dispatch(copyWidget(false)), [dispatch]);
const propertyPaneBodyRef = useRef<HTMLDivElement>(null);

const actions = useMemo((): Array<{
tooltipContent: any;
Expand Down Expand Up @@ -191,7 +200,7 @@ function PropertyPaneView(
widgetId={widgetProperties.widgetId}
widgetType={widgetProperties?.type}
/>
<PropertyPaneBodyWrapper>
<PropertyPaneBodyWrapper ref={propertyPaneBodyRef}>
{!doActionsExist && !hideConnectDataCTA && (
<ConnectDataCTA
widgetId={widgetProperties.widgetId}
Expand All @@ -207,6 +216,7 @@ function PropertyPaneView(
type={widgetProperties.type}
/>
</PropertyControlsWrapper>
<ScrollIndicator containerRef={propertyPaneBodyRef} top="65px" />
</PropertyPaneBodyWrapper>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ export const TableWrapper = styled.div<{
height: 4px !important;
border-radius: ${(props) => props.theme.radii[3]}px;
background: ${(props) => props.theme.colors.scrollbarLight} !important;
visibility: hidden;
&:hover {
height: 6px !important;
}
}
&:hover {
.thumb-horizontal {
visibility: visible;
}
}
}
.table {
border-spacing: 0;
Expand Down Expand Up @@ -487,10 +493,16 @@ export const TableHeaderWrapper = styled.div<{
height: 4px !important;
border-radius: ${(props) => props.theme.radii[3]}px;
background: ${(props) => props.theme.colors.scrollbarLight};
visibility: hidden;
&:hover {
height: 6px !important;
}
}
&:hover {
.thumb-horizontal {
visibility: visible;
}
}
`;

export const TableHeaderInnerWrapper = styled.div<{
Expand Down