Skip to content

Commit

Permalink
Adds an infinite scroll option
Browse files Browse the repository at this point in the history
  • Loading branch information
tommusrhodus committed Jun 27, 2023
1 parent f20c0d9 commit 5ff8cd3
Show file tree
Hide file tree
Showing 14 changed files with 349 additions and 101 deletions.
85 changes: 85 additions & 0 deletions assets/css/src/_infinite.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
body .wp-load-more__infinite-scroll {
pointer-events: none;
justify-content: center;
display: none;

&.loading {
display: flex;
}

&.is-content-justification-right {
justify-content: flex-end;
}

&.is-content-justification-left {
justify-content: flex-start;
}

.animation-wrapper {
display: inline-block;
position: relative;
width: 32px;
height: 32px;

div {
position: absolute;
border-width: 2px;
border-style: solid;
border-color: inherit;
opacity: 1;
border-radius: 50%;
animation: load-more-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;

&:nth-child(2) {
animation-delay: -0.5s;
}
}
}

+ .wp-block-buttons {
opacity: 0;
visibility: hidden;
overflow: hidden;
height: 1px;
pointer-events: none;

.wp-load-more__button + .wp-load-more__button {
display: none;
}
}
}

@keyframes load-more-ripple {

0% {
top: 50%;
left: 50%;
width: 0;
height: 0;
opacity: 0;
}

4.9% {
top: 50%;
left: 50%;
width: 0;
height: 0;
opacity: 0;
}

5% {
top: 50%;
left: 50%;
width: 0;
height: 0;
opacity: 1;
}

100% {
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
}
}
11 changes: 9 additions & 2 deletions assets/css/src/editor.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
@import "infinite";

.wp-block-query-pagination.load-more {
min-height: 66px;

* {
display: none;
}

+ .load-more-button-wrap {
+.load-more-button-wrap {
margin-top: -66px;
pointer-events: none;
}
Expand All @@ -17,7 +19,12 @@

gap: var(--wp--preset--spacing--30);

+ .wp-load-more__button {
+.wp-load-more__button {
display: none;
}
}

.wp-load-more__infinite-scroll {
margin-top: -66px;
display: flex;
}
2 changes: 2 additions & 0 deletions assets/css/src/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "infinite";

.wp-load-more__button {
display: flex;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion assets/js/build/frontend.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '2ffa0d98738e7d629565');
<?php return array('dependencies' => array(), 'version' => '3c0f99a875b752effacc');
2 changes: 1 addition & 1 deletion assets/js/build/frontend.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-primitives'), 'version' => 'ecf953d3e0fd33a447ad');
<?php return array('dependencies' => array('wp-block-editor', 'wp-components', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-primitives'), 'version' => 'f27caedbf1f7f0781300');
2 changes: 1 addition & 1 deletion assets/js/build/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/js/build/style-index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5ff8cd3

Please sign in to comment.