forked from calcom/cal.com
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import * as RadioGroup from "@radix-ui/react-radio-group"; | ||
import React from "react"; | ||
|
||
import { Label } from "./form"; | ||
|
||
type SegmentProps = { | ||
label: string; | ||
children: React.ReactNode; | ||
} & RadioGroup.RadioGroupProps; | ||
|
||
export function Segment({ label, children, ...rest }: SegmentProps) { | ||
return ( | ||
<div> | ||
<div className="inline-flex flex-col"> | ||
{label && <Label>{label}</Label>} | ||
<RadioGroup.Root | ||
className="flex space-x-1 rounded-md border-gray-200 bg-white p-[2px] text-sm font-medium leading-5 " | ||
{...rest}> | ||
{children} | ||
</RadioGroup.Root> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
type SegmentOptionProps = { value: string; children: React.ReactNode } & RadioGroup.RadioGroupItemProps; | ||
export function SegmentOption({ value, children, ...rest }: SegmentOptionProps) { | ||
return ( | ||
<RadioGroup.Item | ||
value={value} | ||
className="radix-disabled:opacity-40 radix-state-checked:bg-gray-200 radix-state-checked:hover:bg-gray-200 rounded-[4px] py-[6px] px-3 hover:bg-gray-100" | ||
{...rest}> | ||
{children} | ||
</RadioGroup.Item> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters