Skip to content
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
129 changes: 129 additions & 0 deletions app/assets/stylesheets/components/_post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,133 @@
height: 16px;
fill: currentColor;
}

// Explore page variants
&--theme-fire {
background-color: var(--color-red-400);
border-color: var(--color-red-300);

.post__avatar {
background-color: var(--color-red-300);
}
.post__attachment {
background: var(--color-red-300);
}
.post__viewport {
background: var(--color-red-300);
}
.post__chevron {
background: var(--color-red-400);
}
.post__dot.is-active {
background: var(--color-red-400);
}
&::after {
border-color: var(--color-red-300);
background-color: var(--color-red-450);
}
.comments-section {
--comments-bg-col: var(--color-red-500);
--comments-text-col: var(--color-red-300);
}
.comment-form {
--comment-box-col: var(--color-red-300);
}
}

&--theme-devlog {
background-color: var(--color-green-400);
border-color: var(--color-green-300);

.post__avatar {
background-color: var(--color-green-300);
}
.post__attachment {
background: var(--color-green-300);
}
.post__viewport {
background: var(--color-green-300);
}
.post__chevron {
background: var(--color-green-300);
}
.post__dot.is-active {
background: var(--color-green-300);
}
&::after {
border-color: var(--color-green-300);
background-color: var(--color-green-450);
}
.comments-section {
--comments-bg-col: var(--color-green-500);
--comments-text-col: var(--color-green-300);
}
.comment-form {
--comment-box-col: var(--color-green-300);
}
}

&--theme-certified {
background-color: var(--color-blue-400);
border-color: var(--color-teal-400);

.post__avatar {
background-color: var(--color-blue-300);
}
.post__attachment {
background: var(--color-blue-300);
}
.post__viewport {
background: var(--color-blue-300);
}
.post__chevron {
background: var(--color-blue-400);
}
.post__dot.is-active {
background: var(--color-blue-400);
}
&::after {
border-color: var(--color-teal-400);
background-color: var(--color-blue-300);
}
.comments-section {
--comments-bg-col: var(--color-blue-300);
--comments-text-col: var(--color-blue-500);
}
.comment-form {
--comment-box-col: var(--color-teal-400);
}
}

&--theme-ship {
background-color: var(--color-yellow-500);
border-color: var(--color-yellow-300);

.post__avatar {
background-color: var(--color-yellow-400);
}
.post__attachment {
background: var(--color-yellow-400);
}
.post__viewport {
background: var(--color-yellow-400);
}
.post__chevron {
background: var(--color-yellow-450);
}
.post__dot.is-active {
background: var(--color-yellow-450);
}
&::after {
border-color: var(--color-yellow-300);
background-color: var(--color-yellow-450);
}
.comments-section {
--comments-bg-col: var(--color-yellow-450);
--comments-text-col: var(--color-yellow-600);
}
.comment-form {
--comment-box-col: var(--color-yellow-300);
}
}
}
2 changes: 1 addition & 1 deletion app/components/post_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<% end %>
</article>
<% else %>
<article class="post <%= variant_class %><%= ' post--deleted' if deleted? %>">
<article class="post <%= variant_class %> <%= theme_class %><%= ' post--deleted' if deleted? %>">
<div class="post__content">
<% if deleted? %>
<div class="post__deleted-banner">
Expand Down
11 changes: 10 additions & 1 deletion app/components/post_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ class PostComponent < ViewComponent::Base

attr_reader :post

def initialize(post:, current_user: nil)
def initialize(post:, current_user: nil, theme: nil)
@post = post
@current_user = current_user
@theme = theme
end

def variant
Expand Down Expand Up @@ -140,4 +141,12 @@ def delete_devlog_path
return nil unless post.project.present?
helpers.project_devlog_path(post.project, postable)
end

def theme_class
return nil unless @theme = :explore_mixed

themes = %i[devlog ship fire certified]
picked = themes[post.id.to_i % themes.length]
"post--theme-#{picked}"
end
end
2 changes: 1 addition & 1 deletion app/controllers/explore_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def index
format.json do
html = @devlogs.map do |post|
render_to_string(
PostComponent.new(post: post, current_user: current_user),
PostComponent.new(post: post, current_user: current_user, theme: :explore_mixed),
layout: false,
formats: [ :html ]
)
Expand Down
2 changes: 1 addition & 1 deletion app/views/explore/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<%= render "explore/explore_nav" %>

<div id="devlog-list" class="explore__list" data-load-more-target="entries">
<%= render PostComponent.with_collection(@devlogs, current_user: current_user) %>
<%= render PostComponent.with_collection(@devlogs, current_user: current_user, theme: :explore_mixed) %>
</div>

<div class="explore__pagination">
Expand Down
Loading