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(styles): add skeleton examples and styling [ci visual] #4634

Merged
merged 1 commit into from
Jun 28, 2023
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
1 change: 1 addition & 0 deletions packages/styles/src/fundamental-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
@import "select";
@import "shellbar";
@import "side-nav";
@import "skeleton";
@import "slider";
@import "status-indicator";
@import "step-input";
Expand Down
46 changes: 46 additions & 0 deletions packages/styles/src/skeleton.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

@import "./new-settings";
@import "./mixins";

$block: #{$fd-namespace}-skeleton;

.#{$block} {
@include fd-reset();

display: inline-block;
cursor: wait;

&__canvas {
display: block;
fill: url(#skeletonGradient);

--fdSkeletonGradientMiddleColor: #999;
}

&__outer {
stop-color: var(--sapContent_Placeholderloading_Background);
}

&__middle {
stop-color: var(--fdSkeletonGradientMiddleColor);
animation: fd-skeleton-shimmer 2s linear infinite;
}
}

@keyframes fd-skeleton-shimmer {
0% {
stop-color: var(--sapContent_Placeholderloading_Background);
}

35% {
stop-color: var(--fdSkeletonGradientMiddleColor);
}

65% {
stop-color: var(--fdSkeletonGradientMiddleColor);
}

100% {
stop-color: var(--sapContent_Placeholderloading_Background);
}
}
17 changes: 17 additions & 0 deletions packages/styles/stories/Components/skeleton/circle.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div class="fd-skeleton" style="width: 50px; height: 50px;">
<svg width="100%" height="100%" class="fd-skeleton__canvas">
<defs>
<linearGradient id="skeletonGradient">
<stop offset="0" class="fd-skeleton__outer"></stop>
<stop class="fd-skeleton__middle">
<animate attributeName="offset" values="0; 0; 0.5; 1; 1" dur="2s" repeatCount="indefinite"></animate>
</stop>
<stop offset="1" class="fd-skeleton__outer"></stop>
</linearGradient>
<mask id="fd-skeleton-2">
<circle cx="50%" cy="50%" r="50%" class="ng-star-inserted"></circle>
</mask>
</defs>
<rect x="0" y="0" width="100%" height="100%" mask="url(#fd-skeleton-2)"></rect>
</svg>
</div>
22 changes: 22 additions & 0 deletions packages/styles/stories/Components/skeleton/complex.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="fd-skeleton" style="width: 160px; height: 110px;">
<svg width="100%" height="100%" class="fd-skeleton__canvas">
<defs>
<linearGradient id="skeletonGradient">
<stop offset="0" class="fd-skeleton__outer"></stop>
<stop class="fd-skeleton__middle">
<animate attributeName="offset" values="0; 0; 0.5; 1; 1" dur="2s" repeatCount="indefinite"></animate>
</stop>
<stop offset="1" class="fd-skeleton__outer"></stop>
</linearGradient>
<mask id="fd-skeleton-8">
<circle cx="25" cy="25" r="25"></circle>
<rect x="60" y="0" width="100" height="16" rx="4"></rect>
<rect x="60" y="30" width="60" height="12" rx="4"></rect>
<rect x="0" y="60" width="160" height="8" rx="4"></rect>
<rect x="0" y="80" width="160" height="8" rx="4"></rect>
<rect x="0" y="100" width="100" height="8" rx="4"></rect>
</mask>
</defs>
<rect x="0" y="0" width="100%" height="100%" mask="url(#fd-skeleton-8)"></rect>
</svg>
</div>
44 changes: 44 additions & 0 deletions packages/styles/stories/Components/skeleton/lines.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<p>3 lines</p>
<div class="fd-skeleton" style="width: 100px; height: 60px;">
<svg width="100%" height="100%" class="fd-skeleton__canvas">
<defs>
<linearGradient id="skeletonGradient">
<stop offset="0" class="fd-skeleton__outer"></stop>
<stop class="fd-skeleton__middle">
<animate attributeName="offset" values="0; 0; 0.5; 1; 1" dur="2s" repeatCount="indefinite"></animate>
</stop>
<stop offset="1" class="fd-skeleton__outer"></stop>
</linearGradient>
<mask id="fd-skeleton-4">
<rect x="0" width="100%" rx="4" height="8" y="0" class="ng-star-inserted"></rect>
<rect x="0" width="100%" rx="4" height="8" y="20" class="ng-star-inserted"></rect>
<rect x="0" width="60%" rx="4" height="8" y="40" class="ng-star-inserted"></rect>
</mask>
</defs>
<rect x="0" y="0" width="100%" height="100%" mask="url(#fd-skeleton-4)">

