Sha256: 0b05b53ae53177cd76de716a0d424866a65ba365d4c063add8ccbc710d48b566

Contents?: true

Size: 907 Bytes

Versions: 1

Compression:

Stored size: 907 Bytes

Contents

import { Head, Link } from '@inertiajs/react'
import Form from './Form'

export default function New({ <%= singular_table_name %> }) {
  return (
    <>
      <Head title="New <%= human_name.downcase %>" />

      <div className="mx-auto md:w-2/3 w-full px-8 pt-8">
        <h1 className="font-bold text-4xl">New <%= human_name.downcase %></h1>

        <Form
          <%= singular_table_name %>={<%= singular_table_name %>}
          onSubmit={(form) => {
            form.transform((data) => ({ <%= singular_table_name %>: data }))
            form.post('<%= js_resources_path %>')
          }}
          submitText="Create <%= human_name %>"
        />

        <Link
          href="<%= js_resources_path %>"
          className="ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium"
        >
          Back to <%= human_name.pluralize.downcase %>
        </Link>
      </div>
    </>
  )
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inertia_rails-3.5.0 lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt