🚸 Add a better select input

Also improves other inputs behavior
This commit is contained in:
Baptiste Arnaud
2023-03-03 09:01:11 +01:00
parent a66bfca1ec
commit cc7d7285e5
94 changed files with 1251 additions and 1109 deletions

View File

@@ -1,4 +1,4 @@
import { CodeEditor } from '@/components/CodeEditor'
import { CodeEditor } from '@/components/inputs/CodeEditor'
import React from 'react'
type Props = {

View File

@@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react'
import { Text, HStack } from '@chakra-ui/react'
import { SearchableDropdown } from '@/components/SearchableDropdown'
import { env, isEmpty } from 'utils'
import { AutocompleteInput } from '@/components/inputs/AutocompleteInput'
type FontSelectorProps = {
activeFont?: string
@@ -32,7 +32,7 @@ export const FontSelector = ({
}
const handleFontSelected = (nextFont: string) => {
if (nextFont == currentFont) return
if (nextFont === currentFont) return
setCurrentFont(nextFont)
onSelectFont(nextFont)
}
@@ -40,10 +40,11 @@ export const FontSelector = ({
return (
<HStack justify="space-between" align="center">
<Text>Font</Text>
<SearchableDropdown
selectedItem={activeFont}
<AutocompleteInput
defaultValue={activeFont}
items={googleFonts}
onValueChange={handleFontSelected}
onChange={handleFontSelected}
withVariableButton={false}
/>
</HStack>
)

View File

@@ -19,7 +19,7 @@ test.describe.parallel('Theme page', () => {
await expect(page.locator('button >> text="Go"')).toBeVisible()
// Font
await page.fill('input[type="text"]', 'Roboto Slab')
await page.getByRole('textbox').fill('Roboto Slab')
await expect(page.locator('.typebot-container')).toHaveCSS(
'font-family',
/"Roboto Slab"/