update link component icons

This commit is contained in:
Yee Jia Wei
2023-12-17 16:30:09 +08:00
parent e910172558
commit 500f7a338c
4 changed files with 16 additions and 33 deletions
@@ -2,9 +2,7 @@ import {
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
import { faLink } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useEffect, useState } from "react";
import React, { useEffect, useState } from "react";
import useLinkStore from "@/store/links";
import useCollectionStore from "@/store/collections";
import isValidUrl from "@/lib/shared/isValidUrl";
@@ -62,7 +60,7 @@ export default function LinkCard({ link, count, className }: Props) {
className="flex flex-col justify-between cursor-pointer h-full w-full gap-1 p-3"
>
<div className="absolute bottom-3 right-3">
<LinkIcon link={link} />
<LinkIcon link={link}/>
</div>
<div className="flex items-baseline gap-1">
@@ -74,19 +72,19 @@ export default function LinkCard({ link, count, className }: Props) {
{link.url ? (
<div className="flex items-center gap-1 max-w-full w-fit text-neutral">
<FontAwesomeIcon icon={faLink} className="mt-1 w-4 h-4" />
<i className="bi-link-45deg"/>
<p className="truncate w-full">{shortendURL}</p>
</div>
) : (
<div className="badge badge-primary badge-sm my-1">{link.type}</div>
)}
<LinkCollection link={link} collection={collection} />
<LinkCollection link={link} collection={collection}/>
<LinkDate link={link} />
<LinkDate link={link}/>
</div>
<LinkActions link={link} collection={collection} />
<LinkActions link={link} collection={collection}/>
</div>
);
}
@@ -2,14 +2,10 @@ import {
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faFolder } from "@fortawesome/free-solid-svg-icons";
import { useRouter } from "next/router";
import React from "react";
export default function LinkCollection({
link,
collection,
}: {
export default function LinkCollection({ link, collection }: {
link: LinkIncludingShortenedCollectionAndTags;
collection: CollectionIncludingMembersAndLinkCount;
}) {
@@ -23,11 +19,7 @@ export default function LinkCollection({
}}
className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100"
>
<FontAwesomeIcon
icon={faFolder}
className="w-4 h-4 shadow"
style={{ color: collection?.color }}
/>
<i className="bi-folder2 text-lg shadow" style={{ color: collection?.color }}></i>
<p className="truncate capitalize">{collection?.name}</p>
</div>
);
@@ -1,10 +1,7 @@
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faCalendarDays } from "@fortawesome/free-regular-svg-icons";
import React from "react";
export default function LinkDate({
link,
}: {
export default function LinkDate({ link }: {
link: LinkIncludingShortenedCollectionAndTags;
}) {
const formattedDate = new Date(link.createdAt as string).toLocaleString(
@@ -18,7 +15,7 @@ export default function LinkDate({
return (
<div className="flex items-center gap-1 text-neutral">
<FontAwesomeIcon icon={faCalendarDays} className="w-4 h-4" />
<i className="bi-calendar3 text-lg"></i>
<p>{formattedDate}</p>
</div>
);
@@ -1,13 +1,9 @@
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faFileImage, faFilePdf } from "@fortawesome/free-regular-svg-icons";
import Image from "next/image";
import isValidUrl from "@/lib/shared/isValidUrl";
import React from "react";
export default function LinkIcon({
link,
width,
}: {
export default function LinkIcon({ link, width }: {
link: LinkIncludingShortenedCollectionAndTags;
width?: string;
}) {
@@ -35,9 +31,9 @@ export default function LinkIcon({
}}
/>
) : link.type === "pdf" ? (
<FontAwesomeIcon icon={faFilePdf} className={iconClasses} />
<i className={`bi-file-earmark-pdf ${iconClasses}`}></i>
) : link.type === "image" ? (
<FontAwesomeIcon icon={faFileImage} className={iconClasses} />
<i className={`bi-file-earmark-image ${iconClasses}`}></i>
) : undefined}
</div>
);