Skip to content

Commit

Permalink
refactor: Remove unnecessary Typography component
Browse files Browse the repository at this point in the history
  • Loading branch information
criss8X committed Nov 9, 2024
1 parent a79a613 commit 06114e9
Show file tree
Hide file tree
Showing 25 changed files with 53 additions and 604 deletions.
23 changes: 13 additions & 10 deletions src/components/AudioFilePreview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {useRef, type FC} from "react"
import Typography, {TypographyVariant} from "./Typography"
import {IoCloseCircle, IoPause, IoPlay} from "react-icons/io5"
import {fileSizeToString, getFileExtension} from "./FileMessage"
import {getFileExtension} from "./FileMessage"
import {ReactSVG} from "react-svg"
import {StaticAssetPath} from "@/utils/util"
import {useWavesurfer} from "@wavesurfer/react"
Expand All @@ -19,14 +18,13 @@ export type AudioFilePreviewProps = {

const AudioFilePreview: FC<AudioFilePreviewProps> = ({
fileName,
fileSize,
audioUrl,
onClose,
onSend,
}) => {
const {t} = useTranslation()

const fileExtension = getFileExtension(fileName).toUpperCase()
const _fileExtension = getFileExtension(fileName).toUpperCase()

const waveformRef = useRef(null)

Expand All @@ -46,23 +44,26 @@ const AudioFilePreview: FC<AudioFilePreviewProps> = ({
return (
<div className="flex w-messageMaxWidth flex-col rounded border bg-slate-50 shadow-lg">
<div className="flex h-16 w-full items-center rounded-t border-b bg-slate-100 px-5">
<Typography
{/* TODO: Use ui/typography.tsx */}
{/* <Typography
variant={TypographyVariant.HeadingMedium}
className="w-full">
{t(LangKey.UploadAudio)}
</Typography>
</Typography> */}

<IoCloseCircle size={20} color="gray" role="button" onClick={onClose} />
</div>

<div className="flex size-full flex-col gap-3 p-4">
<div className="flex w-full flex-col items-center gap-2 rounded border bg-white p-2">
<div className="flex w-full">
<Typography
{/* TODO: Use ui/typography.tsx */}

{/* <Typography
className="line-clamp-1 font-light text-slate-700"
variant={TypographyVariant.Body}>
{fileName}
</Typography>
</Typography> */}
</div>

<div className="flex w-full items-center gap-2 rounded bg-slate-100 p-2 shadow">
Expand Down Expand Up @@ -92,7 +93,9 @@ const AudioFilePreview: FC<AudioFilePreviewProps> = ({
</div>

<div className="flex w-full">
<Typography
{/* TODO: Use ui/typography.tsx */}

{/* <Typography
className="w-full font-semibold text-gray-400"
variant={TypographyVariant.BodySmall}>
{fileExtension}
Expand All @@ -102,7 +105,7 @@ const AudioFilePreview: FC<AudioFilePreviewProps> = ({
className="min-w-20 text-right font-semibold text-gray-400"
variant={TypographyVariant.BodySmall}>
{fileSizeToString(fileSize)}
</Typography>
</Typography> */}
</div>
</div>

Expand Down
6 changes: 3 additions & 3 deletions src/components/DropdownActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {type FC, useState} from "react"
import {type IconType} from "react-icons"
import {IoMdCheckmark} from "react-icons/io"
import Dropdown from "./Dropdown"
import Typography from "./Typography"
import {assert} from "@/utils/util"
import {Text} from "./ui/typography"

export type DropdownOption = {
text: string
Expand Down Expand Up @@ -37,7 +37,7 @@ const DropdownActions: FC<DropdownActionsProps> = ({
<optionSelected.Icon size={20} />
</div>

<Typography className="font-medium">{optionSelected.text}</Typography>
<Text weight="medium">{optionSelected.text}</Text>
</button>
}>
<>
Expand Down Expand Up @@ -78,7 +78,7 @@ const DropdownItem: FC<DropdownOptionProps> = ({
<Icon size={20} />
</div>

<Typography className="font-medium">{text}</Typography>
<Text weight="medium">{text}</Text>

{isSelected && <IoMdCheckmark className="ml-auto text-slate-300" />}
</button>
Expand Down
55 changes: 0 additions & 55 deletions src/components/InputSection.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/Loader.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {type FC} from "react"
import Typography from "./Typography"
import {twMerge} from "tailwind-merge"
import {Text} from "./ui/typography"

export type LoaderProps = {
text: string
Expand All @@ -16,7 +16,7 @@ const Loader: FC<LoaderProps> = ({text, className}) => {
)}>
<div className="size-8 animate-rotation rounded-full border-4 border-white border-t-slate-500" />

<Typography>{text}</Typography>
<Text>{text}</Text>
</div>
)
}
Expand Down
83 changes: 0 additions & 83 deletions src/components/Modal.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {type FC} from "react"
import {IoCheckbox, IoTrash} from "react-icons/io5"
import {twMerge} from "tailwind-merge"
import AvatarImage, {AvatarType} from "./AvatarImage"
import Typography, {TypographyVariant} from "./Typography"
import {notificationsBody, type NotificationType} from "@/utils/notifications"
import {Button, IconButton} from "./ui/button"
import useTranslation from "@/hooks/util/useTranslation"
Expand Down
10 changes: 3 additions & 7 deletions src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {type FC} from "react"
import {twMerge} from "tailwind-merge"
import {IoIosAlert, IoIosCheckmarkCircle} from "react-icons/io"
import Typography from "./Typography"
import useTranslation from "@/hooks/util/useTranslation"
import {LangKey} from "@/lang/allKeys"
import {Text} from "./ui/typography"

export enum ProgressBarState {
Progress,
Expand Down Expand Up @@ -130,13 +130,9 @@ const CircularProgressBar: FC<CircularProgressBarProps> = ({
!(isCompleted || isError) && "border-purple-500 shadow-circleProgress",
className
)}>
<Typography
className={twMerge(
"font-semibold",
isError ? "text-red-500" : "text-black"
)}>
<Text color={isError ? "destructive" : "default"} weight="medium">
{isError ? t(LangKey.Error) : `${progress}%`}
</Typography>
</Text>
</div>
)
}
Expand Down
70 changes: 0 additions & 70 deletions src/components/Room.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions src/components/RoomEncryptedIndicator.tsx

This file was deleted.

Loading

0 comments on commit 06114e9

Please sign in to comment.