-
Notifications
You must be signed in to change notification settings - Fork 55
feat(Provider): set scrollbar styles #1223
Changes from 4 commits
23f3c87
b08a2de
e405e70
ec8c127
4859379
588da2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
import { ICSSInJSStyle } from '../../../types' | ||
import { ComponentStyleFunctionParam, ICSSInJSStyle } from '../../../types' | ||
import { ProviderBoxVariables } from './providerBoxVariables' | ||
|
||
export default { | ||
root: ({ variables: v }): ICSSInJSStyle => ({ | ||
root: ({ | ||
variables: v, | ||
}: ComponentStyleFunctionParam<never, ProviderBoxVariables>): ICSSInJSStyle => ({ | ||
background: v.background, | ||
color: v.color, | ||
textAlign: 'left', | ||
|
||
'& ::-webkit-scrollbar': { | ||
height: v.scrollbarHeight, | ||
width: v.scrollbarWidth, | ||
|
||
':disabled': { | ||
display: 'none', | ||
}, | ||
}, | ||
'& ::-webkit-scrollbar-thumb': { | ||
borderRadius: v.scrollbarThumbBorderRadius, | ||
border: `solid ${v.scrollbarThumbBorderSize} transparent`, | ||
backgroundClip: 'content-box', | ||
backgroundColor: v.scrollbarThumbBackgroundColor, | ||
|
||
':hover': { | ||
backgroundColor: v.scrollbarThumbHoverBackgroundColor, | ||
border: `solid ${v.scrollbarThumbHoverBorderSize} transparent`, | ||
}, | ||
}, | ||
'& ::-webkit-scrollbar-track': { | ||
background: 'transparent', | ||
}, | ||
}), | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
import { pxToRem } from '../../../../lib' | ||
|
||
export interface ProviderBoxVariables { | ||
background: string | ||
color: string | ||
|
||
scrollbarHeight: string | ||
scrollbarWidth: string | ||
|
||
scrollbarThumbBackgroundColor: string | ||
scrollbarThumbBorderRadius: string | ||
scrollbarThumbBorderSize: string | ||
|
||
scrollbarThumbHoverBackgroundColor: string | ||
scrollbarThumbHoverBorderSize: string | ||
} | ||
|
||
export default (siteVariables): ProviderBoxVariables => ({ | ||
background: siteVariables.bodyBackground, | ||
color: siteVariables.bodyColor, | ||
|
||
scrollbarHeight: pxToRem(16), | ||
scrollbarWidth: pxToRem(16), | ||
|
||
scrollbarThumbBackgroundColor: siteVariables.gray06, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, base theme doesn't have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely, I initially overlooked the path of styles, now they are in correct place. P.S. Motivation to add them only to Teams theme:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would really love to see this as part of base theme, but I see your points. Let's think about this in the future. The base theme's provider should have custom scrollbar by default, at least in my opinion. Agreed that we should have way of enabling or disabling this behavior as well. The main reason for this is that, I don't see much different ways of defining the scrollbar, more over we can customize it trough it's variables. |
||
scrollbarThumbBorderRadius: pxToRem(9), | ||
scrollbarThumbBorderSize: pxToRem(4), | ||
|
||
scrollbarThumbHoverBackgroundColor: siteVariables.gray04, | ||
scrollbarThumbHoverBorderSize: pxToRem(2), | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
;
cruft?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope and this is sad: prettier/prettier#4630 😭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://stardust-ui.github.io/react/shorthand-props
The same case, actually 😨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, just to mention I hate this, especially that we are not using
;
at all... Sad day for me :DThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even worse with the provided example, it is used in our guides... :\