Skip to content

Commit 116c01b

Browse files
committed
fix: rule of hooks
1 parent 4970829 commit 116c01b

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

apps/www/components/mdx-components.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from "react";
2-
import { CodeBlock } from "./code-block";
31
import Link from "next/link";
2+
import Image from "next/image";
3+
import { CodeBlock } from "./code-block";
44

55
export 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
),

apps/www/lib/get-cli-version.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { useGet } from "@/hooks/use-fetch";
1+
import { useGet as fetchGet } from "@/hooks/use-fetch";
22

33
export 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

apps/www/lib/get-hook-doc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { useFetch } from "@/hooks/use-fetch";
1+
import { useFetch as fetchData } from "@/hooks/use-fetch";
22
import { HookDoc } from "./types";
33

44
export 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;

apps/www/lib/get-hook-source.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { useFetch } from "@/hooks/use-fetch";
1+
import { useFetch as fetchData } from "@/hooks/use-fetch";
22

33
export 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";

apps/www/lib/get-hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { useFetch } from "@/hooks/use-fetch";
1+
import { useFetch as fetchData } from "@/hooks/use-fetch";
22
import { HookMeta } from "./types";
33

44
const hooksUrl =
55
"https://raw.githubusercontent.com/small-lab-io/usehooks.io/main/packages/hooks/src/index.json";
66

77
export 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 [];

0 commit comments

Comments
 (0)