import React from "react"; import { Form } from "react-bootstrap"; import { FilterSelect } from "src/components/Shared"; const renderEditableTextTableRow = (options: { title: string; value?: string | number; isEditing: boolean; onChange: (value: string) => void; }) => ( {options.title} ) => options.onChange(event.currentTarget.value) } value={ typeof options.value === "number" ? options.value.toString() : options.value } placeholder={options.title} /> ); const renderTextArea = (options: { title: string; value: string | undefined; isEditing: boolean; onChange: (value: string) => void; }) => ( {options.title} ) => options.onChange(event.currentTarget.value) } value={options.value} /> ); const renderInputGroup = (options: { title: string; placeholder?: string; value: string | undefined; isEditing: boolean; asURL?: boolean; urlPrefix?: string; onChange: (value: string) => void; }) => ( {options.title} ) => options.onChange(event.currentTarget.value) } /> ); const renderHtmlSelect = (options: { title: string; value?: string | number; isEditing: boolean; onChange: (value: string) => void; selectOptions: Array; }) => ( {options.title} ) => options.onChange(event.currentTarget.value) } > {options.selectOptions.map(opt => ( ))} ); // TODO: isediting const renderFilterSelect = (options: { title: string; type: "performers" | "studios" | "tags"; initialId: string | undefined; onChange: (id: string | undefined) => void; }) => ( {options.title} options.onChange(items[0]?.id)} initialIds={options.initialId ? [options.initialId] : []} /> ); // TODO: isediting const renderMultiSelect = (options: { title: string; type: "performers" | "studios" | "tags"; initialIds: string[] | undefined; onChange: (ids: string[]) => void; }) => ( {options.title} options.onChange(items.map(i => i.id))} initialIds={options.initialIds ?? []} /> ); const Table = { renderEditableTextTableRow, renderTextArea, renderInputGroup, renderHtmlSelect, renderFilterSelect, renderMultiSelect }; export default Table;