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, CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags, LinkIncludingShortenedCollectionAndTags,
} from "@/types/global"; } from "@/types/global";
import { faLink } from "@fortawesome/free-solid-svg-icons"; import React, { useEffect, useState } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useEffect, useState } from "react";
import useLinkStore from "@/store/links"; import useLinkStore from "@/store/links";
import useCollectionStore from "@/store/collections"; import useCollectionStore from "@/store/collections";
import isValidUrl from "@/lib/shared/isValidUrl"; 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" className="flex flex-col justify-between cursor-pointer h-full w-full gap-1 p-3"
> >
<div className="absolute bottom-3 right-3"> <div className="absolute bottom-3 right-3">
<LinkIcon link={link} /> <LinkIcon link={link}/>
</div> </div>
<div className="flex items-baseline gap-1"> <div className="flex items-baseline gap-1">
@@ -74,19 +72,19 @@ export default function LinkCard({ link, count, className }: Props) {
{link.url ? ( {link.url ? (
<div className="flex items-center gap-1 max-w-full w-fit text-neutral"> <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> <p className="truncate w-full">{shortendURL}</p>
</div> </div>
) : ( ) : (
<div className="badge badge-primary badge-sm my-1">{link.type}</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> </div>
<LinkActions link={link} collection={collection} /> <LinkActions link={link} collection={collection}/>
</div> </div>
); );
} }
@@ -2,14 +2,10 @@ import {
CollectionIncludingMembersAndLinkCount, CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags, LinkIncludingShortenedCollectionAndTags,
} from "@/types/global"; } from "@/types/global";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faFolder } from "@fortawesome/free-solid-svg-icons";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import React from "react";
export default function LinkCollection({ export default function LinkCollection({ link, collection }: {
link,
collection,
}: {
link: LinkIncludingShortenedCollectionAndTags; link: LinkIncludingShortenedCollectionAndTags;
collection: CollectionIncludingMembersAndLinkCount; 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" className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100"
> >
<FontAwesomeIcon <i className="bi-folder2 text-lg shadow" style={{ color: collection?.color }}></i>
icon={faFolder}
className="w-4 h-4 shadow"
style={{ color: collection?.color }}
/>
<p className="truncate capitalize">{collection?.name}</p> <p className="truncate capitalize">{collection?.name}</p>
</div> </div>
); );
@@ -1,10 +1,7 @@
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import React from "react";
import { faCalendarDays } from "@fortawesome/free-regular-svg-icons";
export default function LinkDate({ export default function LinkDate({ link }: {
link,
}: {
link: LinkIncludingShortenedCollectionAndTags; link: LinkIncludingShortenedCollectionAndTags;
}) { }) {
const formattedDate = new Date(link.createdAt as string).toLocaleString( const formattedDate = new Date(link.createdAt as string).toLocaleString(
@@ -18,7 +15,7 @@ export default function LinkDate({
return ( return (
<div className="flex items-center gap-1 text-neutral"> <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> <p>{formattedDate}</p>
</div> </div>
); );
@@ -1,13 +1,9 @@
import { LinkIncludingShortenedCollectionAndTags } from "@/types/global"; 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 Image from "next/image";
import isValidUrl from "@/lib/shared/isValidUrl"; import isValidUrl from "@/lib/shared/isValidUrl";
import React from "react";
export default function LinkIcon({ export default function LinkIcon({ link, width }: {
link,
width,
}: {
link: LinkIncludingShortenedCollectionAndTags; link: LinkIncludingShortenedCollectionAndTags;
width?: string; width?: string;
}) { }) {
@@ -35,9 +31,9 @@ export default function LinkIcon({
}} }}
/> />
) : link.type === "pdf" ? ( ) : link.type === "pdf" ? (
<FontAwesomeIcon icon={faFilePdf} className={iconClasses} /> <i className={`bi-file-earmark-pdf ${iconClasses}`}></i>
) : link.type === "image" ? ( ) : link.type === "image" ? (
<FontAwesomeIcon icon={faFileImage} className={iconClasses} /> <i className={`bi-file-earmark-image ${iconClasses}`}></i>
) : undefined} ) : undefined}
</div> </div>
); );