Skip to content

Commit

Permalink
feat(esl-image-utils): helper container classes for native img / pict…
Browse files Browse the repository at this point in the history
…ure containers
  • Loading branch information
ala-n committed Aug 7, 2024
1 parent 5b4761a commit 16fc5cb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/modules/all.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import './esl-utils/all.less';

@import './esl-image/core.less';
@import './esl-image-utils/all.less';
@import './esl-media/core.less';

@import './esl-scrollbar/core.less';
Expand Down
1 change: 1 addition & 0 deletions src/modules/esl-image-utils/all.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './core/esl-image-conyainer.less';
44 changes: 44 additions & 0 deletions src/modules/esl-image-utils/core/esl-image-conyainer.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Image Container Defaults
.img-container {
position: relative;
overflow: hidden;

img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;

&[lodaing='lazy'] {
opacity: 0;
.img-container-loaded & {
opacity: 1;
transition: opacity 0.4s;
}
}

&.img-cover {
object-fit: cover;
}
&.img-contain {
object-fit: contain;
}
}

&.img-container-1-1 {
aspect-ratio: 1;
}

&.img-container-4-3 {
aspect-ratio: 4 / 3;
}

&.img-container-16-9 {
aspect-ratio: 16 / 9;
}
}

picture.img-container {
display: block;
}

0 comments on commit 16fc5cb

Please sign in to comment.