Essentially, loaders are what you see on the screen while the rest of the page's content is still loading.
Loaders are visible throughout the entire application, usually when content is being loaded from the back-end. It’s easier to see it in pages in which the content is loaded on the fly, such as the checkout page, in the shipping method area.
Issues with the designs
The Loader
component is responsible for rendering loaders, and it accepts an isLoading
prop, which is true if the loader should be displayed, and false otherwise.
<aside> ℹ️ Usually, styling this element takes from-to: 4-5h
</aside>
However, if you want to change the loader main icon:
_loader.scss
under src/style/abstract/
.%loader
class. Something like this:%loader {
// Styles here
}
<aside>
➡️ During development, to easier visualize what is being styled, it’s recommended to render a loader component on a page of easy access. Do it by simply adding a <Loader/>
component on a page or component of your choice, but don’t forget to remove it before you commit any change.
</aside>
Loaders commonly have animations. Check if the existing animations on the default ScandiPWA theme serve your purpose.
If you want to create a new animation:
_keyframes.override.scss
under src/style/base/
.@import ‘./base/keyframes.override’;
to main.scss
, if not already._keyframes.override.scss
.To style the Loader component, override its .style.scss
file if you want to make changes related to the component positioning and frame. You can also customize how it is rendered by overriding the .component.js
file.