diff --git a/app/Section/Projects.tsx b/app/Section/Projects.tsx index e91066b..2629977 100644 --- a/app/Section/Projects.tsx +++ b/app/Section/Projects.tsx @@ -1,6 +1,5 @@ -import Link from "next/link"; -import { IconWithText } from "../components/IconWithText"; import { Section } from "../components/Section"; +import { ProjectLink } from "../components/ProjectLink"; const links = [ { @@ -8,54 +7,81 @@ const links = [ text: "Anix", desc: "Unofficial web client for anixart", url: "https://github.com/radiquum/AniX", + preview: [ + "/images/projects/anix/1.jpg", + "/images/projects/anix/2.png", + "/images/projects/anix/3.png", + ], }, { icon: "/icons/mdi_github.svg", text: "Furaffinity-dl", desc: "Fork with additional functionality", url: "https://github.com/radiquum/furaffinity-dl", + preview: [ + "/images/projects/anix/3.png", + ], }, { icon: "/icons/mdi_github.svg", text: "TG-Photos", desc: "Google Photo like bot for Telegram", url: "https://github.com/radiquum/TG-Photos", + preview: [ + "/images/projects/anix/3.png", + ], }, { icon: "/icons/mdi_github.svg", text: "TIG", desc: "Generate images from text", url: "https://github.com/radiquum/TIG", + preview: [ + "/images/projects/anix/1.jpg", + "/images/projects/anix/2.png", + "/images/projects/anix/3.png", + ], }, { icon: "/icons/mdi_github.svg", text: "GitHub", desc: "Other Projects", url: "https://github.com/radiquum", + preview: [ + "/images/projects/anix/3.png", + ], }, { icon: "/icons/wahsu.svg", text: "wah.su", desc: "Self-Hosting project", url: "https://wah.su", + preview: [ + "/images/projects/anix/3.png", + ], }, { icon: "/icons/ic_baseline-telegram.svg", text: "Red Pandas Stickers", desc: "Collection of Red Panda sticker packs", url: "https://t.me/red_panda_stickers", + preview: [ + "/images/projects/anix/1.jpg", + "/images/projects/anix/2.png", + "/images/projects/anix/3.png", + ], }, ]; export const Projects = () => { return (
-

Projects

+

+ Projects +

{links.map((item) => ( - - - + ))}
diff --git a/app/components/IconWithText.tsx b/app/components/IconWithText.tsx index b600b52..48e32be 100644 --- a/app/components/IconWithText.tsx +++ b/app/components/IconWithText.tsx @@ -4,6 +4,7 @@ type IconWithTextProps = { desc: string; backgroundColor?: string | null; backgroundOpacity?: string | null; + isGroup?: boolean; }; export const IconWithText = ({ @@ -12,10 +13,15 @@ export const IconWithText = ({ desc, backgroundColor, backgroundOpacity, + isGroup, }: IconWithTextProps) => { return (
{ + const [shouldUseCarousel] = useState(preview ? preview.length > 1 : false); + const [emblaRef, emblaApi] = useEmblaCarousel({ loop: true }, [ + Autoplay({ delay: 5000, playOnInit: false }), + ]); + const ref = useRef(null); + const isInView = useInView(ref); + + useEffect(() => { + if (!shouldUseCarousel) return; + if (!emblaApi) return; + + const autoplay = emblaApi?.plugins()?.autoplay; + if (!autoplay) return; + + if (!isInView) { + autoplay.stop(); + } else { + autoplay.play(); + } + }, [shouldUseCarousel, emblaApi, isInView]); + + return ( + +
+ {shouldUseCarousel ? ( +
+
+
+ {preview.map((item, index) => ( +
+ +
+ ))} +
+
+
+ ) : ( + {text} + )} +
+
+ +
+ + ); +}; diff --git a/app/globals.css b/app/globals.css index 184727a..f5a7f7d 100644 --- a/app/globals.css +++ b/app/globals.css @@ -95,3 +95,10 @@ body { --slide-size: 512px; } } + +.embla--projects { + --slide-size: 100%; + --slide-width: 100%; + --slide-height: 100%; + --slide-spacing: 16px; +} diff --git a/package-lock.json b/package-lock.json index d5dec41..8c92cf9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "radiquum.github.io", "version": "0.1.0", "dependencies": { + "embla-carousel-autoplay": "^8.6.0", "embla-carousel-react": "^8.6.0", "motion": "^12.23.9", "next": "15.4.2", @@ -2556,6 +2557,15 @@ "integrity": "sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==", "license": "MIT" }, + "node_modules/embla-carousel-autoplay": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/embla-carousel-autoplay/-/embla-carousel-autoplay-8.6.0.tgz", + "integrity": "sha512-OBu5G3nwaSXkZCo1A6LTaFMZ8EpkYbwIaH+bPqdBnDGQ2fh4+NbzjXjs2SktoPNKCtflfVMc75njaDHOYXcrsA==", + "license": "MIT", + "peerDependencies": { + "embla-carousel": "8.6.0" + } + }, "node_modules/embla-carousel-react": { "version": "8.6.0", "resolved": "https://registry.npmjs.org/embla-carousel-react/-/embla-carousel-react-8.6.0.tgz", diff --git a/package.json b/package.json index 6d8c79b..e131e8c 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "embla-carousel-autoplay": "^8.6.0", "embla-carousel-react": "^8.6.0", "motion": "^12.23.9", "next": "15.4.2", diff --git a/public/images/projects/anix/1.jpg b/public/images/projects/anix/1.jpg new file mode 100644 index 0000000..f6431dc Binary files /dev/null and b/public/images/projects/anix/1.jpg differ diff --git a/public/images/projects/anix/2.png b/public/images/projects/anix/2.png new file mode 100644 index 0000000..933692d Binary files /dev/null and b/public/images/projects/anix/2.png differ diff --git a/public/images/projects/anix/3.png b/public/images/projects/anix/3.png new file mode 100644 index 0000000..832648d Binary files /dev/null and b/public/images/projects/anix/3.png differ