fix: apply reset style for ul

This commit is contained in:
Sonny
2023-11-21 17:47:55 +01:00
parent d16c61ff5a
commit 7a7d496dfe
8 changed files with 22 additions and 17 deletions

View File

@@ -16,6 +16,7 @@ const config = {
{ hostname: "localhost" },
{ hostname: "t3.gstatic.com" },
{ hostname: "lh3.googleusercontent.com" },
{ hostname: "mylinks.app" },
],
formats: ["image/webp"],
},

View File

@@ -4,7 +4,7 @@ import PATHS from "constants/paths";
import styles from "./navbar.module.scss";
import { useTranslation } from "next-i18next";
import Image from "next/image";
import { TFunctionParam } from "../../types/i18next";
import { TFunctionParam } from "types/i18next";
export default function Navbar() {
const { data, status } = useSession();

View File

@@ -6,6 +6,7 @@ import { SearchItem } from "types";
import { groupItemBy } from "utils/array";
import SearchListItem from "./SearchListItem";
import styles from "./search.module.scss";
import clsx from "clsx";
const isActiveItem = (item: SearchItem, otherItem: SearchItem) =>
item?.id === otherItem?.id && item?.type === otherItem?.type;
@@ -60,12 +61,12 @@ export default function SearchList({
}, [items, setSelectedItem]);
return (
<ul className={styles["search-list"]}>
<ul className={clsx(styles["search-list"], "reset")}>
{groupedItems.length > 0 ? (
groupedItems.map(([key, items]) => (
<li key={`${key}-${key}`}>
<span>{typeof key === "undefined" ? "-" : key}</span>
<ul>
<ul className="reset">
{items.map((item) => (
<SearchListItem
item={item}

View File

@@ -2,6 +2,7 @@ import { useTranslation } from "next-i18next";
import { Link } from "types";
import FavoriteItem from "./FavoriteItem";
import styles from "./favorites.module.scss";
import clsx from "clsx";
export default function Favorites({ favorites }: { favorites: Link[] }) {
const { t } = useTranslation();
@@ -10,7 +11,7 @@ export default function Favorites({ favorites }: { favorites: Link[] }) {
favorites.length !== 0 && (
<div className={styles["favorites"]}>
<h4>{t("common:favorite")}</h4>
<ul className={styles["items"]}>
<ul className={clsx(styles["items"], "reset")}>
{favorites.map((link) => (
<FavoriteItem link={link} key={link.id} />
))}

View File

@@ -11,5 +11,5 @@ export const REL_LIST = [
"apple-touch-icon-precomposed",
"apple-touch-startup-image",
"mask-icon",
"fluid-icon"
"fluid-icon",
];

View File

@@ -2,4 +2,5 @@ export const isImage = (type: string) => type.includes("image");
export const isBase64Image = (data: string) => data.startsWith("data:image/");
export const convertBase64ToBuffer = (base64: string) => Buffer.from(base64, "base64");
export const convertBase64ToBuffer = (base64: string) =>
Buffer.from(base64, "base64");

View File

@@ -7,8 +7,8 @@ import { isImage } from "./image";
export async function makeRequest({
method = "GET",
url,
body
}: {
body,
}: {
method?: RequestInit["method"];
url: string;
body?: object | any[];
@@ -18,8 +18,8 @@ export async function makeRequest({
method,
body: body ? JSON.stringify(body) : undefined,
headers: {
"Content-Type": "application/json"
}
"Content-Type": "application/json",
},
});
nProgress.done();
@@ -47,7 +47,7 @@ export async function downloadImageFromUrl(url: string): Promise<Favicon> {
buffer: Buffer.from(await blob.arrayBuffer()),
url: request.url,
type: blob.type,
size: blob.size
size: blob.size,
};
}

View File

@@ -1,5 +1,5 @@
import { parse } from "node-html-parser";
import { REL_LIST } from "../constants/url";
import { REL_LIST } from "constants/url";
export function buildFaviconUrl(urlParam: string, faviconPath: string) {
const { origin } = new URL(urlParam);
@@ -34,14 +34,15 @@ function urlWithoutSearchParams(urlParam: string) {
export function removeLastSectionUrl(urlParam: string) {
const urlArr = urlParam.split("/");
urlArr.pop();
return (urlArr.join("/"));
return urlArr.join("/");
}
export function findFaviconPath(text: string) {
const document = parse(text);
const favicon = Array.from(document.getElementsByTagName("link")).find(
(element) => REL_LIST.includes(element.getAttribute("rel")) &&
element.getAttribute("href")
(element) =>
REL_LIST.includes(element.getAttribute("rel")) &&
element.getAttribute("href"),
);
return favicon?.getAttribute("href") || undefined;