-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⏪ Re-implement trackpad/mouse choice and defau…
- Loading branch information
1 parent
8998276
commit 5f0b369
Showing
7 changed files
with
117 additions
and
37 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
apps/builder/src/features/account/components/GraphNavigationRadioGroup.tsx
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,68 @@ | ||
import { MouseIcon, LaptopIcon } from '@/components/icons' | ||
import { useTranslate } from '@tolgee/react' | ||
import { | ||
HStack, | ||
Radio, | ||
RadioGroup, | ||
Stack, | ||
VStack, | ||
Text, | ||
} from '@chakra-ui/react' | ||
import { GraphNavigation } from '@typebot.io/prisma' | ||
|
||
type Props = { | ||
defaultValue: string | ||
onChange: (value: string) => void | ||
} | ||
export const GraphNavigationRadioGroup = ({ | ||
defaultValue, | ||
onChange, | ||
}: Props) => { | ||
const { t } = useTranslate() | ||
const graphNavigationData = [ | ||
{ | ||
value: GraphNavigation.MOUSE, | ||
label: t('account.preferences.graphNavigation.mouse.label'), | ||
description: t('account.preferences.graphNavigation.mouse.description'), | ||
icon: <MouseIcon boxSize="35px" />, | ||
}, | ||
{ | ||
value: GraphNavigation.TRACKPAD, | ||
label: t('account.preferences.graphNavigation.trackpad.label'), | ||
description: t( | ||
'account.preferences.graphNavigation.trackpad.description' | ||
), | ||
icon: <LaptopIcon boxSize="35px" />, | ||
}, | ||
] | ||
return ( | ||
<RadioGroup onChange={onChange} defaultValue={defaultValue}> | ||
<HStack spacing={4} w="full" align="stretch"> | ||
{graphNavigationData.map((option) => ( | ||
<VStack | ||
key={option.value} | ||
as="label" | ||
htmlFor={option.label} | ||
cursor="pointer" | ||
borderWidth="1px" | ||
borderRadius="md" | ||
w="full" | ||
p="6" | ||
spacing={6} | ||
justifyContent="space-between" | ||
> | ||
<VStack spacing={6}> | ||
{option.icon} | ||
<Stack> | ||
<Text fontWeight="bold">{option.label}</Text> | ||
<Text>{option.description}</Text> | ||
</Stack> | ||
</VStack> | ||
|
||
<Radio value={option.value} id={option.label} /> | ||
</VStack> | ||
))} | ||
</HStack> | ||
</RadioGroup> | ||
) | ||
} |
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
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
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