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

⚡ perf: Animated logo & spinner load animation after LCD #1511

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/five-zoos-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': patch
---

**core**: performanct update to load animations of logo and spinner after LCP
4 changes: 2 additions & 2 deletions packages/core/src/components/bal-logo/bal-logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, h, ComponentInterface, Host, Element, Prop, State, Functiona
import { BEM } from '../../utils/bem'
import type { AnimationItem } from 'lottie-web/build/player/lottie_light_html'
import { Loggable, Logger, LogInstance } from '../../utils/log'
import { rIC } from '../../utils/helpers'
import { rLCP } from '../../utils/helpers'
import { BalBreakpointObserver, BalBreakpoints, ListenToBreakpoints, balBreakpoints } from '../../utils/breakpoints'
import { BalConfigObserver, BalConfigState, ListenToConfig } from '../../utils/config'

Expand Down Expand Up @@ -119,7 +119,7 @@ export class Logo implements ComponentInterface, Loggable, BalBreakpointObserver
if (this.animationFunction) {
return resolve()
} else {
rIC(async () => {
rLCP(async () => {
import(/* @vite-ignore */ './bal-logo.animation')
.then(module => {
this.animationFunction = module.animate
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/bal-spinner/bal-spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, h, Host, Prop, Element, Watch, ComponentInterface, State } from '@stencil/core'
import type { AnimationItem } from 'lottie-web/build/player/lottie_light_html'
import { rIC } from '../../utils/helpers'
import { rLCP } from '../../utils/helpers'
import { Loggable, Logger, LogInstance } from '../../utils/log'
import { raf } from '../../utils/helpers'
import { BEM } from '../../utils/bem'
Expand Down Expand Up @@ -165,7 +165,7 @@ export class Spinner implements ComponentInterface, Loggable, BalConfigObserver
if (this.animationFunction) {
return resolve()
} else {
rIC(async () => {
rLCP(async () => {
import(/* @vite-ignore */ './bal-spinner.animation')
.then(module => {
this.animationFunction = module.animate
Expand Down
4 changes: 0 additions & 4 deletions packages/core/src/test/seo/05-spinner.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
<body>
<bal-app>
<main class="container py-medium">
<!-- <div>
<bal-button bal-popup="my-popup">Click me</bal-button>
<bal-popup id="my-popup" label="Popup Label" backdrop-dismiss="true">Popup content</bal-popup>
</div> -->
<bal-spinner></bal-spinner>
<h1 class="title">Spinner Page</h1>
<table class="table">
Expand Down
2 changes: 1 addition & 1 deletion packages/core/stencil.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const config: Config = {
},
{
src: join(packagesDir, 'styles', 'css', 'basic.min.css'),
dest: 'assets/basic.min.css',
dest: 'assets',
warn: true,
},
{
Expand Down