diff --git a/app/assets/stylesheets/components/_post.scss b/app/assets/stylesheets/components/_post.scss index c4f3dfed..d7788675 100644 --- a/app/assets/stylesheets/components/_post.scss +++ b/app/assets/stylesheets/components/_post.scss @@ -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); + } + } } diff --git a/app/components/post_component.html.erb b/app/components/post_component.html.erb index 28e77e2d..52eb84e2 100644 --- a/app/components/post_component.html.erb +++ b/app/components/post_component.html.erb @@ -13,7 +13,7 @@ <% end %> <% else %> -
+
<% if deleted? %>
diff --git a/app/components/post_component.rb b/app/components/post_component.rb index 0e435afd..e732eb84 100644 --- a/app/components/post_component.rb +++ b/app/components/post_component.rb @@ -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 @@ -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 diff --git a/app/controllers/explore_controller.rb b/app/controllers/explore_controller.rb index a2088276..3a024538 100644 --- a/app/controllers/explore_controller.rb +++ b/app/controllers/explore_controller.rb @@ -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 ] ) diff --git a/app/views/explore/index.html.erb b/app/views/explore/index.html.erb index 55851295..49efe1b3 100644 --- a/app/views/explore/index.html.erb +++ b/app/views/explore/index.html.erb @@ -13,7 +13,7 @@ <%= render "explore/explore_nav" %>
- <%= render PostComponent.with_collection(@devlogs, current_user: current_user) %> + <%= render PostComponent.with_collection(@devlogs, current_user: current_user, theme: :explore_mixed) %>