mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-10 15:35:35 +00:00
fix: apply reset style for ul
This commit is contained in:
@@ -16,6 +16,7 @@ const config = {
|
|||||||
{ hostname: "localhost" },
|
{ hostname: "localhost" },
|
||||||
{ hostname: "t3.gstatic.com" },
|
{ hostname: "t3.gstatic.com" },
|
||||||
{ hostname: "lh3.googleusercontent.com" },
|
{ hostname: "lh3.googleusercontent.com" },
|
||||||
|
{ hostname: "mylinks.app" },
|
||||||
],
|
],
|
||||||
formats: ["image/webp"],
|
formats: ["image/webp"],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import PATHS from "constants/paths";
|
|||||||
import styles from "./navbar.module.scss";
|
import styles from "./navbar.module.scss";
|
||||||
import { useTranslation } from "next-i18next";
|
import { useTranslation } from "next-i18next";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { TFunctionParam } from "../../types/i18next";
|
import { TFunctionParam } from "types/i18next";
|
||||||
|
|
||||||
export default function Navbar() {
|
export default function Navbar() {
|
||||||
const { data, status } = useSession();
|
const { data, status } = useSession();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { SearchItem } from "types";
|
|||||||
import { groupItemBy } from "utils/array";
|
import { groupItemBy } from "utils/array";
|
||||||
import SearchListItem from "./SearchListItem";
|
import SearchListItem from "./SearchListItem";
|
||||||
import styles from "./search.module.scss";
|
import styles from "./search.module.scss";
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
const isActiveItem = (item: SearchItem, otherItem: SearchItem) =>
|
const isActiveItem = (item: SearchItem, otherItem: SearchItem) =>
|
||||||
item?.id === otherItem?.id && item?.type === otherItem?.type;
|
item?.id === otherItem?.id && item?.type === otherItem?.type;
|
||||||
@@ -60,12 +61,12 @@ export default function SearchList({
|
|||||||
}, [items, setSelectedItem]);
|
}, [items, setSelectedItem]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul className={styles["search-list"]}>
|
<ul className={clsx(styles["search-list"], "reset")}>
|
||||||
{groupedItems.length > 0 ? (
|
{groupedItems.length > 0 ? (
|
||||||
groupedItems.map(([key, items]) => (
|
groupedItems.map(([key, items]) => (
|
||||||
<li key={`${key}-${key}`}>
|
<li key={`${key}-${key}`}>
|
||||||
<span>{typeof key === "undefined" ? "-" : key}</span>
|
<span>{typeof key === "undefined" ? "-" : key}</span>
|
||||||
<ul>
|
<ul className="reset">
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
<SearchListItem
|
<SearchListItem
|
||||||
item={item}
|
item={item}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useTranslation } from "next-i18next";
|
|||||||
import { Link } from "types";
|
import { Link } from "types";
|
||||||
import FavoriteItem from "./FavoriteItem";
|
import FavoriteItem from "./FavoriteItem";
|
||||||
import styles from "./favorites.module.scss";
|
import styles from "./favorites.module.scss";
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
export default function Favorites({ favorites }: { favorites: Link[] }) {
|
export default function Favorites({ favorites }: { favorites: Link[] }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -10,7 +11,7 @@ export default function Favorites({ favorites }: { favorites: Link[] }) {
|
|||||||
favorites.length !== 0 && (
|
favorites.length !== 0 && (
|
||||||
<div className={styles["favorites"]}>
|
<div className={styles["favorites"]}>
|
||||||
<h4>{t("common:favorite")}</h4>
|
<h4>{t("common:favorite")}</h4>
|
||||||
<ul className={styles["items"]}>
|
<ul className={clsx(styles["items"], "reset")}>
|
||||||
{favorites.map((link) => (
|
{favorites.map((link) => (
|
||||||
<FavoriteItem link={link} key={link.id} />
|
<FavoriteItem link={link} key={link.id} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -11,5 +11,5 @@ export const REL_LIST = [
|
|||||||
"apple-touch-icon-precomposed",
|
"apple-touch-icon-precomposed",
|
||||||
"apple-touch-startup-image",
|
"apple-touch-startup-image",
|
||||||
"mask-icon",
|
"mask-icon",
|
||||||
"fluid-icon"
|
"fluid-icon",
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -2,4 +2,5 @@ export const isImage = (type: string) => type.includes("image");
|
|||||||
|
|
||||||
export const isBase64Image = (data: string) => data.startsWith("data: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");
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import { isImage } from "./image";
|
|||||||
export async function makeRequest({
|
export async function makeRequest({
|
||||||
method = "GET",
|
method = "GET",
|
||||||
url,
|
url,
|
||||||
body
|
body,
|
||||||
}: {
|
}: {
|
||||||
method?: RequestInit["method"];
|
method?: RequestInit["method"];
|
||||||
url: string;
|
url: string;
|
||||||
body?: object | any[];
|
body?: object | any[];
|
||||||
@@ -18,8 +18,8 @@ export async function makeRequest({
|
|||||||
method,
|
method,
|
||||||
body: body ? JSON.stringify(body) : undefined,
|
body: body ? JSON.stringify(body) : undefined,
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
nProgress.done();
|
nProgress.done();
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ export async function downloadImageFromUrl(url: string): Promise<Favicon> {
|
|||||||
buffer: Buffer.from(await blob.arrayBuffer()),
|
buffer: Buffer.from(await blob.arrayBuffer()),
|
||||||
url: request.url,
|
url: request.url,
|
||||||
type: blob.type,
|
type: blob.type,
|
||||||
size: blob.size
|
size: blob.size,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { parse } from "node-html-parser";
|
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) {
|
export function buildFaviconUrl(urlParam: string, faviconPath: string) {
|
||||||
const { origin } = new URL(urlParam);
|
const { origin } = new URL(urlParam);
|
||||||
@@ -34,14 +34,15 @@ function urlWithoutSearchParams(urlParam: string) {
|
|||||||
export function removeLastSectionUrl(urlParam: string) {
|
export function removeLastSectionUrl(urlParam: string) {
|
||||||
const urlArr = urlParam.split("/");
|
const urlArr = urlParam.split("/");
|
||||||
urlArr.pop();
|
urlArr.pop();
|
||||||
return (urlArr.join("/"));
|
return urlArr.join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function findFaviconPath(text: string) {
|
export function findFaviconPath(text: string) {
|
||||||
const document = parse(text);
|
const document = parse(text);
|
||||||
const favicon = Array.from(document.getElementsByTagName("link")).find(
|
const favicon = Array.from(document.getElementsByTagName("link")).find(
|
||||||
(element) => REL_LIST.includes(element.getAttribute("rel")) &&
|
(element) =>
|
||||||
element.getAttribute("href")
|
REL_LIST.includes(element.getAttribute("rel")) &&
|
||||||
|
element.getAttribute("href"),
|
||||||
);
|
);
|
||||||
|
|
||||||
return favicon?.getAttribute("href") || undefined;
|
return favicon?.getAttribute("href") || undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user