Skip to content

Commit

Permalink
fix: horizontal scroll in views (#1830)
Browse files Browse the repository at this point in the history
  • Loading branch information
kanikabansal-juspay authored Dec 4, 2024
1 parent 64c8647 commit b017689
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/FilterSelectBox.res
Original file line number Diff line number Diff line change
Expand Up @@ -1919,7 +1919,7 @@ module BaseDropdown = {
selectButton
}}
<div
className="p-1 hover:bg-gray-200 cursor-pointer border-l-2 pl-2.5 "
className="p-1 hover:bg-gray-200 cursor-pointer border-l-2 "
onClick={_ => newInputSelect.name->onDeleteClick}>
<Icon size={13} name="cross-outline" />
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/LoadedTable.res
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ let make = (
~nonFrozenTableParentClass="",
~loadedTableParentClass="",
~remoteSortEnabled=false,
~showAutoScroll=false,
) => {
open LogicUtils
let showPopUp = PopUpState.useShowPopUp()
Expand Down Expand Up @@ -828,6 +829,7 @@ let make = (
?showborderColor
tableHeadingTextClass
nonFrozenTableParentClass
showAutoScroll
/>
switch tableLocalFilter {
| true =>
Expand Down
1 change: 1 addition & 0 deletions src/components/LoadedTable.resi
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,5 @@ let make: (
~nonFrozenTableParentClass: string=?,
~loadedTableParentClass: string=?,
~remoteSortEnabled: bool=?,
~showAutoScroll: bool=?,
) => React.element
2 changes: 2 additions & 0 deletions src/components/LoadedTableWithCustomColumns.res
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ let make = (
~noScrollbar=false,
~previewOnly=false,
~remoteSortEnabled=false,
~showAutoScroll=false,
) => {
let (showColumnSelector, setShowColumnSelector) = React.useState(() => false)
let activeColumnsAtom = customColumnMapper->Some
Expand Down Expand Up @@ -151,5 +152,6 @@ let make = (
?setExtFilteredDataLength
noScrollbar
remoteSortEnabled
showAutoScroll
/>
}
39 changes: 24 additions & 15 deletions src/components/Table.res
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ let make = (
~showborderColor=true,
~tableHeadingTextClass="",
~nonFrozenTableParentClass="",
~showAutoScroll=false,
) => {
let isMobileView = MatchMedia.useMobileChecker()
let rowInfo: array<array<cell>> = rows
Expand Down Expand Up @@ -888,22 +889,30 @@ let make = (
? ""
: "overflow-scroll"
let parentBorderRadius = !isHighchartLegend ? "rounded-lg" : ""
let sidebarScrollbarCss = `
@supports (-webkit-appearance: none) {
.sidebar-scrollbar {
scrollbar-color: #8a8c8f;
}
let tableScrollbarCss = `
@supports (-webkit-appearance: none) {
.table-scrollbar {
scrollbar-width: auto;
scrollbar-color: #8a8c8f;
}
.sidebar-scrollbar::-webkit-scrollbar-thumb {
background-color: #8a8c8f;
border-radius: 3px;
}
.table-scrollbar::-webkit-scrollbar {
display: block;
height: 4px;
width: 5px;
}
.sidebar-scrollbar::-webkit-scrollbar-track {
display: none;
}
}
.table-scrollbar::-webkit-scrollbar-thumb {
background-color: #8a8c8f;
border-radius: 3px;
}
.table-scrollbar::-webkit-scrollbar-track {
display:none;
}
}
`
let autoscrollcss = showAutoScroll ? "table-scrollbar" : ""
<div
className={`flex flex-row items-stretch ${scrollBarClass} loadedTable ${parentMinWidthClass} ${customBorderClass->Option.getOr(
parentBorderRadius,
Expand All @@ -920,9 +929,9 @@ let make = (
} //replaced "overflow-auto" -> to be tested with master
>
<RenderIf condition={frozenUpto > 0}> {frozenTable} </RenderIf>
<style> {React.string(sidebarScrollbarCss)} </style>
<style> {React.string(tableScrollbarCss)} </style>
<div
className={`flex-1 ${overflowClass} no-scrollbar ${childMinWidthClass} ${nonFrozenTableParentClass} sidebar-scrollbar`}>
className={`flex-1 ${overflowClass} no-scrollbar ${childMinWidthClass} ${nonFrozenTableParentClass} ${autoscrollcss} `}>
nonFrozenTable
</div>
{switch customizeColumnNewTheme {
Expand Down
1 change: 1 addition & 0 deletions src/components/Table.resi
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,5 @@ let make: (
~showborderColor: bool=?,
~tableHeadingTextClass: string=?,
~nonFrozenTableParentClass: string=?,
~showAutoScroll: bool=?,
) => React.element
1 change: 1 addition & 0 deletions src/screens/Customers/Customers.res
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ let make = () => {
customColumnMapper={TableAtoms.customersMapDefaultCols}
showSerialNumberInCustomizeColumns=false
sortingBasedOnDisabled=false
showAutoScroll=true
/>
</PageLoaderWrapper>
}
1 change: 1 addition & 0 deletions src/screens/Disputes/Disputes.res
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ let make = () => {
customColumnMapper={TableAtoms.disputesMapDefaultCols}
showSerialNumberInCustomizeColumns=false
sortingBasedOnDisabled=false
showAutoScroll=true
/>
</div>
</PageLoaderWrapper>
Expand Down
1 change: 1 addition & 0 deletions src/screens/Order/Orders.res
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ let make = (~previewOnly=false) => {
hideTitle=true
previewOnly
remoteSortEnabled=true
showAutoScroll=true
/>
</PageLoaderWrapper>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/screens/Payouts/PayoutsList.res
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ let make = () => {
customColumnMapper=TableAtoms.payoutsMapDefaultCols
showSerialNumberInCustomizeColumns=false
sortingBasedOnDisabled=false
showAutoScroll=true
/>
</PageLoaderWrapper>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/screens/Refunds/Refund.res
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ let make = () => {
customColumnMapper=TableAtoms.refundsMapDefaultCols
showSerialNumberInCustomizeColumns=false
sortingBasedOnDisabled=false
showAutoScroll=true
/>
</PageLoaderWrapper>
</div>
Expand Down

0 comments on commit b017689

Please sign in to comment.