refactor: replace interface with type for component properties and improve code readability

This commit is contained in:
Ardeman 2025-02-24 08:23:22 +08:00
parent 9e6d2fe6c0
commit 6082cf0cdb
5 changed files with 11 additions and 14 deletions

View File

@ -1,15 +1,14 @@
import type { JSX, SVGProps } from 'react' import type { JSX, SVGProps } from 'react'
interface NotificationIconProperties type TNotificationIcon = {
extends JSX.IntrinsicAttributes,
SVGProps<SVGSVGElement> {
showBadge?: boolean showBadge?: boolean
} } & JSX.IntrinsicAttributes &
SVGProps<SVGSVGElement>
export const NotificationIcon = ({ export const NotificationIcon = ({
showBadge = false, showBadge = false,
...properties ...properties
}: NotificationIconProperties) => { }: TNotificationIcon) => {
return ( return (
<svg <svg
width={16} width={16}

View File

@ -1,7 +1,6 @@
import { Link } from 'react-router' import { Link } from 'react-router'
// use slog or handel get by url type BreadcrumbProperty = {
interface BreadcrumbProperty {
slug: string slug: string
} }

View File

@ -1,7 +1,7 @@
import { GraphIcon } from '~/components/icons/graph' import { GraphIcon } from '~/components/icons/graph'
import { formatNumberWithPeriods } from '~/utils/formatter' import { formatNumberWithPeriods } from '~/utils/formatter'
interface CardReportProperty { type CardReportProperty = {
title: string title: string
amount: number amount: number
url?: string url?: string

View File

@ -8,7 +8,7 @@ import { LinkIcon } from '~/components/icons/link-icon'
import { LinkedinIcon } from '~/components/icons/linkedin' import { LinkedinIcon } from '~/components/icons/linkedin'
import { XIcon } from '~/components/icons/x' import { XIcon } from '~/components/icons/x'
interface SocialMediaProperties { type SocialMediaProperties = {
className?: string className?: string
} }

View File

@ -1,3 +1,5 @@
import htmlParse from 'html-react-parser'
import { Breadcrumb } from '~/components/ui/breadcrumb' import { Breadcrumb } from '~/components/ui/breadcrumb'
import { Card } from '~/components/ui/card' import { Card } from '~/components/ui/card'
import { Carousel } from '~/components/ui/carousel' import { Carousel } from '~/components/ui/carousel'
@ -31,7 +33,7 @@ export const NewsDetailPage = () => {
</p> </p>
</div> </div>
</div> </div>
<IconsSocial className="ml-auto"></IconsSocial> <IconsSocial className="ml-auto" />
</div> </div>
{/* end next planing create component for this section */} {/* end next planing create component for this section */}
<div className="w-full bg-amber-200"> <div className="w-full bg-amber-200">
@ -42,10 +44,7 @@ export const NewsDetailPage = () => {
/> />
</div> </div>
<article <article className="prose prose-stone">{htmlParse(content)}</article>
className="prose prose-stone"
dangerouslySetInnerHTML={{ __html: content }}
/>
<div className="flex items-end justify-between border-b-3 border-b-gray-300 py-4"> <div className="flex items-end justify-between border-b-3 border-b-gray-300 py-4">
<div className="flex flex-col"> <div className="flex flex-col">
<p className="mb-2">Share this post</p> <p className="mb-2">Share this post</p>