Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
mastodon
GitHub Repository: mastodon/joinmastodon
Path: blob/main/components/Category.tsx
1006 views
1
import classNames from "classnames"
2
3
export type CategoryProps = {
4
onChange: (e: any) => void
5
value: string
6
currentValue?: string
7
label: React.ReactNode
8
}
9
10
export const Category = ({
11
onChange,
12
value,
13
currentValue,
14
label,
15
}: CategoryProps) => {
16
return (
17
<label
18
className={classNames(
19
"b3 block cursor-pointer whitespace-nowrap rounded-md border-2 p-3 text-center !font-semibold transition-all md:w-full md:p-4",
20
value === currentValue
21
? "border-blurple-500 bg-blurple-500 text-white hover:border-blurple-600 hover:bg-blurple-600 focus-visible-within:border-blurple-600 focus-visible-within:bg-blurple-600"
22
: "border-blurple-500 bg-white text-blurple-500 hover:border-blurple-600 hover:text-blurple-600"
23
)}
24
>
25
<input
26
className="sr-only"
27
type="radio"
28
name="apps-selection"
29
id=""
30
value={value}
31
onChange={onChange}
32
/>
33
{label}
34
</label>
35
)
36
}
37
38
export default Category
39
40