Skip to content

Commit 6d0aa07

Browse files
fix(home): resolve slider visibility issue on home page (#56) (#86)
* fix: Add Dropdown / Select Component #11 (#33) * fix(home): resolve slider visibility issue on home page (#56) --------- Co-authored-by: Yashveer Singh <astomar6396@gmail.com>
1 parent c1025ad commit 6d0aa07

3 files changed

Lines changed: 24 additions & 33 deletions

File tree

package-lock.json

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/page.tsx

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useState, useMemo } from "react";
33
import { ComponentCard } from "@/components/ComponentCard";
44
import { componentsData } from "@/data/components";
55
import { Input } from "@/components/ui/input";
6+
import { Slider } from "../components/ui/slider";
67
import { Badge } from "@/components/ui/badge";
78
import { Github, Search, Sparkles, Filter, X } from "lucide-react";
89
import { Button } from "@/components/ui/button";
@@ -12,8 +13,6 @@ import { Toaster } from "sonner";
1213
const Index = () => {
1314
const [searchQuery, setSearchQuery] = useState("");
1415
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
15-
16-
// Get all unique categories with counts
1716
const categories = useMemo(() => {
1817
const categoryMap = new Map<string, number>();
1918
componentsData.forEach(component => {
@@ -23,26 +22,18 @@ const Index = () => {
2322
});
2423
return Array.from(categoryMap.entries()).map(([name, count]) => ({ name, count }));
2524
}, []);
26-
27-
// Enhanced filtering with better search
2825
const filteredComponents = useMemo(() => {
2926
return componentsData.filter(component => {
3027
const searchLower = searchQuery.toLowerCase().trim();
31-
32-
// Enhanced search: title, description, category, and id
33-
const matchesSearch = !searchLower ||
28+
const matchesSearch = !searchLower ||
3429
component.title.toLowerCase().includes(searchLower) ||
3530
component.description.toLowerCase().includes(searchLower) ||
3631
component.category?.toLowerCase().includes(searchLower) ||
3732
component.id.toLowerCase().includes(searchLower);
38-
3933
const matchesCategory = !selectedCategory || component.category === selectedCategory;
40-
4134
return matchesSearch && matchesCategory;
4235
});
4336
}, [searchQuery, selectedCategory]);
44-
45-
// Clear all filters
4637
const clearFilters = () => {
4738
setSearchQuery("");
4839
setSelectedCategory(null);
@@ -52,7 +43,6 @@ const Index = () => {
5243

5344
return (
5445
<div className="min-h-screen bg-zinc-50">
55-
{/* Hero Section */}
5646
<section className="relative overflow-hidden border-b border-border">
5747
<div className="absolute inset-0 bg-gradient-primary opacity-5" />
5848
<div className="absolute inset-0">
@@ -76,23 +66,28 @@ const Index = () => {
7666
Copy, paste, and customize to build amazing UIs.
7767
</p>
7868

79-
<div className="flex items-center justify-center gap-3 sm:gap-4 flex-wrap px-4">
80-
<Link href={"https://github.com/fahimahammed/DevUI"}>
81-
<Button size="lg" className="bg-primary hover:opacity-90 transition-opacity text-sm sm:text-base">
82-
<Github className="mr-2 h-4 w-4 sm:h-5 sm:w-5" />
83-
<span className="hidden sm:inline">Star on GitHub</span>
84-
<span className="sm:hidden">Star</span>
85-
</Button>
86-
</Link>
87-
<Button size="lg" variant="outline" className="border-primary/20 hover:bg-primary/5 text-sm sm:text-base">
88-
<span className="hidden sm:inline">Browse Components</span>
89-
<span className="sm:hidden">Browse</span>
90-
</Button>
91-
<Link href="/about">
92-
<Button size="lg" variant="ghost" className="text-primary font-semibold border border-primary/10 hover:bg-primary/10 text-sm sm:text-base">
93-
About Us
69+
<div className="flex flex-col items-center justify-center gap-6 sm:gap-8 px-4">
70+
<div className="w-full max-w-md mx-auto">
71+
<Slider defaultValue={[40]} min={0} max={100} className="my-4" />
72+
</div>
73+
<div className="flex items-center justify-center gap-3 sm:gap-4 flex-wrap">
74+
<Link href={"https://github.com/fahimahammed/DevUI"}>
75+
<Button size="lg" className="bg-primary hover:opacity-90 transition-opacity text-sm sm:text-base">
76+
<Github className="mr-2 h-4 w-4 sm:h-5 sm:w-5" />
77+
<span className="hidden sm:inline">Star on GitHub</span>
78+
<span className="sm:hidden">Star</span>
79+
</Button>
80+
</Link>
81+
<Button size="lg" variant="outline" className="border-primary/20 hover:bg-primary/5 text-sm sm:text-base">
82+
<span className="hidden sm:inline">Browse Components</span>
83+
<span className="sm:hidden">Browse</span>
9484
</Button>
95-
</Link>
85+
<Link href="/about">
86+
<Button size="lg" variant="ghost" className="text-primary font-semibold border border-primary/10 hover:bg-primary/10 text-sm sm:text-base">
87+
About Us
88+
</Button>
89+
</Link>
90+
</div>
9691
</div>
9792

9893
<div className="flex items-center justify-center gap-2 sm:gap-4 text-xs sm:text-sm text-muted-foreground flex-wrap">
@@ -130,7 +125,6 @@ const Index = () => {
130125
)}
131126
</div>
132127

133-
{/* Filter Header */}
134128
<div className="flex items-center justify-between flex-wrap gap-3 sm:gap-4">
135129
<div className="flex items-center gap-2">
136130
<Filter className="h-3 w-3 sm:h-4 sm:w-4 text-muted-foreground" />

src/data/components.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { toast } from "sonner";
4040

4141

4242

43+
4344
export const componentsData = [
4445
{
4546
id: "button",

0 commit comments

Comments
 (0)