Skip to content

Commit 755a55d

Browse files
committed
Reorganize content on ecosystem page
1 parent 2f26b9f commit 755a55d

62 files changed

Lines changed: 514 additions & 94 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<h2 class="text-2xl font-bold mt-12 mb-6">
2+
<%= @title %>
3+
</h2>
4+
5+
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 mb-4">
6+
<% @resources.each do |resource| %>
7+
<%= render Page::ResourceCardComponent.new(resource: resource) %>
8+
<% end %>
9+
</div>
10+
11+
<% if @all_url %>
12+
<%= link_to @all_url do %>
13+
View all <span class="tracking-normal text-white ml-1">-&gt;</span>
14+
<% end %>
15+
<% end %>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
class Page::CardSectionComponent < ViewComponent::Base
4+
def initialize(title:, resources:, limit: 3, all_url: nil)
5+
@title = title
6+
@resources = resources
7+
@limit = limit
8+
@all_url = all_url
9+
end
10+
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<% if image = @resource.data.dig("image") %>
2+
<%= link_to @resource.request_path, class: "h-48 flex items-center justify-center bg-black hover:opacity-75 border border-gray-700 rounded-lg w-full overflow-hidden" do %>
3+
<%= image_tag image_path(image) %>
4+
<% end %>
5+
<% else %>
6+
<%= link_to @resource.request_path, class: "p-6 h-48 flex items-center justify-center bg-gray-950 hover:bg-gray-900 border border-gray-700 rounded-lg w-full font-bold text-2xl text-center" do %>
7+
<%= @resource.data.fetch("title") %>
8+
<% end %>
9+
<% end %>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
class Page::ResourceCardComponent < ViewComponent::Base
4+
def initialize(resource:)
5+
@resource = resource
6+
end
7+
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class EcosystemModel < Sitepress::Model
22
collection glob: "**/ecosystem/*.html*"
3-
data :title, :subtitle
3+
data :title, :subtitle, :order
44
end

app/content/pages/ecosystem.html.erb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ title: Ecosystem
55
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
66
<% page.with_title(title: current_page.data.fetch("title")) %>
77

8-
<div class="grid grid-cols-3">
9-
<% EcosystemModel.all.sort_by(&:title).each do |page| %>
10-
<div class="flex flex-col gap-x-4">
11-
<h2 class="font-bold text-lg underline"><%= link_to page.title, page.request_path %></h2>
12-
</div>
13-
<% end %>
14-
</div>
8+
<% EcosystemModel.all.sort_by(&:order).each do |page| %>
9+
<%= render Page::CardSectionComponent.new(
10+
title: page.title,
11+
resources: site.resources.glob("#{page.page.request_path}/*.html.erb".delete_prefix("/")).sort_by { |site| site.data.fetch("title") }.take(3),
12+
all_url: page.request_path
13+
) %>
14+
<% end %>
1515
<% end %>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
---
22
title: Components
3+
order: 7
34
---
45

56
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
67
<% page.with_title(title: current_page.data.fetch("title")) %>
78

89
https://github.com/excid3/tailwindcss-stimulus-components<br/>
910
https://www.stimulus-components.com<br/>
11+
12+
<%= render Page::CardSectionComponent.new(
13+
title: current_page.data.fetch("title"),
14+
resources: site.resources.glob("#{current_page.request_path}/*.html.erb".delete_prefix("/")).sort_by { |site| site.data.fetch("title") },
15+
) %>
1016
<% end %>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Stimulus Components
3+
---
4+
5+
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
6+
<% page.with_title(title: current_page.data.fetch("title")) %>
7+
8+
<%= link_to "stimulus-components", "https://github.com/stimulus-components", target: :blank %><br/>
9+
<%= link_to "Documentation", "https://www.stimulus-components.com", target: :blank %><br/>
10+
<% end %>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Tailwindcss Stimulus Components
3+
---
4+
5+
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
6+
<% page.with_title(title: current_page.data.fetch("title")) %>
7+
8+
<%= link_to "excid3/tailwindcss-stimulus-components", "https://github.com/excid3/tailwindcss-stimulus-components", target: :blank %><br/>
9+
<%= link_to "Documentation", "https://excid3.github.io/tailwindcss-stimulus-components/", target: :blank %><br/>
10+
<% end %>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
---
22
title: Core Libraries
3+
order: 1
34
---
45

56
<%= render Page::ContainerComponent.new(page: current_page) do |page| %>
67
<% page.with_title(title: current_page.data.fetch("title")) %>
8+
9+
<%= render Page::CardSectionComponent.new(
10+
title: current_page.data.fetch("title"),
11+
resources: site.resources.glob("#{current_page.request_path}/*.html.erb".delete_prefix("/")).sort_by { |site| site.data.fetch("title") },
12+
) %>
713
<% end %>

0 commit comments

Comments
 (0)