text: import {
    Form,
    FormError,
    FieldError,
    Label,
    TextField,
    CheckboxField,
    NumberField,
    Submit,
  } from '@redwoodjs/forms'
  
  const formatDatetime = (value) => {
    if (value) {
      return value.replace(/:\d{2}\.\d{3}\w/, '')
    }
  }
  
  const FeedItemForm = (props) => {
    const onSubmit = (data) => {
      props.onSave(data, props?.feedItem?.id)
    }
  
    return (
      <div className="rw-form-wrapper">
        <Form onSubmit={onSubmit} error={props.error}>
          <FormError
            error={props.error}
            wrapperClassName="rw-form-error-wrapper"
            titleClassName="rw-form-error-title"
            listClassName="rw-form-error-list"
          />
  
          <Label
            name="title"
            className="rw-label"
            errorClassName="rw-label rw-label-error"
          >
            Title
          </Label>
          <TextField
            name="title"
            defaultValue={props.feedItem?.title}
            className="rw-input"
            errorClassName="rw-input rw-input-error"
            validation={{ required: true }}
          />
  
          <FieldError name="title" className="rw-field-error" />
  
          <Label
            name="url"
            className="rw-label"
            errorClassName="rw-label rw-label-error"
          >
            Url
          </Label>
          <TextField
            name="url"
            defaultValue={props.feedItem?.url}
            className="rw-input"
            errorClassName="rw-input rw-input-error"
            validation={{ required: true }}
          />
  
          <FieldError name="url" className="rw-field-error" />
  
          <Label
            name="active"
            className="rw-label"
            errorClassName="rw-label rw-label-error"
          >
            Active
          </Label>
          <CheckboxField
            name="active"
            defaultChecked={props.feedItem?.active}
            className="rw-input"
            errorClassName="rw-input rw-input-error"
          />
  
          <FieldError name="active" className="rw-field-error" />
  
          <Label
            name="feedId"
            className="rw-label"
            errorClassName="rw-label rw-label-error"
          >
            Feed id
          </Label>
          <NumberField
            name="feedId"
            defaultValue={props.feedItem?.feedId}
            className="rw-input"
            errorClassName="rw-input rw-input-error"
            validation={{ required: true }}
          />
  
          <FieldError name="feedId" className="rw-field-error" />
  
          <div className="rw-button-group">
            <Submit disabled={props.loading} className="rw-button rw-button-blue">
              Save
            </Submit>
          </div>
        </Form>
      </div>
    )
  }
  
  export default FeedItemForm
  