aboutsummaryrefslogtreecommitdiff
path: root/apps/website/src/components/base/Slider.astro
diff options
context:
space:
mode:
authorTyler Flowers <contact@ggtylerr.dev>2023-12-04 18:23:33 -0500
committerTyler Flowers <contact@ggtylerr.dev>2023-12-04 18:23:33 -0500
commitef0b02e2659310103c0772990f7e8f7fe77de63a (patch)
tree3fe32fd918ea5a31cfa98105f01a341634079c52 /apps/website/src/components/base/Slider.astro
parent8662119a19cad0d85628919c9170373d44c733de (diff)
downloadNexus-ef0b02e2659310103c0772990f7e8f7fe77de63a.tar.gz
Nexus-ef0b02e2659310103c0772990f7e8f7fe77de63a.tar.bz2
Nexus-ef0b02e2659310103c0772990f7e8f7fe77de63a.zip
Make Slider + Card and add to index
Diffstat (limited to 'apps/website/src/components/base/Slider.astro')
-rw-r--r--apps/website/src/components/base/Slider.astro38
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/website/src/components/base/Slider.astro b/apps/website/src/components/base/Slider.astro
new file mode 100644
index 0000000..f40b747
--- /dev/null
+++ b/apps/website/src/components/base/Slider.astro
@@ -0,0 +1,38 @@
+---
+import type { HTMLAttributes } from 'astro/types';
+
+interface Props extends HTMLAttributes<'div'> {
+ dir?: string;
+ wrapperClass?: string;
+}
+
+const {
+ dir = "left",
+ wrapperClass = ""
+} = Astro.props;
+---
+
+<div class={
+ `w-full bg-blue-100 flex flex-row gap-2.5 overflow-hidden slider
+ ${dir === "right" ? "reverse" : ""}
+ ${wrapperClass}`}>
+ <slot />
+</div>
+
+<!-- might be cheating a bit using global styles here but at least it lets you use slots -->
+<style is:global>
+ .slider > * {
+ animation: 5s linear infinite slide;
+ }
+ .slider.reverse > * {
+ animation-direction: reverse;
+ }
+ @keyframes slide {
+ from {
+ transform: translateX(0);
+ }
+ to {
+ transform: translateX(calc(-100% - 10px));
+ }
+ }
+</style>