Sha256: 6340dd8ceea1a979aca56b82dbf5f0ec5506f4e9c451e84f739c3d6c2c22d06f

Contents?: true

Size: 916 Bytes

Versions: 6

Compression:

Stored size: 916 Bytes

Contents

import { Link, Head } 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.downcase %>"
        />

        <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

6 entries across 6 versions & 1 rubygems

Version Path
inertia_rails-contrib-0.3.0 lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
inertia_rails-contrib-0.2.2 lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
inertia_rails-contrib-0.2.1 lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
inertia_rails-contrib-0.2.0 lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
inertia_rails-contrib-0.1.1 lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt
inertia_rails-contrib-0.1.0 lib/generators/inertia_tw_templates/scaffold/templates/react/New.jsx.tt