-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(styles): add skeleton examples and styling [ci visual]
- Loading branch information
Showing
8 changed files
with
1,837 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,4 @@ | |
|
||
// BTP Specific components/overwrites | ||
@import "./btp/avatar.scss"; | ||
@import "skeleton"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
@import "./new-settings"; | ||
@import "./mixins"; | ||
|
||
$block: #{$fd-namespace}-skeleton; | ||
|
||
.#{$block} { | ||
@include fd-reset(); | ||
|
||
display: inline-block; | ||
cursor: wait; | ||
|
||
&__canvas { | ||
display: block; | ||
fill: var(--sapContent_Placeholderloading_Background); | ||
} | ||
|
||
&__middle { | ||
stop-color: var(--fdSkeletonGradientMiddleColor); | ||
animation: fd-skeleton-shimmer 2s linear infinite; | ||
} | ||
|
||
&--animated { | ||
.#{$block}__canvas { | ||
--fdSkeletonGradientMiddleColor: #999; | ||
|
||
fill: url(#skeletonGradient); | ||
} | ||
} | ||
} | ||
|
||
@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
17
packages/styles/stories/Components/skeleton/circle.example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="fd-skeleton fd-skeleton--animated" style="width: 50px; height: 50px;"> | ||
<svg width="100%" height="100%" class="fd-skeleton__canvas"> | ||
<defs> | ||
<linearGradient id="skeletonGradient"> | ||
<stop offset="0" stop-color="var(--sapContent_Placeholderloading_Background)"></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" stop-color="var(--sapContent_Placeholderloading_Background)"></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
22
packages/styles/stories/Components/skeleton/complex.example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<div class="fd-skeleton fd-skeleton--animated" style="width: 160px; height: 110px;"> | ||
<svg width="100%" height="100%" class="fd-skeleton__canvas"> | ||
<defs> | ||
<linearGradient id="skeletonGradient"> | ||
<stop offset="0" stop-color="var(--sapContent_Placeholderloading_Background)"></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" stop-color="var(--sapContent_Placeholderloading_Background)"></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> |
45 changes: 45 additions & 0 deletions
45
packages/styles/stories/Components/skeleton/lines.example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<p>3 lines</p> | ||
<div class="fd-skeleton fd-skeleton--animated" style="width: 100px; height: 60px;"> | ||
<svg width="100%" height="100%" class="fd-skeleton__canvas"> | ||
<defs> | ||
<linearGradient id="skeletonGradient"> | ||
<stop offset="0" stop-color="var(--sapContent_Placeholderloading_Background)"></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" stop-color="var(--sapContent_Placeholderloading_Background)"></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 fd-skeleton--animated" style="width: 100px; height: 60px;"> | ||
<svg width="100%" height="100%" class="fd-skeleton__canvas"> | ||
<defs> | ||
<linearGradient id="skeletonGradient"> | ||
<stop offset="0" stop-color="var(--sapContent_Placeholderloading_Background)"></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" stop-color="var(--sapContent_Placeholderloading_Background)"></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
24
packages/styles/stories/Components/skeleton/skeleton.example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<div class="fd-skeleton fd-skeleton--animated" style="width: 100px; height: 50px;"> | ||
<svg width="100%" height="100%" class="fd-skeleton__canvas"> | ||
<defs> | ||
<linearGradient id="skeletonGradient"> | ||
<stop offset="0" stop-color="var(--sapContent_Placeholderloading_Background)"> | ||
</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" stop-color="var(--sapContent_Placeholderloading_Background)"> | ||
|
||
</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
48
packages/styles/stories/Components/skeleton/skeleton.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
} | ||
}; |
Oops, something went wrong.