From e65a720026a4ecbc23745d8aee902810cb09af3a Mon Sep 17 00:00:00 2001
From: rzmk <30333942+rzmk@users.noreply.github.com>
Date: Fri, 27 Sep 2024 16:02:10 -0400
Subject: [PATCH] chore: lazy load images and hide download button on vertical
mobile view
---
src/components/EmblaCarousel.jsx | 136 +++++++++++++++----------------
src/components/Hero.jsx | 120 ++++++++++++++-------------
2 files changed, 133 insertions(+), 123 deletions(-)
diff --git a/src/components/EmblaCarousel.jsx b/src/components/EmblaCarousel.jsx
index 042a0b6..426fdef 100644
--- a/src/components/EmblaCarousel.jsx
+++ b/src/components/EmblaCarousel.jsx
@@ -1,68 +1,68 @@
-import React, { useState, useEffect, useCallback } from 'react'
-import useEmblaCarousel from 'embla-carousel-react'
-import { Thumb } from './EmblaCarouselThumbsButton'
-
-const EmblaCarousel = (props) => {
- const { slides, options, plugins } = props
- const [selectedIndex, setSelectedIndex] = useState(0)
- const [emblaMainRef, emblaMainApi] = useEmblaCarousel(options, plugins)
- const [emblaThumbsRef, emblaThumbsApi] = useEmblaCarousel({
- containScroll: 'keepSnaps',
- dragFree: true,
- }
- )
-
- const onThumbClick = useCallback(
- (index) => {
- if (!emblaMainApi || !emblaThumbsApi) return
- emblaMainApi.scrollTo(index)
- },
- [emblaMainApi, emblaThumbsApi]
- )
-
- const onSelect = useCallback(() => {
- if (!emblaMainApi || !emblaThumbsApi) return
- setSelectedIndex(emblaMainApi.selectedScrollSnap())
- emblaThumbsApi.scrollTo(emblaMainApi.selectedScrollSnap())
- }, [emblaMainApi, emblaThumbsApi, setSelectedIndex])
-
- useEffect(() => {
- if (!emblaMainApi) return
- onSelect()
-
- emblaMainApi.on('select', onSelect).on('reInit', onSelect)
- }, [emblaMainApi, onSelect])
-
- return (
-
-
-
- {slides.map((slide, index) => (
-
-

-
{slide.title}
-
{slide.description}
-
- ))}
-
-
-
-
-
-
- {slides.map((slide, index) => (
- onThumbClick(index)}
- selected={index === selectedIndex}
- index={slide}
- />
- ))}
-
-
-
-
- )
-}
-
-export default EmblaCarousel
+import React, { useState, useEffect, useCallback } from 'react'
+import useEmblaCarousel from 'embla-carousel-react'
+import { Thumb } from './EmblaCarouselThumbsButton'
+
+const EmblaCarousel = (props) => {
+ const { slides, options, plugins } = props
+ const [selectedIndex, setSelectedIndex] = useState(0)
+ const [emblaMainRef, emblaMainApi] = useEmblaCarousel(options, plugins)
+ const [emblaThumbsRef, emblaThumbsApi] = useEmblaCarousel({
+ containScroll: 'keepSnaps',
+ dragFree: true,
+ }
+ )
+
+ const onThumbClick = useCallback(
+ (index) => {
+ if (!emblaMainApi || !emblaThumbsApi) return
+ emblaMainApi.scrollTo(index)
+ },
+ [emblaMainApi, emblaThumbsApi]
+ )
+
+ const onSelect = useCallback(() => {
+ if (!emblaMainApi || !emblaThumbsApi) return
+ setSelectedIndex(emblaMainApi.selectedScrollSnap())
+ emblaThumbsApi.scrollTo(emblaMainApi.selectedScrollSnap())
+ }, [emblaMainApi, emblaThumbsApi, setSelectedIndex])
+
+ useEffect(() => {
+ if (!emblaMainApi) return
+ onSelect()
+
+ emblaMainApi.on('select', onSelect).on('reInit', onSelect)
+ }, [emblaMainApi, onSelect])
+
+ return (
+
+
+
+ {slides.map((slide, index) => (
+
+

+
{slide.title}
+
{slide.description}
+
+ ))}
+
+
+
+
+
+
+ {slides.map((slide, index) => (
+ onThumbClick(index)}
+ selected={index === selectedIndex}
+ index={slide}
+ />
+ ))}
+
+
+
+
+ )
+}
+
+export default EmblaCarousel
diff --git a/src/components/Hero.jsx b/src/components/Hero.jsx
index d533fb3..a074fa1 100644
--- a/src/components/Hero.jsx
+++ b/src/components/Hero.jsx
@@ -105,13 +105,17 @@ export const Hero = () => {
transition={{ duration: 0.5, delay: 0.1 }}
>
- Transform spreadsheet data and view statistics in interactive data tables, download/upload from/to compatible
CKAN
- instances, and explore qsv pro.
+ {" "}
+ instances, and explore qsv pro.
{
>
{downloadData && OS !== "unknown" ? (
- <>
-
- Download qsv pro and explore the free plan
- or unlock features with a paid plan.
-
-
- {Object.keys(downloadData).map(
- (platform) => (
-
- {downloadData[platform].map(
- (download, index) => (
- <>
- {platform ===
- "windows" && (
-
- )}
-
- {download[0]}
-
- >
- )
- )}
-
- )
- )}
-
- >
+ <>
+
+ Download qsv pro and explore the free plan
+ or unlock features with a paid plan.
+
+
+ {Object.keys(downloadData).map(
+ (platform) => (
+
+ {downloadData[platform].map(
+ (download, index) => (
+ <>
+ {platform ===
+ "windows" && (
+
+ )}
+
+ {download[0]}
+
+ >
+ )
+ )}
+
+ )
+ )}
+
+ >
) : (
<>
@@ -185,8 +190,13 @@ export const Hero = () => {
+
+ You may access download links here on a
+ desktop device.
+
- Download qsv pro and explore the free plan or unlock features with a paid plan.
+ Download qsv pro and explore the free plan
+ or unlock features with a paid plan.
>
)}
@@ -206,7 +216,7 @@ export const Hero = () => {
>
- {/*
