-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(skeleton-text): add recipe and tokens #31210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
047b04b
feat(skeleton-text): add recipe and tokens
thetaPC 37d82d5
refactor(skeleton-text): minor improvements
thetaPC 8c11f5a
test(skeleton-text): add more tests and minor changes
thetaPC 17cdf03
test(skeleton-text): update basic snapshots
thetaPC a23031f
Merge branch 'ionic-modular' of github.com:ionic-team/ionic-framework…
thetaPC 0ed659d
refactor(skeleton-text): add vars file
thetaPC 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
core/src/components/skeleton-text/skeleton-text.interface.ts
|
Contributor
Author
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 decided to split the background into two states and also introduced alpha. This would allow further flexibility for devs to customize their skeletons. |
This file contains hidden or 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 type { IonMargin } from '../../themes/themes.interfaces'; | ||
|
|
||
| export type IonSkeletonTextRecipe = { | ||
| animated?: { | ||
| background?: { | ||
| /** Opacity of the animated shimmer highlight, from 0 to 1. */ | ||
| alpha?: string | number; | ||
|
|
||
| /** Highlight color of the animated shimmer, in RGB format (e.g. `255, 0, 0`). */ | ||
| rgb?: string; | ||
| }; | ||
| }; | ||
|
|
||
| border?: { | ||
| radius?: string; | ||
| }; | ||
|
|
||
| default?: { | ||
| background?: { | ||
| /** Opacity of the background when it's not being animated, from 0 to 1. */ | ||
| alpha?: string | number; | ||
|
|
||
| /** Background color when it's not being animated in RGB format (e.g. `255, 0, 0`), also the base of the animated shimmer. */ | ||
| rgb?: string; | ||
| }; | ||
| }; | ||
|
|
||
| lineHeight?: string; | ||
|
|
||
| margin?: Omit<IonMargin, 'end' | 'start'>; | ||
| }; |
This file contains hidden or 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 hidden or 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
29 changes: 14 additions & 15 deletions
29
core/src/components/skeleton-text/skeleton-text.vars.scss
This file contains hidden or 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,19 +1,18 @@ | ||
| @import "../../themes/native/native.globals"; | ||
| // RGB fallback used when no theme provides the skeleton's background | ||
| $background-rgb-fallback: var(--ion-text-color-rgb, 0, 0, 0); | ||
|
|
||
| // Skeleton Text | ||
| // -------------------------------------------------- | ||
| // Alpha fallbacks, used when no theme provides them | ||
| $default-alpha-fallback: 0.065; | ||
| $animated-alpha-fallback: 0.135; | ||
|
|
||
| /// @prop - Background color alpha of the skeleton text | ||
| $skeleton-text-background-alpha: 0.065; | ||
|
|
||
| /// @prop - Background color of the skeleton text | ||
| $skeleton-text-background: rgba(var(--background-rgb, $text-color-rgb), $skeleton-text-background-alpha); | ||
|
|
||
| /// @prop - Background color alpha of the skeleton text animation | ||
| $skeleton-text-background-animated-alpha: 0.135; | ||
| // Resting color, also the base/edge stops of the animated shimmer | ||
| $background-default: rgba( | ||
| var(--ion-skeleton-text-default-background-rgb, $background-rgb-fallback), | ||
| var(--ion-skeleton-text-default-background-alpha, $default-alpha-fallback) | ||
| ); | ||
|
|
||
| /// @prop - Background color of the skeleton text animation | ||
| $skeleton-text-background-animated: rgba( | ||
| var(--background-rgb, $text-color-rgb), | ||
| $skeleton-text-background-animated-alpha | ||
| // Highlight color of the animated shimmer | ||
| $background-animated: rgba( | ||
| var(--ion-skeleton-text-animated-background-rgb, $background-rgb-fallback), | ||
| var(--ion-skeleton-text-animated-background-alpha, $animated-alpha-fallback) | ||
| ); |
Oops, something went wrong.
Oops, something went wrong.
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.
This will eventually look like
@include border-radius(var(--ion-avatar-border-radius, revert-layer));when avatar is migrated.