23 lines
467 B
TypeScript
23 lines
467 B
TypeScript
import { Badge } from "@geist-ui/core/dist"
|
|
import type { PostVisibility } from "@lib/types"
|
|
|
|
type Props = {
|
|
visibility: PostVisibility
|
|
}
|
|
|
|
const VisibilityBadge = ({ visibility }: Props) => {
|
|
const getBadgeType = () => {
|
|
switch (visibility) {
|
|
case "public":
|
|
return "success"
|
|
case "private":
|
|
return "warning"
|
|
case "unlisted":
|
|
return "default"
|
|
}
|
|
}
|
|
|
|
return <Badge type={getBadgeType()}>{visibility}</Badge>
|
|
}
|
|
|
|
export default VisibilityBadge
|