import React, { forwardRef, useState } from 'react'; import { Button, Label, TextInput, css, spacing, useId, } from '@mongodb-js/compass-components'; const formStyles = css({ display: 'flex', }); const labelStyles = css({ display: 'none', }); const textInputStyles = css({ flex: 1, }); const submitButtonStyles = css({ marginLeft: '6px', // spacing[1] makes the shadows overlap, spacing[2] is too much marginRight: spacing[1], }); type SaveQueryFormProps = { onSave: (name: string) => void; onCancel: () => void; }; export const SaveQueryForm = forwardRef( ({ onSave, onCancel }, ref) => { const [name, setName] = useState(''); const labelId = useId(); const controlId = useId(); return (
{ event.preventDefault(); onSave(name); }} >