chore: update Select color for dark mode

This commit is contained in:
Jonathan Summers-Muir committed 2022-06-02 11:37:55 +08:00
1 parent 7453e469ab
commit b6f2887fce
1 file changed
+11 -12
@@ -1,9 +1,8 @@
import * as React from 'react';
import { EditorProps } from '@supabase/react-data-grid';
import * as React from 'react'
import { EditorProps } from '@supabase/react-data-grid'
interface SelectEditorProps<TRow, TSummaryRow = unknown>
extends EditorProps<TRow, TSummaryRow> {
options: { label: string; value: string }[];
interface SelectEditorProps<TRow, TSummaryRow = unknown> extends EditorProps<TRow, TSummaryRow> {
options: { label: string; value: string }[]
}
export function SelectEditor<TRow, TSummaryRow = unknown>({
@@ -13,24 +12,24 @@ export function SelectEditor<TRow, TSummaryRow = unknown>({
onClose,
options,
}: SelectEditorProps<TRow, TSummaryRow>) {
const value = (row[column.key as keyof TRow] as unknown) as string;
const value = row[column.key as keyof TRow] as unknown as string
function onChange(event: React.ChangeEvent<HTMLSelectElement>) {
const value = event.target.value;
const value = event.target.value
if (!value || value == '') {
onRowChange({ ...row, [column.key]: null }, true);
onRowChange({ ...row, [column.key]: null }, true)
} else {
onRowChange({ ...row, [column.key]: value }, true);
onRowChange({ ...row, [column.key]: value }, true)
}
}
function onBlur() {
onClose(false);
onClose(false)
}
return (
<select
className="sb-grid-select-editor"
className="sb-grid-select-editor bg-scale-400 text-grid p-0 px-3"
value={value ?? ''}
onChange={onChange}
onBlur={onBlur}
@@ -43,5 +42,5 @@ export function SelectEditor<TRow, TSummaryRow = unknown>({
</option>
))}
</select>
);
)
}