<% @page_title = "Create a new Workflow" %>

<% content_for :header do %>
  <nav>
    <%= link_to_back fallback_path: workflows_path %>
    <h1 class="txt-large center"><%= @page_title %></h1>
    <span class="btn btn--placeholder flex-item-justify-end"></span>
  </nav>
<% end %>

<%= turbo_frame_tag :workflows do %>
  <article class="panel center margin-block-start flex flex-column gap" style="view-transition-name: <%= dom_id(@workflow) %>">
    <%= form_with model: @workflow, url: workflows_path, data: { controller: "form" } do |form| %>
      <%= form.text_field :name, required: true, autofocus: true, class: "input txt-large", placeholder: "Name your Workflow…", data: { action: "keydown.esc@document->form#cancel" } %>
      <%= form.button type: :submit, class: "btn btn--reversed center margin-block-start txt-large" do %>
        <%= icon_tag "check" %>
        <span class="for-screen-reader">Create Workflow</span>
      <% end %>
      <%= link_to "Go back", workflows_path, data: { form_target: "cancel", turbo_frame: "_top" }, hidden: true %>
    <% end %>
  </article>
<% end %>
