2022-11-09 21:38:05 -05:00
|
|
|
import { Badge } from "@geist-ui/core/dist"
|
2022-03-21 23:30:45 -04:00
|
|
|
import type { PostVisibility } from "@lib/types"
|
2022-03-06 19:46:59 -05:00
|
|
|
|
2022-11-12 04:28:06 -05:00
|
|
|
type CastPostVisibility = PostVisibility | string
|
|
|
|
|
2022-03-06 19:46:59 -05:00
|
|
|
type Props = {
|
2022-11-12 04:28:06 -05:00
|
|
|
visibility: CastPostVisibility
|
2022-03-06 19:46:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const VisibilityBadge = ({ visibility }: Props) => {
|
2022-04-09 20:48:19 -04:00
|
|
|
const getBadgeType = () => {
|
|
|
|
switch (visibility) {
|
|
|
|
case "public":
|
|
|
|
return "success"
|
|
|
|
case "private":
|
|
|
|
return "warning"
|
|
|
|
case "unlisted":
|
|
|
|
return "default"
|
|
|
|
}
|
|
|
|
}
|
2022-03-06 19:46:59 -05:00
|
|
|
|
2022-04-09 20:48:19 -04:00
|
|
|
return <Badge type={getBadgeType()}>{visibility}</Badge>
|
2022-03-06 19:46:59 -05:00
|
|
|
}
|
|
|
|
|
2022-03-10 22:51:10 -05:00
|
|
|
export default VisibilityBadge
|