diff --git a/src/components/LinkButton.astro b/src/components/LinkButton.astro
index 4f38fd5..84cdc0d 100644
--- a/src/components/LinkButton.astro
+++ b/src/components/LinkButton.astro
@@ -1,13 +1,13 @@
---
export interface Props {
- href: string;
- className?: string;
- ariaLabel?: string;
- title?: string;
- disabled?: boolean;
+ href: string
+ className?: string
+ ariaLabel?: string
+ title?: string
+ disabled?: boolean
}
-const { href, className, ariaLabel, title, disabled = false } = Astro.props;
+const { href, className, ariaLabel, title, disabled = false } = Astro.props
---
{
diff --git a/src/components/Pagination.astro b/src/components/Pagination.astro
index fb64089..30c5a14 100644
--- a/src/components/Pagination.astro
+++ b/src/components/Pagination.astro
@@ -1,17 +1,17 @@
---
-import LinkButton from "./LinkButton.astro";
+import LinkButton from "./LinkButton.astro"
export interface Props {
- currentPage: number;
- totalPages: number;
- prevUrl: string;
- nextUrl: string;
+ currentPage: number
+ totalPages: number
+ prevUrl: string
+ nextUrl: string
}
-const { currentPage, totalPages, prevUrl, nextUrl } = Astro.props;
+const { currentPage, totalPages, prevUrl, nextUrl } = Astro.props
-const prev = currentPage > 1 ? "" : "disabled";
-const next = currentPage < totalPages ? "" : "disabled";
+const prev = currentPage > 1 ? "" : "disabled"
+const next = currentPage < totalPages ? "" : "disabled"
---
{
diff --git a/src/components/Search.tsx b/src/components/Search.tsx
index c1a2000..4ab4766 100644
--- a/src/components/Search.tsx
+++ b/src/components/Search.tsx
@@ -1,34 +1,34 @@
-import Fuse from "fuse.js";
-import { useEffect, useRef, useState, useMemo } from "react";
-import Card from "@components/Card";
-import type { CollectionEntry } from "astro:content";
+import Fuse from "fuse.js"
+import { useEffect, useRef, useState, useMemo } from "react"
+import Card from "@components/Card"
+import type { CollectionEntry } from "astro:content"
export type SearchItem = {
- title: string;
- description: string;
- data: CollectionEntry<"blog">["data"];
- slug: string;
-};
+ title: string
+ description: string
+ data: CollectionEntry<"blog">["data"]
+ slug: string
+}
interface Props {
- searchList: SearchItem[];
+ searchList: SearchItem[]
}
interface SearchResult {
- item: SearchItem;
- refIndex: number;
+ item: SearchItem
+ refIndex: number
}
export default function SearchBar({ searchList }: Props) {
- const inputRef = useRef
(null);
- const [inputVal, setInputVal] = useState("");
+ const inputRef = useRef(null)
+ const [inputVal, setInputVal] = useState("")
const [searchResults, setSearchResults] = useState(
null
- );
+ )
const handleChange = (e: React.FormEvent) => {
- setInputVal(e.currentTarget.value);
- };
+ setInputVal(e.currentTarget.value)
+ }
const fuse = useMemo(
() =>
@@ -39,39 +39,39 @@ export default function SearchBar({ searchList }: Props) {
threshold: 0.5,
}),
[searchList]
- );
+ )
useEffect(() => {
// if URL has search query,
// insert that search query in input field
- const searchUrl = new URLSearchParams(window.location.search);
- const searchStr = searchUrl.get("q");
- if (searchStr) setInputVal(searchStr);
+ const searchUrl = new URLSearchParams(window.location.search)
+ const searchStr = searchUrl.get("q")
+ if (searchStr) setInputVal(searchStr)
// put focus cursor at the end of the string
setTimeout(function () {
inputRef.current!.selectionStart = inputRef.current!.selectionEnd =
- searchStr?.length || 0;
- }, 50);
- }, []);
+ searchStr?.length || 0
+ }, 50)
+ }, [])
useEffect(() => {
// Add search result only if
// input value is more than one character
- let inputResult = inputVal.length > 1 ? fuse.search(inputVal) : [];
- setSearchResults(inputResult);
+ let inputResult = inputVal.length > 1 ? fuse.search(inputVal) : []
+ setSearchResults(inputResult)
// Update search string in URL
if (inputVal.length > 0) {
- const searchParams = new URLSearchParams(window.location.search);
- searchParams.set("q", inputVal);
+ const searchParams = new URLSearchParams(window.location.search)
+ searchParams.set("q", inputVal)
const newRelativePathQuery =
- window.location.pathname + "?" + searchParams.toString();
- history.replaceState(history.state, "", newRelativePathQuery);
+ window.location.pathname + "?" + searchParams.toString()
+ history.replaceState(history.state, "", newRelativePathQuery)
} else {
- history.replaceState(history.state, "", window.location.pathname);
+ history.replaceState(history.state, "", window.location.pathname)
}
- }, [inputVal]);
+ }, [inputVal])
return (
<>
@@ -119,5 +119,5 @@ export default function SearchBar({ searchList }: Props) {
))}
>
- );
+ )
}
diff --git a/src/components/ShareLinks.astro b/src/components/ShareLinks.astro
index 12e49cf..07845d1 100644
--- a/src/components/ShareLinks.astro
+++ b/src/components/ShareLinks.astro
@@ -1,8 +1,8 @@
---
-import LinkButton from "./LinkButton.astro";
-import socialIcons from "@assets/socialIcons";
+import LinkButton from "./LinkButton.astro"
+import socialIcons from "@assets/socialIcons"
-const URL = Astro.url;
+const URL = Astro.url
const shareLinks = [
{
@@ -25,7 +25,7 @@ const shareLinks = [
href: "mailto:?subject=See%20this%20post&body=",
linkTitle: `Share this post via email`,
},
-] as const;
+] as const
---
diff --git a/src/components/Socials.astro b/src/components/Socials.astro
index cfc3dc8..f52ccd6 100755
--- a/src/components/Socials.astro
+++ b/src/components/Socials.astro
@@ -1,13 +1,13 @@
---
-import { SOCIALS } from "@config";
-import LinkButton from "./LinkButton.astro";
-import socialIcons from "@assets/socialIcons";
+import { SOCIALS } from "@config"
+import LinkButton from "./LinkButton.astro"
+import socialIcons from "@assets/socialIcons"
export interface Props {
- centered?: boolean;
+ centered?: boolean
}
-const { centered = false } = Astro.props;
+const { centered = false } = Astro.props
---
diff --git a/src/components/Speaking.astro b/src/components/Speaking.astro
index 68ae9fb..7f053bb 100644
--- a/src/components/Speaking.astro
+++ b/src/components/Speaking.astro
@@ -1,5 +1,5 @@
---
-import speakingData from "../data/speakingData.json";
+import speakingData from "../data/speakingData.json"
---
@@ -26,6 +26,9 @@ import speakingData from "../data/speakingData.json";
}