refactor: client side component -> server side
This commit is contained in:
parent
9175523127
commit
096ef2642e
1 changed files with 4 additions and 15 deletions
|
@ -1,24 +1,15 @@
|
|||
"use client"
|
||||
|
||||
import "./style.scss"
|
||||
|
||||
import { type Badge as BadgeType } from "@developomp-site/content/src/types/types"
|
||||
import { type FC, useEffect, useState } from "react"
|
||||
|
||||
interface BadgeProps {
|
||||
slug: string
|
||||
}
|
||||
|
||||
const Badge: FC<BadgeProps> = ({ slug }) => {
|
||||
const [badgeData, setBadgeData] = useState<BadgeType | undefined>(undefined)
|
||||
|
||||
useEffect(() => {
|
||||
;(async () => {
|
||||
setBadgeData(
|
||||
await import(`@developomp-site/content/dist/icons/${slug}.json`)
|
||||
)
|
||||
})()
|
||||
}, [slug])
|
||||
export default async function Badge({ slug }: BadgeProps) {
|
||||
const badgeData: BadgeType = await import(
|
||||
`@developomp-site/content/dist/icons/${slug}.json`
|
||||
)
|
||||
|
||||
if (!badgeData)
|
||||
return (
|
||||
|
@ -47,5 +38,3 @@ const Badge: FC<BadgeProps> = ({ slug }) => {
|
|||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Badge
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue