2022-03-22 20:06:15 -07:00
|
|
|
import { Badge } from "@geist-ui/core"
|
2022-03-21 20:30:45 -07:00
|
|
|
import type { PostVisibility } from "@lib/types"
|
2022-03-06 16:46:59 -08:00
|
|
|
|
|
|
|
type Props = {
|
2022-03-21 14:20:20 -07:00
|
|
|
visibility: PostVisibility
|
2022-03-06 16:46:59 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
const VisibilityBadge = ({ visibility }: Props) => {
|
|
|
|
const getBadgeType = () => {
|
|
|
|
switch (visibility) {
|
|
|
|
case "public":
|
|
|
|
return "success"
|
|
|
|
case "private":
|
|
|
|
return "warning"
|
|
|
|
case "unlisted":
|
|
|
|
return "default"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (<Badge marginLeft={'var(--gap)'} type={getBadgeType()}>{visibility}</Badge>)
|
|
|
|
}
|
|
|
|
|
2022-03-10 19:51:10 -08:00
|
|
|
export default VisibilityBadge
|