performance: replace tabler-icons-react with react-icons to reduce bundle size
This commit is contained in:
@@ -2,7 +2,7 @@ import { Button, Center, createStyles, Group, Text } from "@mantine/core";
|
||||
import { Dropzone as MantineDropzone } from "@mantine/dropzone";
|
||||
import getConfig from "next/config";
|
||||
import { Dispatch, ForwardedRef, SetStateAction, useRef } from "react";
|
||||
import { CloudUpload, Upload } from "tabler-icons-react";
|
||||
import { TbCloudUpload, TbUpload } from "react-icons/tb";;;
|
||||
import { FileUpload } from "../../types/File.type";
|
||||
import { byteStringToHumanSizeString } from "../../utils/math/byteStringToHumanSizeString.util";
|
||||
import toast from "../../utils/toast.util";
|
||||
@@ -67,7 +67,7 @@ const Dropzone = ({
|
||||
>
|
||||
<div style={{ pointerEvents: "none" }}>
|
||||
<Group position="center">
|
||||
<CloudUpload size={50} />
|
||||
<TbCloudUpload size={50} />
|
||||
</Group>
|
||||
<Text align="center" weight={700} size="lg" mt="xl">
|
||||
Upload files
|
||||
@@ -89,7 +89,7 @@ const Dropzone = ({
|
||||
disabled={isUploading}
|
||||
onClick={() => openRef.current && openRef.current()}
|
||||
>
|
||||
{<Upload />}
|
||||
{<TbUpload />}
|
||||
</Button>
|
||||
</Center>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ActionIcon, Table } from "@mantine/core";
|
||||
import { Dispatch, SetStateAction } from "react";
|
||||
import { Trash } from "tabler-icons-react";
|
||||
import { TbTrash } from "react-icons/tb";;
|
||||
import { FileUpload } from "../../types/File.type";
|
||||
import { byteStringToHumanSizeString } from "../../utils/math/byteStringToHumanSizeString.util";
|
||||
import UploadProgressIndicator from "./UploadProgressIndicator";
|
||||
@@ -28,7 +28,7 @@ const FileList = ({
|
||||
size={25}
|
||||
onClick={() => remove(i)}
|
||||
>
|
||||
<Trash />
|
||||
<TbTrash />
|
||||
</ActionIcon>
|
||||
) : (
|
||||
<UploadProgressIndicator progress={file.uploadingProgress} />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RingProgress } from "@mantine/core";
|
||||
import { CircleCheck, CircleX } from "tabler-icons-react";
|
||||
import { TbCircleCheck, TbCircleX } from "react-icons/tb";;
|
||||
|
||||
const UploadProgressIndicator = ({ progress }: { progress: number }) => {
|
||||
if (progress > 0 && progress < 100) {
|
||||
@@ -11,9 +11,9 @@ const UploadProgressIndicator = ({ progress }: { progress: number }) => {
|
||||
/>
|
||||
);
|
||||
} else if (progress == 100) {
|
||||
return <CircleCheck color="green" size={22} />;
|
||||
return <TbCircleCheck color="green" size={22} />;
|
||||
} else {
|
||||
return <CircleX color="red" size={22} />;
|
||||
return <TbCircleX color="red" size={22} />;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
import {
|
||||
ActionIcon,
|
||||
Button,
|
||||
Group,
|
||||
Stack,
|
||||
Text,
|
||||
TextInput,
|
||||
Title
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { useClipboard } from "@mantine/hooks";
|
||||
import { useModals } from "@mantine/modals";
|
||||
import { ModalsContextProps } from "@mantine/modals/lib/context";
|
||||
import moment from "moment";
|
||||
import { useRouter } from "next/router";
|
||||
import { Copy } from "tabler-icons-react";
|
||||
import { TbCopy } from "react-icons/tb";
|
||||
import { Share } from "../../types/share.type";
|
||||
import toast from "../../utils/toast.util";
|
||||
|
||||
const showCompletedUploadModal = (
|
||||
modals: ModalsContextProps,
|
||||
share: Share,
|
||||
) => {
|
||||
const showCompletedUploadModal = (modals: ModalsContextProps, share: Share) => {
|
||||
return modals.openModal({
|
||||
closeOnClickOutside: false,
|
||||
withCloseButton: false,
|
||||
@@ -39,7 +34,7 @@ const Body = ({ share }: { share: Share }) => {
|
||||
const router = useRouter();
|
||||
const link = `${window.location.origin}/share/${share.id}`;
|
||||
return (
|
||||
<Stack align="stretch">
|
||||
<Stack align="stretch">
|
||||
<TextInput
|
||||
variant="filled"
|
||||
value={link}
|
||||
@@ -50,7 +45,7 @@ const Body = ({ share }: { share: Share }) => {
|
||||
toast.success("Your link was copied to the keyboard.");
|
||||
}}
|
||||
>
|
||||
<Copy />
|
||||
<TbCopy />
|
||||
</ActionIcon>
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user