Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[admin] Move layout related components under layout/ #5510

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions admin/app/components/solidus_admin/feedback/component.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class SolidusAdmin::Layout::Feedback::Component < SolidusAdmin::BaseComponent
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Account navigation
class SolidusAdmin::Sidebar::AccountNav::Component < SolidusAdmin::BaseComponent
class SolidusAdmin::Layout::Navigation::Account::Component < SolidusAdmin::BaseComponent
# @param user_label [String]
# @param account_path [String]
# @param logout_path [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<% end %>

<ul>
<%= render component("sidebar/item").with_collection(items, fullpath: request.fullpath) %>
<%= render component("layout/navigation/item").with_collection(items, fullpath: request.fullpath) %>
</ul>

<div class="mt-auto">
Expand All @@ -29,7 +29,7 @@
</div>
</label>
</div>
<%= render component("sidebar/account_nav").new(
<%= render component("layout/navigation/account").new(
user_label: helpers.current_solidus_admin_user.email,
account_path: solidus_admin.account_path,
logout_path: helpers.solidus_admin_logout_path,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Renders the sidebar
class SolidusAdmin::Sidebar::Component < SolidusAdmin::BaseComponent
class SolidusAdmin::Layout::Navigation::Component < SolidusAdmin::BaseComponent
def initialize(
store:,
logo_path: SolidusAdmin::Config.logo_path,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Menu item within a {Sidebar}
class SolidusAdmin::Sidebar::Item::Component < SolidusAdmin::BaseComponent
class SolidusAdmin::Layout::Navigation::Item::Component < SolidusAdmin::BaseComponent
with_collection_parameter :item

# @param item [SolidusAdmin::MainNavItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def page(**attrs, &block)

def page_header_actions(&block)
tag.div(safe_join([
render(component("feedback").new),
render(component("layout/feedback").new),
capture(&block),
]), class: "flex gap-2 items-center")
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Skip to content link
class SolidusAdmin::SkipLink::Component < SolidusAdmin::BaseComponent
class SolidusAdmin::Layout::SkipLink::Component < SolidusAdmin::BaseComponent
# @param href [String] the href attribute for the skip link
def initialize(href:)
@href = href
Expand Down
4 changes: 2 additions & 2 deletions admin/app/views/layouts/solidus_admin/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</head>

<body class="bg-gray-15">
<%= render component("skip_link").new(href: "#main") %>
<%= render component("layout/skip_link").new(href: "#main") %>
<div class="flex gap-0">
<div class="min-w-[240px] border-r border-r-gray-100 relative">
<div class="min-h-screen top-0 sticky flex">
<%= render component("sidebar").new(store: current_store) %>
<%= render component("layout/navigation").new(store: current_store) %>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

# @component "ui/feedback"
class SolidusAdmin::Feedback::ComponentPreview < ViewComponent::Preview
class SolidusAdmin::Layout::Feedback::ComponentPreview < ViewComponent::Preview
include SolidusAdmin::Preview

def overview
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# @component "sidebar/account_nav"
class SolidusAdmin::Sidebar::AccountNav::ComponentPreview < ViewComponent::Preview
# @component "layout/navigation/account"
class SolidusAdmin::Layout::Navigation::Account::ComponentPreview < ViewComponent::Preview
include SolidusAdmin::Preview

def overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require "solidus_admin/main_nav_item"

# @component "sidebar"
class SolidusAdmin::Sidebar::ComponentPreview < ViewComponent::Preview
# @component "layout/navigation"
class SolidusAdmin::Layout::Navigation::ComponentPreview < ViewComponent::Preview
include SolidusAdmin::Preview

# The item component is used to render main navigation items, which are
Expand All @@ -17,7 +17,7 @@ class SolidusAdmin::Sidebar::ComponentPreview < ViewComponent::Preview
# key: :overview,
# position: 80
# )
# render component("sidebar/item", item: item)
# render component("layout/navigation/item", item: item)
# ```
#
# @param store_name text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require "solidus_admin/main_nav_item"

# @component "sidebar/item"
class SolidusAdmin::Sidebar::Item::ComponentPreview < ViewComponent::Preview
# @component "layout/navigation/item"
class SolidusAdmin::Layout::Navigation::Item::ComponentPreview < ViewComponent::Preview
include SolidusAdmin::Preview

DUMMY_ROUTE = :foo_path
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# @component "skip_link"
class SolidusAdmin::SkipLink::ComponentPreview < ViewComponent::Preview
# @component "layout/skip_link"
class SolidusAdmin::Layout::SkipLink::ComponentPreview < ViewComponent::Preview
include SolidusAdmin::Preview

# Click on the "Preview" window area and press "Tab" to see the skip link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe SolidusAdmin::SkipLink::Component, type: :component do
RSpec.describe SolidusAdmin::Layout::Feedback::Component, type: :component do
it "renders the overview preview" do
render_preview(:overview)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe SolidusAdmin::Sidebar::AccountNav::Component, type: :component do
RSpec.describe SolidusAdmin::Layout::Navigation::Account::Component, type: :component do
it "renders the overview preview" do
render_preview(:overview)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe SolidusAdmin::Sidebar::Component, type: :component do
RSpec.describe SolidusAdmin::Layout::Navigation::Component, type: :component do
before { allow(vc_test_controller).to receive(:spree_current_user).and_return(build(:user)) }

it "renders the overview preview" do
Expand Down Expand Up @@ -32,7 +32,7 @@
end

it "renders the account nav component" do
account_nav_component = mock_component do
account_component = mock_component do
def call
"account nav"
end
Expand All @@ -42,7 +42,7 @@ def call
items: [],
)
allow(component).to receive(:component).and_call_original
allow(component).to receive(:component).with('sidebar/account_nav').and_return(account_nav_component)
allow(component).to receive(:component).with('layout/navigation/account').and_return(account_component)

render_inline(component)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe SolidusAdmin::Sidebar::Item::Component, type: :component do
RSpec.describe SolidusAdmin::Layout::Navigation::Item::Component, type: :component do
def url_helpers(solidus_admin: {}, spree: {})
double(
solidus_admin: double(**solidus_admin),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require "spec_helper"

RSpec.describe SolidusAdmin::Feedback::Component, type: :component do
RSpec.describe SolidusAdmin::Layout::SkipLink::Component, type: :component do
it "renders the overview preview" do
render_preview(:overview)
end
Expand Down
Loading