-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gradient): linear gradient mixin (#15081)
* feat(gradient): add linear gradient mixin * feat(gradient): add gradient tokens, update demo story * fix(gradient): change default direction * chore(snapshot): update snapshots * refactor(Gradient): use color tokens, update token names * test(snapshot): update snapshots * docs(ai-gradient): mark mixin experimental, update year * chore(storybook): remove test story
- Loading branch information
Showing
11 changed files
with
97 additions
and
4 deletions.
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
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,42 @@ | ||
// | ||
// Copyright IBM Corp. 2023 | ||
// | ||
// 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 '../theme'; | ||
|
||
/// Experimental - name and structure subject to change. Use at your own risk! | ||
/// Adds AI gradient styles to a component | ||
/// @access public | ||
/// @param {String} $direction - Direction of gradient from: `left`, `right`, `top`, and `bottom` | ||
/// @param {Number} $width - Percentage width of gradient with regards to parent component | ||
/// @example @include focus-outline('outline'); | ||
/// @group utilities | ||
|
||
@mixin ai-gradient($direction: 'right', $width: 50%) { | ||
$deg: 0; | ||
@if $direction == 'bottom' { | ||
$deg: 0deg; | ||
} @else if $direction == 'left' { | ||
$deg: 90deg; | ||
} @else if $direction == 'top' { | ||
$deg: 180deg; | ||
} @else if $direction == 'right' { | ||
$deg: 270deg; | ||
} | ||
|
||
background-image: linear-gradient( | ||
$deg, | ||
theme.$ai-gradient-start-01 0%, | ||
theme.$ai-gradient-end $width, | ||
transparent 100% | ||
), | ||
linear-gradient( | ||
$deg, | ||
theme.$ai-gradient-start-02 0%, | ||
theme.$ai-gradient-end $width, | ||
transparent 100% | ||
); | ||
} |
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
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
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