|
1
|
import { useState } from "react" |
|
2
|
import { Label, Switch } from "@medusajs/ui" |
|
3
|
|
|
4
|
export default function SwitchControlled() { |
|
5
|
const [checked, setChecked] = useState(false) |
|
6
|
|
|
7
|
return ( |
|
8
|
<div className="flex flex-col gap-2"> |
|
9
|
<div className="flex items-center gap-x-2"> |
|
10
|
<Switch |
|
11
|
id="manage-inventory-controlled" |
|
12
|
checked={checked} |
|
13
|
onCheckedChange={setChecked} |
|
14
|
/> |
|
15
|
<Label htmlFor="manage-inventory-controlled">Manage Inventory</Label> |
|
16
|
</div> |
|
17
|
<div className="txt-small text-ui-fg-muted"> |
|
18
|
{checked |
|
19
|
? "You are managing inventory" |
|
20
|
: "You are not managing inventory"} |
|
21
|
</div> |
|
22
|
</div> |
|
23
|
) |
|
24
|
} |