2
0

feat(editor): ️ Better Gsheets dropdowns

This commit is contained in:
Baptiste Arnaud
2022-03-01 12:02:52 +01:00
parent ebf92b5536
commit 205c347720
3 changed files with 9 additions and 10 deletions

View File

@ -1,3 +1,4 @@
import { Input } from '@chakra-ui/react'
import { SearchableDropdown } from 'components/shared/SearchableDropdown'
import { useMemo } from 'react'
import { Sheet } from 'services/integrations'
@ -25,13 +26,15 @@ export const SheetsDropdown = ({
const id = sheets?.find((s) => s.name === name)?.id
if (isDefined(id)) onSelectSheetId(id)
}
if (isLoading) return <Input value="Loading..." isDisabled />
if (!sheets) return <Input value="No sheets found" isDisabled />
return (
<SearchableDropdown
selectedItem={currentSheet?.name}
items={(sheets ?? []).map((s) => s.name)}
onValueChange={handleSpreadsheetSelect}
placeholder={'Select the sheet'}
isLoading={isLoading}
/>
)
}

View File

@ -1,3 +1,4 @@
import { Input } from '@chakra-ui/react'
import { SearchableDropdown } from 'components/shared/SearchableDropdown'
import { useMemo } from 'react'
import { useSpreadsheets } from 'services/integrations'
@ -23,13 +24,14 @@ export const SpreadsheetsDropdown = ({
const id = spreadsheets?.find((s) => s.name === name)?.id
if (id) onSelectSpreadsheetId(id)
}
if (isLoading) return <Input value="Loading..." isDisabled />
if (!spreadsheets) return <Input value="No spreadsheets found" isDisabled />
return (
<SearchableDropdown
selectedItem={currentSpreadsheet?.name}
items={(spreadsheets ?? []).map((s) => s.name)}
onValueChange={handleSpreadsheetSelect}
placeholder={'Search for spreadsheet'}
isLoading={isLoading}
/>
)
}