Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Adds prop to control scrollbar visibility (#180)
Browse files Browse the repository at this point in the history
Co-authored-by: Tiago Peres França <[email protected]>
  • Loading branch information
hectorcustodiozup and Tiagoperes authored Feb 19, 2021
1 parent 0c92726 commit e6a67de
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/beagle-react/src/components/BeagleListView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const BeagleListView: FC<BeagleListViewInterface> = ({
useParentScroll = false,
_key,
__suffix__,
isScrollIndicatorVisible = true,
accessibility,
}) => {
const elementRef = useRef() as React.MutableRefObject<HTMLDivElement>
Expand Down Expand Up @@ -90,6 +91,7 @@ const BeagleListView: FC<BeagleListViewInterface> = ({
direction={direction}
useParentScroll={useParentScroll}
style={style}
isScrollIndicatorVisible = {isScrollIndicatorVisible}
{
...({ [direction === 'VERTICAL' ?
'aria-rowcount' : 'aria-colcount']: Children.count(children) || 0 })
Expand Down
7 changes: 7 additions & 0 deletions packages/beagle-react/src/components/BeagleListView/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Direction } from 'common/models'
interface StyledListViewInterface {
direction: Direction,
useParentScroll?: boolean,
isScrollIndicatorVisible?: boolean,
}

export const StyledListView = styled.div<StyledListViewInterface>`
Expand All @@ -28,4 +29,10 @@ export const StyledListView = styled.div<StyledListViewInterface>`
overflow: ${({ useParentScroll }) => useParentScroll ? 'inherit' : 'auto'};
width: ${({ direction }) => direction === 'HORIZONTAL' ? '100%' : 'auto'};
height: ${({ direction }) => direction === 'VERTICAL' ? '100%' : 'auto'};
& ::-webkit-scrollbar {
display: ${({ isScrollIndicatorVisible }) => isScrollIndicatorVisible ? 'auto' : 'none'};
}
-ms-overflow-style: ${({ isScrollIndicatorVisible }) => isScrollIndicatorVisible ?
'auto' : 'none'};
scrollbar-width: ${({ isScrollIndicatorVisible }) => isScrollIndicatorVisible ? 'auto' : 'none'};
`
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface BeagleListViewInterface extends BeagleDefaultComponent, BeagleC
Beagle receives "key", it transforms it into "_key" */
_key?: string,
__suffix__?: string,
isScrollIndicatorVisible?: boolean,
}

export interface ScrollInterface {
Expand Down

0 comments on commit e6a67de

Please sign in to comment.