import { FloatingCellEditor, defaultSpreadsheetTheme } from "@rowsncolumns/spreadsheet"
import { functionDescriptions } from "@rowsncolumns/functions";
const App = () => {
const [theme, onChangeTheme] = useState<SpreadsheetTheme>(
defaultSpreadsheetTheme
);
const {
activeSheetId,
activeCell,
selections,
getUserEnteredValue,
getEffectiveFormat,
onChange,
onChangeFormatting,
onInsertRow,
onInsertColumn
} = useSpreadsheetState({ ... })
// Format of the current cell
const currentCellFormat = useMemo(
() =>
getEffectiveFormat(
activeSheetId,
activeCell.rowIndex,
activeCell.columnIndex
),
[activeSheetId, activeCell, getEffectiveFormat]
);
return (
<FloatingCellEditor
initialValue={getUserEnteredValue(
activeSheetId,
activeCell.rowIndex,
activeCell.columnIndex
)}
theme={theme}
sheetId={activeSheetId}
activeCell={activeCell}
selections={selections}
onChange={onChange}
cellFormat={currentCellFormat}
onChangeFormatting={onChangeFormatting}
onInsertRow={onInsertRow}
onInsertColumn={onInsertColumn}
functionDescriptions={functionDescriptions}
/>
)
}