-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add header with create component buttons
This commit introduces a new header within the `orders/new` component, providing users with 'Save' and 'Discard' button options. While the UI elements have been integrated, the functionalities for these buttons remain to be implemented in subsequent iterations.
- Loading branch information
1 parent
5a6eefe
commit 1ede2a5
Showing
7 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 19 additions & 7 deletions
26
admin/app/components/solidus_admin/orders/new/component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,20 @@ | ||
<div class="<%= stimulus_id %>" data-controller="<%= stimulus_id %>"> | ||
<p>Add Orders::New HTML here</p> | ||
<p> <%= @order %> </p> | ||
|
||
<label>Your name: <input data-action="input->orders--new#typed"/></label> | ||
<p>Hello <span data-orders--new-target="output"></span></p> | ||
<%= t '.hello' %> | ||
<div class="px-4 relative" data-controller="<%= stimulus_id %>"> | ||
<header class="py-6 flex items-center gap-4"> | ||
<%= render component("ui/button").new( | ||
tag: :a, | ||
title: t(".back"), | ||
icon: "arrow-left-line", | ||
scheme: :secondary, | ||
href: solidus_admin.orders_path | ||
) %> | ||
<h1 class="flex items-center gap-2"> | ||
<span class="body-title"><%= t(".create_order") %></span> | ||
</h1> | ||
|
||
<div class="ml-auto flex gap-2 items-center"> | ||
<%= render component("feedback").new %> | ||
<%= render component("ui/button").new(tag: :button, scheme: :secondary, text: t(".discard"), form: form_id) %> | ||
<%= render component("ui/button").new(tag: :button, text: t(".save"), form: form_id) %> | ||
</div> | ||
</header> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,5 @@ | ||
import { Controller } from '@hotwired/stimulus' | ||
|
||
export default class extends Controller { | ||
static targets = ['output'] | ||
|
||
typed(event) { | ||
this.text = event.currentTarget.value | ||
this.render() | ||
} | ||
|
||
render() { | ||
this.outputTarget.innerText = this.text | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# Add your component translations here. | ||
# Use the translation in the example in your template with `t(".hello")`. | ||
en: | ||
hello: "Hello world!" | ||
create_order: Create Order | ||
save: Save | ||
discard: Discard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
admin/spec/components/previews/solidus_admin/orders/new/component_preview/overview.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
<div class="mb-8"> | ||
<h6 class="text-gray-500 mb-3 mt-0"> | ||
Scenario 1 | ||
</h6> | ||
|
||
<%= render current_component.new(order: "order") %> | ||
<%= render current_component.new(order: order) %> | ||
</div> |