@@ -3,8 +3,8 @@ import { CollectionEntry, getCollection } from "astro:content";
33import Layout from " ../layouts/Layout.astro" ;
44import NavInternal from " ../sections/NavInternal.astro" ;
55import Footer from " ../sections/Footer.astro" ;
6- import RelatedHook from " ../components/RelatedHook .astro" ;
7- import Install from ' ../components/Install.astro ' ;
6+ import Install from " ../components/Install .astro" ;
7+ import HooksList from " ../components/search/HooksList " ;
88
99export async function getStaticPaths() {
1010 const hooks = await getCollection (" hooks" );
@@ -27,14 +27,24 @@ interface Props {
2727
2828const { hook } = Astro .props ;
2929const { Content } = await hook .render ();
30- const { name, tagline, relatedHooks, experimental } = hook .data ;
30+ const { name, tagline, experimental } = hook .data ;
3131const ogImage = new URL (` /meta/${name .toLowerCase ()}.png ` , Astro .url );
3232const installSnippet = experimental
3333 ? ` npm i @uidotdev/usehooks@experimental react@experimental react-dom@experimental `
3434 : ` npm i @uidotdev/usehooks ` ;
35+
36+ const hooks = await getCollection (" hooks" ).then ((hooks ) => {
37+ return hooks .filter ((h ) => {
38+ return h .slug !== hook .slug ;
39+ });
40+ });
3541---
3642
37- <Layout title ={ ` ${name } React Hook – useHooks ` } description ={ tagline } ogImage ={ ogImage } >
43+ <Layout
44+ title ={ ` ${name } React Hook – useHooks ` }
45+ description ={ tagline }
46+ ogImage ={ ogImage }
47+ >
3848 <NavInternal />
3949 <main >
4050 <section >
@@ -61,19 +71,12 @@ const installSnippet = experimental
6171 )
6272 }
6373 <Install text ={ installSnippet } />
64-
6574 </div >
6675 <Content />
6776 </section >
6877 <div class =" mt-12" >
69- <h2 >Related Hooks:</h2 >
70- <ul class =" related-hooks" >
71- {
72- relatedHooks .map ((hook ) => {
73- return <RelatedHook { ... hook } />;
74- })
75- }
76- </ul >
78+ <h2 >Other Hooks:</h2 >
79+ <HooksList client:load hooks ={ hooks } />
7780 </div >
7881 </main >
7982 <Footer />
@@ -92,7 +95,7 @@ const installSnippet = experimental
9295 }
9396
9497 section {
95- padding: clamp(.5rem, 4vw, 3rem);
98+ padding: clamp(0 .5rem, 4vw, 3rem);
9699 padding-top: 0;
97100 display: flex;
98101 flex-direction: column;
@@ -167,7 +170,7 @@ const installSnippet = experimental
167170 }
168171
169172 :global(.reference h3) {
170- font-size: clamp(.9rem, 2vw, 1.1rem);
173+ font-size: clamp(0 .9rem, 2vw, 1.1rem);
171174 }
172175
173176 :global(.reference .table-container) {
@@ -178,7 +181,7 @@ const installSnippet = experimental
178181 }
179182
180183 :global(.reference table) {
181- border-radius: .9rem;
184+ border-radius: 0 .9rem;
182185 font-size: clamp(1rem, 2.1vw, 1.2rem);
183186 }
184187
@@ -199,7 +202,7 @@ const installSnippet = experimental
199202
200203 :global(.reference td),
201204 :global(.reference th) {
202- padding: .5rem 1.2rem .5rem .75rem;
205+ padding: 0 .5rem 1.2rem 0 .5rem 0 .75rem;
203206 }
204207
205208 :global(.reference td:not(:last-of-type)),
@@ -213,13 +216,6 @@ const installSnippet = experimental
213216 min-width: 300px;
214217 }
215218
216- .related-hooks {
217- display: grid;
218- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
219- gap: clamp(1.2rem, 2.5vw, 2rem);
220- margin-top: 0;
221- }
222-
223219 :global(.sp-preview-container),
224220 :global(.sp-preview-container iframe) {
225221 background: var(--coal) !important;
0 commit comments