Sha256: 75ae510e961bac740de1ae50b15ef0f124d21c17a85ee43087e394bb0cb76246

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

import { Head, Link } from '@inertiajs/react'
import <%= inertia_component_name %> from './<%= inertia_component_name %>'
import { <%= inertia_model_type %> } from './types'

interface ShowProps {
  <%= singular_table_name %>: <%= inertia_model_type %>
  flash: { notice?: string }
}

export default function Show({ <%= singular_table_name %>, flash }: ShowProps) {
  return (
    <>
      <Head title={`<%= human_name %> #${<%= singular_table_name %>.id}`} />

      {flash.notice && <p style={{ color: 'green' }}>{flash.notice}</p>}

      <h1><%= human_name %> #{<%= singular_table_name %>.id}</h1>

      <<%= inertia_component_name %> <%= singular_table_name %>={<%= singular_table_name %>} />

      <div>
        <Link href={`<%= js_edit_resource_path %>`}>Edit this <%= human_name.downcase %></Link>
        {' | '}
        <Link href="<%= js_resources_path %>">Back to <%= human_name.pluralize.downcase %></Link>

        <br />

        <Link
          href={`<%= js_resource_path %>`}
          as="button"
          method="delete"
        >
          Destroy this <%= human_name.downcase %>
        </Link>
      </div>
    </>
  )
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inertia_rails-3.5.0 lib/generators/inertia_templates/scaffold/templates/react/Show.tsx.tt