@tscircuit/fake-snippets 0.0.95 → 0.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,9 +29,7 @@ export const DatasheetsPage: React.FC = () => {
29
29
  } else {
30
30
  params.append("is_popular", "true")
31
31
  }
32
- const { data } = await axios.get(
33
- `/api/datasheets/list?${params.toString()}`,
34
- )
32
+ const { data } = await axios.get(`/datasheets/list?${params.toString()}`)
35
33
  return data.datasheets as DatasheetSummary[]
36
34
  },
37
35
  { keepPreviousData: true },
@@ -40,36 +38,88 @@ export const DatasheetsPage: React.FC = () => {
40
38
  return (
41
39
  <div className="min-h-screen flex flex-col">
42
40
  <Header />
43
- <main className="container mx-auto flex-1 px-4 py-8">
44
- <h1 className="text-3xl font-bold mb-6">Datasheets</h1>
45
- <div className="max-w-md mb-6">
46
- <div className="relative">
47
- <Search className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400 h-4 w-4" />
48
- <Input
49
- type="search"
50
- placeholder="Search datasheets..."
51
- className="pl-10"
52
- value={searchQuery}
53
- onChange={(e) => setSearchQuery(e.target.value)}
54
- aria-label="Search datasheets"
55
- role="searchbox"
56
- />
41
+ <main className="flex-grow container mx-auto px-4 py-8">
42
+ <div className="mb-8 max-w-3xl">
43
+ <div className="flex items-center gap-2 mb-3">
44
+ <h1 className="text-4xl font-bold text-gray-900">Datasheets</h1>
57
45
  </div>
46
+ <p className="text-lg text-gray-600 mb-4">
47
+ Explore datasheets for popular electronic components and chips.
48
+ Search to find specific ones.
49
+ </p>
58
50
  </div>
51
+
52
+ <div className="mb-6">
53
+ <div className="flex flex-col sm:flex-row gap-4 mb-4">
54
+ <div className="relative flex-grow">
55
+ <Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4" />
56
+ <Input
57
+ type="search"
58
+ placeholder="Search datasheets..."
59
+ className="pl-10"
60
+ value={searchQuery}
61
+ onChange={(e) => setSearchQuery(e.target.value)}
62
+ aria-label="Search datasheets"
63
+ role="searchbox"
64
+ />
65
+ </div>
66
+ </div>
67
+ </div>
68
+
59
69
  {isLoading ? (
60
- <p>Loading...</p>
70
+ <div className="text-center py-12 px-4">
71
+ <div className="bg-slate-50 inline-flex rounded-full p-4 mb-4">
72
+ <Search className="w-8 h-8 text-slate-400" />
73
+ </div>
74
+ <h3 className="text-xl font-medium text-slate-900 mb-2">
75
+ Loading Datasheets
76
+ </h3>
77
+ <p className="text-slate-500 max-w-md mx-auto mb-6">
78
+ Please wait while we fetch the datasheets...
79
+ </p>
80
+ </div>
61
81
  ) : error ? (
62
- <p>Error loading datasheets.</p>
82
+ <div className="bg-red-50 border border-red-200 text-red-700 p-6 rounded-xl shadow-sm max-w-2xl mx-auto">
83
+ <div className="flex items-start">
84
+ <div className="mr-4 bg-red-100 p-2 rounded-full">
85
+ <Search className="w-6 h-6 text-red-600" />
86
+ </div>
87
+ <div>
88
+ <h3 className="text-lg font-semibold mb-2">
89
+ Error Loading Datasheets
90
+ </h3>
91
+ <p className="text-red-600">
92
+ We couldn't load the datasheets. Please try again later.
93
+ </p>
94
+ </div>
95
+ </div>
96
+ </div>
63
97
  ) : datasheets && datasheets.length > 0 ? (
64
- <ul className="list-disc pl-5 space-y-2">
98
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
65
99
  {datasheets.map((ds) => (
66
- <li key={ds.datasheet_id}>
67
- <Link href={`/datasheets/${ds.chip_name}`}>{ds.chip_name}</Link>
68
- </li>
100
+ <Link
101
+ key={ds.datasheet_id}
102
+ href={`/datasheets/${ds.chip_name}`}
103
+ className="block p-4 bg-white rounded-lg shadow hover:shadow-md transition-shadow"
104
+ >
105
+ <h3 className="font-semibold text-gray-900">{ds.chip_name}</h3>
106
+ </Link>
69
107
  ))}
70
- </ul>
108
+ </div>
71
109
  ) : (
72
- <p>No datasheets found.</p>
110
+ <div className="text-center py-12 px-4">
111
+ <div className="bg-slate-50 inline-flex rounded-full p-4 mb-4">
112
+ <Search className="w-8 h-8 text-slate-400" />
113
+ </div>
114
+ <h3 className="text-xl font-medium text-slate-900 mb-2">
115
+ No Matching Datasheets
116
+ </h3>
117
+ <p className="text-slate-500 max-w-md mx-auto mb-6">
118
+ {searchQuery
119
+ ? `No datasheets match your search for "${searchQuery}".`
120
+ : "There are no popular datasheets at the moment."}
121
+ </p>
122
+ </div>
73
123
  )}
74
124
  </main>
75
125
  <Footer />