Skip to content

Commit

Permalink
fix(showcase): prevent layout shift on image loading (#983)
Browse files Browse the repository at this point in the history
## Proposed change

<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that is required for this change. -->

## Related issues

- 🐛 Fixes #(issue)
- 🚀 Feature #(issue)

<!-- Please make sure to follow the contributing guidelines on
https://github.com/amadeus-digital/Otter/blob/main/CONTRIBUTING.md -->
  • Loading branch information
fpaul-1A authored Oct 30, 2023
2 parents df9069a + 724c4e1 commit b8d079f
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/showcase/src/app/home/home.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<h1>Otter</h1>
<p>This is a showcase application.</p>
<p>You can find examples of Otter features with some explanations.</p>
<img width="500" height="500" [src]="'otter-a.png' | dynamicContent">
<img width="500" height="500" [src]="'otter-a.svg' | dynamicContent">
</div>
Binary file removed apps/showcase/src/assets/otter-a.png
Binary file not shown.
1 change: 1 addition & 0 deletions apps/showcase/src/assets/otter-a.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/showcase/src/assets/otter-dynamic.png
Binary file not shown.
1 change: 1 addition & 0 deletions apps/showcase/src/assets/otter-dynamic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/showcase/src/assets/otter-summer.png
Binary file not shown.
1 change: 1 addition & 0 deletions apps/showcase/src/assets/otter-summer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/showcase/src/assets/otter.png
Binary file not shown.
1 change: 1 addition & 0 deletions apps/showcase/src/assets/otter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions apps/showcase/src/assets/rules/rulesets.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
{
"elementType": "ACTION",
"actionType": "UPDATE_ASSET",
"asset": "otter.png",
"value": "otter-summer.png"
"asset": "otter.svg",
"value": "otter-summer.svg"
}
],
"failureElements": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
height: 20px;
}
}

.card img {
aspect-ratio: 1 / 1;
width: 100%;
}
}

o3r-basic-pres {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="card my-3 overflow-hidden">
<div class="row g-0">
<div class="col-4 bg-body-tertiary d-flex align-items-center justify-center">
<img src="assets/otter.png" class="img-fluid rounded-start" aria-hidden="true">
<img src="assets/otter.svg" class="img-fluid rounded-start" aria-hidden="true">
</div>
<div class="col-8 container p-3">
<div class="card-bod d-flex flex-column h-100">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="card my-3 overflow-hidden">
<div class="row g-0">
<div class="col-4 bg-body-tertiary d-flex align-items-center justify-center">
<img src="assets/otter.png" class="img-fluid rounded-start" aria-hidden="true">
<img src="assets/otter.svg" class="img-fluid rounded-start" aria-hidden="true">
</div>
<div class="col-8 container p-3">
<div class="card-bod d-flex flex-column h-100">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="card my-3 overflow-hidden">
<div class="row g-0">
<div class="col-4 bg-body-tertiary d-flex align-items-center justify-center">
<img [src]="'otter-dynamic.png' | dynamicContent" class="img-fluid rounded-start" aria-hidden="true">
<img [src]="'otter-dynamic.svg' | dynamicContent" class="img-fluid rounded-start" aria-hidden="true">
</div>
<div class="col-8 container p-3">
<div class="card-bod d-flex flex-column h-100">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="card my-3 overflow-hidden">
<div class="row g-0">
<div class="col-4 bg-body-tertiary d-flex align-items-center justify-center">
<img src="assets/otter.png" class="img-fluid rounded-start" aria-hidden="true">
<img src="assets/otter.svg" class="img-fluid rounded-start" aria-hidden="true">
</div>
<div class="col-8 container p-3">
<div class="card-bod d-flex flex-column h-100">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="card my-3 overflow-hidden">
<div class="row g-0">
<div class="col-4 bg-body-tertiary d-flex align-items-center justify-center">
<img [src]="'otter.png' | dynamicContent" class="img-fluid rounded-start" aria-hidden="true">
<div class="col-4 bg-body-tertiary d-flex align-items-center justify-content-center">
<img [src]="'otter.svg' | dynamicContent" class="img-fluid rounded-start" aria-hidden="true">
</div>
<div class="col-8 container p-3">
<div class="card-bod d-flex flex-column h-100">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ o3r-scroll-back-top-pres {
bottom: 2rem;
right: 2rem;
opacity: .5;
z-index: 1021;

i {
color: #000;
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions apps/showcase/src/custom-assets/assets/otter-dynamic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion apps/showcase/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use '@design-factory/design-factory' with (
$prefix: bs-
$prefix: bs-,
$df-spinner-circumference: 2rem
);
@use "bootstrap-icons/font/bootstrap-icons";
@import "highlight.js/styles/github.css";
Expand Down

0 comments on commit b8d079f

Please sign in to comment.