forked from carbon-design-system/ibm-products
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ScrollGradient): new component ScrollGradient (carbon-design-sys…
…tem#4446) * Initial checkin... WIP * WIP * WIP * WIP * Continued work in progress - pre four side work. * Working to get gradients to display without a directional prop * Gradients z-indexed properly Broke gradients up into 4 divs Added inline styling to accomodate for the gradient as well as positioning due to scroll bars. * Updated the docs Updated the stories to look better * Simplified the docs code sample * Tests running * Added styling to story * Added a style to accomodate stories in Docs page * fix: code changes per pr review --------- Co-authored-by: elysia <[email protected]>
- Loading branch information
1 parent
ade8310
commit 75e1622
Showing
21 changed files
with
735 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
examples/carbon-for-ibm-products/ScrollGradient/gallery.config.json
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,12 @@ | ||
{ | ||
"label": "Scroll-Gradient", | ||
"package-config": { | ||
"flags": { | ||
"component": { | ||
"ScrollGradient": true | ||
} | ||
} | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {} | ||
} |
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,4 @@ | ||
{ | ||
"name": "ScrollGradient-component-example", | ||
"note": "Run `update-gallery-config to generate." | ||
} |
19 changes: 19 additions & 0 deletions
19
examples/carbon-for-ibm-products/ScrollGradient/src/Example/Example.jsx
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,19 @@ | ||
// cspell:words grafana | ||
|
||
import React from 'react'; | ||
|
||
// ---------------------------------------------------- | ||
// This is an example showing use of the | ||
// AboutModal component | ||
// from the @carbon/ibm-products component library. | ||
// ---------------------------------------------------- | ||
|
||
import { ScrollGradient } from '@carbon/ibm-products'; | ||
|
||
import './_example.scss'; | ||
|
||
export const Example = () => { | ||
return <ScrollGradient />; | ||
}; | ||
|
||
export default Example; |
3 changes: 3 additions & 0 deletions
3
examples/carbon-for-ibm-products/ScrollGradient/src/Example/_example.scss
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,3 @@ | ||
@use '@carbon/react/scss/spacing' as *; | ||
|
||
/* example SCSS */ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
packages/ibm-products-styles/src/components/ScrollGradient/_carbon-imports.scss
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,9 @@ | ||
// | ||
// Copyright IBM Corp. 2024, 2024 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
// Import any Carbon component styles used from ScrollGradient in this file. | ||
// ScrollGradient uses the following Carbon components: |
9 changes: 9 additions & 0 deletions
9
packages/ibm-products-styles/src/components/ScrollGradient/_index-with-carbon.scss
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,9 @@ | ||
// | ||
// Copyright IBM Corp. 2024, 2024 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@use './carbon-imports'; | ||
@use './scroll-gradient'; |
8 changes: 8 additions & 0 deletions
8
packages/ibm-products-styles/src/components/ScrollGradient/_index.scss
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,8 @@ | ||
// | ||
// Copyright IBM Corp. 2024, 2024 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
@use './scroll-gradient'; |
102 changes: 102 additions & 0 deletions
102
packages/ibm-products-styles/src/components/ScrollGradient/_scroll-gradient.scss
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,102 @@ | ||
// | ||
// Copyright IBM Corp. 2024, 2024 | ||
// | ||
// This source code is licensed under the Apache-2.0 license found in the | ||
// LICENSE file in the root directory of this source tree. | ||
// | ||
|
||
// Standard imports. | ||
@use '../../global/styles/project-settings' as c4p-settings; | ||
@use '../../global/styles/mixins'; | ||
@use '@carbon/styles/scss/motion' as *; | ||
@use '@carbon/styles/scss/spacing' as *; | ||
|
||
$block-class: #{c4p-settings.$pkg-prefix}--scroll-gradient; | ||
|
||
.#{$block-class} { | ||
position: relative; | ||
display: flex; | ||
width: inherit; | ||
height: inherit; | ||
align-items: stretch; | ||
justify-content: stretch; | ||
} | ||
.#{$block-class}__content { | ||
overflow: auto; | ||
width: 100%; | ||
height: inherit; | ||
} | ||
|
||
.#{$block-class}__content-children { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
// All gradients | ||
.#{$block-class}__start-vertical, | ||
.#{$block-class}__start-horizontal, | ||
.#{$block-class}__end-vertical, | ||
.#{$block-class}__end-horizontal { | ||
position: absolute; | ||
z-index: 1; | ||
display: none; | ||
pointer-events: none; | ||
} | ||
|
||
// Vertical start | ||
.#{$block-class}--y-scrollable .#{$block-class}__start-vertical { | ||
top: 0; | ||
left: 0; | ||
height: $spacing-09; | ||
} | ||
// Vertical end | ||
.#{$block-class}--y-scrollable .#{$block-class}__end-vertical { | ||
bottom: 0; | ||
left: 0; | ||
height: $spacing-09; | ||
} | ||
|
||
// Horizontal start | ||
.#{$block-class}--x-scrollable .#{$block-class}__start-horizontal { | ||
top: 0; | ||
left: 0; | ||
width: $spacing-09; | ||
} | ||
|
||
// Horizontal end | ||
.#{$block-class}--x-scrollable .#{$block-class}__end-horizontal { | ||
top: 0; | ||
right: 0; | ||
width: $spacing-09; | ||
} | ||
|
||
// Vertical start states | ||
.#{$block-class}--y-started.#{$block-class}--y-scrollable | ||
.#{$block-class}__start-vertical, | ||
.#{$block-class}--y-end.#{$block-class}--y-scrollable | ||
.#{$block-class}__start-vertical { | ||
display: block; | ||
} | ||
|
||
// Vertical end states | ||
.#{$block-class}--y-initial.#{$block-class}--y-scrollable | ||
.#{$block-class}__end-vertical, | ||
.#{$block-class}--y-started.#{$block-class}--y-scrollable | ||
.#{$block-class}__end-vertical { | ||
display: block; | ||
} | ||
|
||
// Horizontal start states | ||
.#{$block-class}--x-started.#{$block-class}--x-scrollable | ||
.#{$block-class}__start-horizontal, | ||
.#{$block-class}--x-end.#{$block-class}--x-scrollable | ||
.#{$block-class}__start-horizontal { | ||
display: block; | ||
} | ||
|
||
// Horizontal end states | ||
.#{$block-class}--x-initial.#{$block-class}--x-scrollable | ||
.#{$block-class}__end-horizontal, | ||
.#{$block-class}--x-started.#{$block-class}--x-scrollable | ||
.#{$block-class}__end-horizontal { | ||
display: block; | ||
} |
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
Oops, something went wrong.