Skip to content
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

feat(): Add animation on skeleton text #14068

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/core/src/components/skeleton-text/readme.md
Expand Up @@ -7,13 +7,23 @@

## Properties

#### animated

boolean


#### width

string


## Attributes

#### animated

boolean


#### width

string
Expand Down
16 changes: 16 additions & 0 deletions packages/core/src/components/skeleton-text/skeleton-text.scss
Expand Up @@ -18,3 +18,19 @@ ion-skeleton-text span {

font-size: 8px;
}

ion-skeleton-text.animated {
animation: shine 1s infinite;
}

@keyframes shine {
to {
background-position:
0 0,
100% 0,
120px 0,
120px 40px,
120px 80px,
120px 120px;
}
}
4 changes: 2 additions & 2 deletions packages/core/src/components/skeleton-text/skeleton-text.tsx
Expand Up @@ -13,8 +13,8 @@ import { Component, Prop } from '@stencil/core';
})
export class SkeletonText {
@Prop() width = '100%';

@Prop() animated = false;
render () {
return <span style={{width: this.width}}>&nbsp;</span>;
return <span style={{width: this.width}} class={this.animated ? 'animated' : ''}>&nbsp;</span>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class should be like this:

class={'animated': this.animated}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.. Thanks for the review, that looks cleaner :) ill update the PR later

}
}
Expand Up @@ -12,6 +12,7 @@
<ion-skeleton-text width=600px></ion-skeleton-text>
<ion-skeleton-text width=100px></ion-skeleton-text>
<ion-skeleton-text width=80px></ion-skeleton-text>
<ion-skeleton-text animated="true" width=80px></ion-skeleton-text>
</body>
</html>

Expand Down