File tree Expand file tree Collapse file tree 5 files changed +13
-13
lines changed
Expand file tree Collapse file tree 5 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 1- import React from "react" ;
2- import { CodeBlock } from "./code-block" ;
31import Link from "next/link" ;
2+ import Image from "next/image" ;
3+ import { CodeBlock } from "./code-block" ;
44
55export const MDXComponents = {
66 h1 : ( { children } : { children : React . ReactNode } ) => (
@@ -67,9 +67,9 @@ export const MDXComponents = {
6767 < code > { children } </ code >
6868 ) ,
6969 img : ( { src, alt } : { src ?: string ; alt ?: string } ) => (
70- < img
71- src = { src }
72- alt = { alt }
70+ < Image
71+ src = { src ?? "" }
72+ alt = { alt ?? "" }
7373 className = "border-border my-8 h-auto max-w-full rounded-md border"
7474 />
7575 ) ,
Original file line number Diff line number Diff line change 1- import { useGet } from "@/hooks/use-fetch" ;
1+ import { useGet as fetchGet } from "@/hooks/use-fetch" ;
22
33export async function getCliVersion ( ) : Promise < string > {
44 try {
5- const data = await useGet (
5+ const data = await fetchGet (
66 "https://raw.githubusercontent.com/small-lab-io/usehooks.io/main/packages/usehooks-cli/package.json"
77 ) ;
88
Original file line number Diff line number Diff line change 1- import { useFetch } from "@/hooks/use-fetch" ;
1+ import { useFetch as fetchData } from "@/hooks/use-fetch" ;
22import { HookDoc } from "./types" ;
33
44export async function getHookDoc ( name : string ) : Promise < HookDoc | null > {
55 const docUrl = `https://raw.githubusercontent.com/small-lab-io/usehooks.io/main/packages/hooks/src/${ name } /doc.json` ;
66
77 try {
8- return await useFetch < HookDoc > ( docUrl ) ;
8+ return await fetchData < HookDoc > ( docUrl ) ;
99 } catch ( error ) {
1010 console . error ( `Error fetching hook doc: ${ error } ` ) ;
1111 return null ;
Original file line number Diff line number Diff line change 1- import { useFetch } from "@/hooks/use-fetch" ;
1+ import { useFetch as fetchData } from "@/hooks/use-fetch" ;
22
33export async function getHookSource ( name : string ) : Promise < string > {
44 const sourceUrl = `https://raw.githubusercontent.com/small-lab-io/usehooks.io/main/packages/hooks/src/${ name } /index.ts` ;
55
66 try {
7- return await useFetch < string > ( sourceUrl ) ;
7+ return await fetchData < string > ( sourceUrl ) ;
88 } catch ( error ) {
99 console . error ( `Error fetching hook source: ${ error } ` ) ;
1010 return "Source code not available" ;
Original file line number Diff line number Diff line change 1- import { useFetch } from "@/hooks/use-fetch" ;
1+ import { useFetch as fetchData } from "@/hooks/use-fetch" ;
22import { HookMeta } from "./types" ;
33
44const hooksUrl =
55 "https://raw.githubusercontent.com/small-lab-io/usehooks.io/main/packages/hooks/src/index.json" ;
66
77export async function getHooks ( ) : Promise < HookMeta [ ] > {
88 try {
9- return await useFetch < HookMeta [ ] > ( hooksUrl ) ;
9+ return await fetchData < HookMeta [ ] > ( hooksUrl ) ;
1010 } catch ( error ) {
1111 console . error ( "Error fetching hooks:" , error ) ;
1212 return [ ] ;
You can’t perform that action at this time.
0 commit comments