This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
feat(Provider): set scrollbar styles #1223
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
23f3c87
feat(Provider): set scrollbar styles
layershifter b08a2de
fix CI
layershifter e405e70
add changelog entries
layershifter ec8c127
revert comment
layershifter 4859379
move styles to Teams theme
layershifter 588da2c
Merge branches 'feat/style-scrollbar' and 'master' of https://github.…
layershifter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
docs/src/examples/components/Provider/Types/ProviderExampleScrollbar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Image } from '@stardust-ui/react' | ||
import * as React from 'react' | ||
|
||
const ProviderExampleScrollbar = () => ( | ||
<div style={{ height: '100px', overflow: 'scroll' }}> | ||
<Image src="public/images/leaves/4.png" /> | ||
</div> | ||
) | ||
|
||
export default ProviderExampleScrollbar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import * as React from 'react' | ||
|
||
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection' | ||
import NonPublicSection from 'docs/src/components/ComponentDoc/NonPublicSection' | ||
|
||
const Types = () => ( | ||
<ExampleSection title="Types"> | ||
<ComponentExample | ||
title="Theme" | ||
description="A Provider defines the theme for your components." | ||
examplePath="components/Provider/Types/ProviderExample" | ||
/> | ||
</ExampleSection> | ||
<> | ||
<ExampleSection title="Types"> | ||
<ComponentExample | ||
title="Theme" | ||
description="A Provider defines the theme for your components." | ||
examplePath="components/Provider/Types/ProviderExample" | ||
/> | ||
</ExampleSection> | ||
<NonPublicSection title="Types for visual tests"> | ||
<ComponentExample examplePath="components/Provider/Types/ProviderExampleScrollbar" /> | ||
</NonPublicSection> | ||
</> | ||
) | ||
|
||
export default Types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/react/src/themes/teams/components/Provider/providerBoxStyles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ComponentStyleFunctionParam, ICSSInJSStyle } from '../../../types' | ||
import { ProviderBoxVariables } from './providerBoxVariables' | ||
|
||
export default { | ||
root: ({ | ||
variables: v, | ||
}: ComponentStyleFunctionParam<never, ProviderBoxVariables>): ICSSInJSStyle => ({ | ||
'& ::-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', | ||
}, | ||
}), | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/react/src/themes/teams/components/Provider/providerBoxVariables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { pxToRem } from '../../../../lib' | ||
import { ProviderBoxVariables as BaseProviderBoxVariables } from '../../../base/components/Provider/providerBoxVariables' | ||
|
||
export interface ProviderBoxVariables extends BaseProviderBoxVariables { | ||
scrollbarHeight: string | ||
scrollbarWidth: string | ||
|
||
scrollbarThumbBackgroundColor: string | ||
scrollbarThumbBorderRadius: string | ||
scrollbarThumbBorderSize: string | ||
|
||
scrollbarThumbHoverBackgroundColor: string | ||
scrollbarThumbHoverBorderSize: string | ||
} | ||
|
||
export default (siteVariables): Partial<ProviderBoxVariables> => ({ | ||
scrollbarHeight: pxToRem(16), | ||
scrollbarWidth: pxToRem(16), | ||
|
||
scrollbarThumbBackgroundColor: siteVariables.gray06, | ||
scrollbarThumbBorderRadius: pxToRem(9), | ||
scrollbarThumbBorderSize: pxToRem(4), | ||
|
||
scrollbarThumbHoverBackgroundColor: siteVariables.gray04, | ||
scrollbarThumbHoverBorderSize: pxToRem(2), | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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... :\