-
-
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.
- Loading branch information
1 parent
cb53a12
commit feadd83
Showing
8 changed files
with
99 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
admin/app/components/solidus_admin/orders/show/summary/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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<div class="<%= stimulus_id %> w-full relative overflow-visible" data-controller="<%= stimulus_id %>"> | ||
<%= render component('ui/panel').new(title: 'Summary') do %> | ||
<div class="mx-auto"> | ||
<div class="text-sm py-2 flex justify-between font-semibold"> | ||
<span>Subtotal</span> | ||
<span>€90.00</span> | ||
</div> | ||
<div class="text-sm py-2 flex justify-between"> | ||
<span>Taxes</span> | ||
<span>€0.00</span> | ||
</div> | ||
<div class="text-sm py-2 flex justify-between"> | ||
<span>Shipping</span> | ||
<span>€0.00</span> | ||
</div> | ||
<div class="text-sm py-2 flex justify-between"> | ||
<%= link_to('Add promo code', '#', class: "body-link") %> | ||
<span>€0.00</span> | ||
</div> | ||
<div class="text-sm py-2 flex justify-between"> | ||
<%= link_to('Adjustments', '#', class: "body-link") %> | ||
<span>€0.00</span> | ||
</div> | ||
<div class="text-sm py-2 flex justify-between font-semibold"> | ||
<span>Total</span> | ||
<span>€90.00</span> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> |
14 changes: 14 additions & 0 deletions
14
admin/app/components/solidus_admin/orders/show/summary/component.js
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
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 | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
admin/app/components/solidus_admin/orders/show/summary/component.rb
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class SolidusAdmin::Orders::Show::Summary::Component < SolidusAdmin::BaseComponent | ||
def initialize(order:) | ||
@order = order | ||
end | ||
|
||
|
||
def format_summary | ||
|
||
end | ||
end |
4 changes: 4 additions & 0 deletions
4
admin/app/components/solidus_admin/orders/show/summary/component.yml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Add your component translations here. | ||
# Use the translation in the example in your template with `t(".hello")`. | ||
en: | ||
hello: "Hello world!" |
15 changes: 15 additions & 0 deletions
15
admin/spec/components/previews/solidus_admin/orders/show/summary/component_preview.rb
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
# @component "orders/show/summary" | ||
class SolidusAdmin::Orders::Show::Summary::ComponentPreview < ViewComponent::Preview | ||
include SolidusAdmin::Preview | ||
|
||
def overview | ||
render_with_template | ||
end | ||
|
||
# @param order text | ||
def playground(order: "order") | ||
render component("orders/show/summary").new(order: order) | ||
end | ||
end |
7 changes: 7 additions & 0 deletions
7
...components/previews/solidus_admin/orders/show/summary/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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="mb-8"> | ||
<h6 class="text-gray-500 mb-3 mt-0"> | ||
Scenario 1 | ||
</h6> | ||
|
||
<%= render current_component.new(order: "order") %> | ||
</div> |
16 changes: 16 additions & 0 deletions
16
admin/spec/components/solidus_admin/orders/show/summary/component_spec.rb
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
RSpec.describe SolidusAdmin::Orders::Show::Summary::Component, type: :component do | ||
it "renders the overview preview" do | ||
render_preview(:overview) | ||
end | ||
|
||
# it "renders something useful" do | ||
# render_inline(described_class.new(order: "order")) | ||
# | ||
# expect(page).to have_text "Hello, components!" | ||
# expect(page).to have_css '.value' | ||
# end | ||
end |