</rect>
</svg>
</div>

<p>2 lines</p>
<div class="fd-skeleton" style="width: 100px; height: 60px;">
<svg width="100%" height="100%" class="fd-skeleton__canvas">
<defs>
<linearGradient id="skeletonGradient">
<stop offset="0" class="fd-skeleton__outer"></stop>
<stop class="fd-skeleton__middle">
<animate attributeName="offset" values="0; 0; 0.5; 1; 1" dur="2s" repeatCount="indefinite"></animate>
</stop>
<stop offset="1" class="fd-skeleton__outer"></stop>
</linearGradient>
<mask id="fd-skeleton-5">
<rect x="0" width="100%" rx="4" height="8" y="0" class="ng-star-inserted"></rect>
<rect x="0" width="60%" rx="4" height="8" y="20" class="ng-star-inserted"></rect>
</mask>
</defs>
<rect x="0" y="0" width="100%" height="100%" mask="url(#fd-skeleton-5)">

</rect>
</svg>
</div>
24 changes: 24 additions & 0 deletions packages/styles/stories/Components/skeleton/skeleton.example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="fd-skeleton" style="width: 100px; height: 50px;">
<svg width="100%" height="100%" class="fd-skeleton__canvas">
<defs>
<linearGradient id="skeletonGradient">
<stop offset="0" class="fd-skeleton__outer">
</stop>
<stop class="fd-skeleton__middle">
<animate attributeName="offset" values="0; 0; 0.5; 1; 1" dur="2s" repeatCount="indefinite">

</animate>
</stop>
<stop offset="1" class="fd-skeleton__outer">

</stop>
</linearGradient>
<mask id="fd-skeleton-0">
<rect x="0" y="0" width="100%" rx="4" height="100%" class="ng-star-inserted"></rect>
</mask>
</defs>
<rect x="0" y="0" width="100%" height="100%" mask="url(#fd-skeleton-0)">

</rect>
</svg>
</div>
48 changes: 48 additions & 0 deletions packages/styles/stories/Components/skeleton/skeleton.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import skeletonExampleHtml from "./skeleton.example.html?raw";
import circleExampleHtml from "./circle.example.html?raw";
import linesExampleHtml from "./lines.example.html?raw";
import complexExampleHtml from "./complex.example.html?raw";
import '../../../src/skeleton.scss';
export default {
title: 'Components/Skeleton',
parameters: {
description: `Placeholder loading is a type of busy indicator that provides the user with a skeleton page as a placeholder while the content is still loading. The aim is to inform the user of the ongoing loading progress.
\r\nA skeleton page shows the frame of the final content without the content being fully loaded. Visually, skeleton pages are grey boxes with animations to indicate loading activity.
\r\nSkeleton pages are used to create an impression of speed and reliability when an app encounters performance barriers. They provide a generic preview of the layout, which makes the app seem to load faster. This improves the overall user experience.
\r\nThe Placeholder Skeleton is made up of Placeholder Shapes that aim to give an idea of how the actual content will look like. The placeholders can take various forms, depending on the type of content that is being loaded.`,
tags: ['f3']
}
};
export const Skeleton = () => skeletonExampleHtml;
Skeleton.storyName = 'Rectangle';
Skeleton.parameters = {
docs: {
description: {
story: 'An example of a rectangular placeholder'
}
}
};
export const Circle = () => circleExampleHtml;
Circle.parameters = {
docs: {
description: {
story: 'An example of a circular placeholder'
}
}
};
export const Lines = () => linesExampleHtml;
Lines.parameters = {
docs: {
description: {
story: 'Examples of lines placeholders (3 and 2 lines)'
}
}
};
export const ComplexExamples = () => complexExampleHtml;
ComplexExamples.parameters = {
docs: {
description: {
story: 'The library allows setting customly build examples like this one'
}
}
};
Loading
Loading