CoastalCommitsPastes/client/components/visibility-badge/index.tsx

24 lines
551 B
TypeScript
Raw Normal View History

import { Badge } from "@geist-ui/core"
import type { PostVisibility } from "@lib/types"
2022-03-06 19:46:59 -05:00
type Props = {
visibility: PostVisibility
2022-03-06 19:46:59 -05:00
}
const VisibilityBadge = ({ visibility }: Props) => {
const getBadgeType = () => {
switch (visibility) {
case "public":
return "success"
case "private":
return "warning"
case "unlisted":
return "default"
}
}
2022-03-24 22:25:02 -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