-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add skewed infinite scroll component
- Loading branch information
1 parent
a3da241
commit 7de2f94
Showing
5 changed files
with
164 additions
and
2 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
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
74 changes: 74 additions & 0 deletions
74
docs/src/components/spark-ui/skewed-infinite-scroll/SkewedInfiniteScroll.vue
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,74 @@ | ||
<script setup lang='ts'> | ||
const items = [ | ||
{ id: '1', text: 'Spark UI' }, | ||
{ id: '2', text: 'Another One' }, | ||
{ id: '3', text: 'Yet Another One' }, | ||
{ id: '4', text: 'Yet Another One' }, | ||
{ id: '5', text: 'Yet Another One' }, | ||
{ id: '6', text: 'Yet Another One' }, | ||
{ | ||
id: '7', | ||
text: 'Yet Another One', | ||
}, | ||
{ | ||
id: '8', | ||
text: 'Yet Another One', | ||
}, | ||
] | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div class="flex items-center justify-center"> | ||
<div | ||
class="relative w-full max-w-screen-lg overflow-hidden" :style="{ | ||
maskComposite: 'intersect', | ||
maskImage: ` | ||
linear-gradient(to right, transparent, black 5rem), | ||
linear-gradient(to left, transparent, black 5rem), | ||
linear-gradient(to bottom, transparent, black 5rem), | ||
linear-gradient(to top, transparent, black 5rem) | ||
`, | ||
}" | ||
> | ||
<div class="mx-auto grid animate-skew-scroll grid-cols-1 gap-5 sm:grid-cols-2"> | ||
<div v-for="item in items" :key="item.id"> | ||
<div | ||
:key="item.id" | ||
class="flex cursor-pointer w-72 p-6 items-center space-x-2 rounded-md border border-gray-100 px-5 shadow-md transition-all hover:-translate-y-1 hover:translate-x-1 hover:scale-[1.025] hover:shadow-xl " | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" | ||
fill="currentColor" stroke="white" strokeWidth="2" strokeLinecap="round" | ||
strokeLinejoin="round" class="h-6 w-6 flex-none text-red-500" | ||
> | ||
<path | ||
d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z" | ||
/> | ||
<path d="m9 12 2 2 4-4" /> | ||
</svg> | ||
<p class="text-gray-600"> | ||
{{ item.text }} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.animate-skew-scroll { | ||
animation: SkewScroll 20s linear infinite; | ||
} | ||
@keyframes SkewScroll { | ||
0% { | ||
transform: rotatex(20deg) rotateZ(-20deg) skewX(20deg) translateZ(0) translateY(0); | ||
} | ||
100% { | ||
transform: rotatex(20deg) rotateZ(-20deg) skewX(20deg) translateZ(0) translateY(-100%); | ||
} | ||
} | ||
</style> |
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,7 @@ | ||
<script setup lang='ts'> | ||
import SkewedInfiniteScroll from './SkewedInfiniteScroll.vue' | ||
</script> | ||
|
||
<template> | ||
<SkewedInfiniteScroll /> | ||
</template> |
74 changes: 74 additions & 0 deletions
74
docs/src/example/skewedInfiniteScroll/SkewedInfiniteScroll.vue
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,74 @@ | ||
<script setup lang='ts'> | ||
const items = [ | ||
{ id: '1', text: 'Spark UI' }, | ||
{ id: '2', text: 'Another One' }, | ||
{ id: '3', text: 'Yet Another One' }, | ||
{ id: '4', text: 'Yet Another One' }, | ||
{ id: '5', text: 'Yet Another One' }, | ||
{ id: '6', text: 'Yet Another One' }, | ||
{ | ||
id: '7', | ||
text: 'Yet Another One', | ||
}, | ||
{ | ||
id: '8', | ||
text: 'Yet Another One', | ||
}, | ||
] | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<div class="flex items-center justify-center"> | ||
<div | ||
class="relative w-full max-w-screen-lg overflow-hidden" :style="{ | ||
maskComposite: 'intersect', | ||
maskImage: ` | ||
linear-gradient(to right, transparent, black 5rem), | ||
linear-gradient(to left, transparent, black 5rem), | ||
linear-gradient(to bottom, transparent, black 5rem), | ||
linear-gradient(to top, transparent, black 5rem) | ||
`, | ||
}" | ||
> | ||
<div class="mx-auto grid animate-skew-scroll grid-cols-1 gap-5 sm:grid-cols-2"> | ||
<div v-for="item in items" :key="item.id"> | ||
<div | ||
:key="item.id" | ||
class="flex cursor-pointer w-72 px-6 py-1 items-center space-x-2 rounded-md border border-gray-100 shadow-md transition-all hover:-translate-y-1 hover:translate-x-1 hover:scale-[1.025] hover:shadow-xl " | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" | ||
fill="currentColor" stroke="white" strokeWidth="2" strokeLinecap="round" | ||
strokeLinejoin="round" class="h-6 w-6 flex-none text-red-500" | ||
> | ||
<path | ||
d="M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z" | ||
/> | ||
<path d="m9 12 2 2 4-4" /> | ||
</svg> | ||
<p class="text-gray-600"> | ||
{{ item.text }} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.animate-skew-scroll { | ||
animation: SkewScroll 20s linear infinite; | ||
} | ||
@keyframes SkewScroll { | ||
0% { | ||
transform: rotatex(20deg) rotateZ(-20deg) skewX(20deg) translateZ(0) translateY(0); | ||
} | ||
100% { | ||
transform: rotatex(20deg) rotateZ(-20deg) skewX(20deg) translateZ(0) translateY(-100%); | ||
} | ||
} | ||
</style> |