@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
29 lines (28 loc) • 940 B
JavaScript
import { SKELETON_RIPPLE_DURATION } from "../../components/skeleton/skeleton_constants.js";
const SkeletonAnimation = {
computed: {
skeletonOffset() {
const skeletonText = this.$refs.skeleton;
if (!skeletonText) {
return this.offset;
}
const { top, height } = skeletonText.getBoundingClientRect();
return top + height / 2;
},
skeletonStyle() {
const style = {};
if (this.skeletonOffset === -1 || !this.animate && this.animationDuration === -1) {
return style;
}
const animationDelay = this.skeletonOffset * SKELETON_RIPPLE_DURATION / 1e3;
const animationDuration = this.animationDuration === -1 ? 1e3 : this.animationDuration;
style.animationDelay = `${animationDelay}ms`;
style.animationDuration = `${animationDuration}ms`;
return style;
}
}
};
export {
SkeletonAnimation as default
};
//# sourceMappingURL=skeleton.js.map