Skip to content

Commit

Permalink
Applied branding on assignment card
Browse files Browse the repository at this point in the history
  • Loading branch information
mellelieuwes committed Nov 30, 2023
1 parent 8bc361d commit 94d27a4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
31 changes: 26 additions & 5 deletions core/systems/project/card_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ defmodule Systems.Project.CardView do
import Frameworks.Pixel.Tag
import Frameworks.Pixel.ClickableCard
alias Frameworks.Pixel.Card
alias Frameworks.Pixel.Image

attr(:card, :map, required: true)

Expand Down Expand Up @@ -57,6 +58,8 @@ defmodule Systems.Project.CardView do
attr(:title, :string, required: true)
attr(:label, :map, required: true)
attr(:tags, :list, default: [])
attr(:image_info, :map, default: nil)
attr(:icon_url, :string, default: nil)

attr(:bg_color, :string, default: "grey1")
attr(:text_color, :string, default: "text-white")
Expand All @@ -77,12 +80,30 @@ defmodule Systems.Project.CardView do
right_actions={@right_actions}
>
<:top>
<%= if @label do %>
<div>
<.spacing value="S" />
<Card.label {@label} />
<div class="relative">
<%= if @label do %>
<div class={"#{if @image_info do "absolute top-6 z-10" else "mt-6" end}"}>
<Card.label {@label} />
</div>
<% end %>
<%= if @icon_url do %>
<div class="absolute top-6 right-6 z-10">
<Icon.card url={@icon_url} />
</div>
<% end %>
<%= if @image_info do %>
<div class="h-image-card">
<Image.blurhash
id={Integer.to_string(@id)}
image={@image_info}
transition="duration-500"
corners="rounded-t-lg"
/>
</div>
<% end %>
</div>
<% end %>
</:top>
<:title>
Expand Down
12 changes: 10 additions & 2 deletions core/systems/project/item_model.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ defmodule Systems.Project.ItemModel do
import Ecto.Changeset
import CoreWeb.Gettext

alias Core.ImageHelpers

alias Systems.{
Project,
Assignment,
Expand Down Expand Up @@ -87,14 +89,18 @@ defmodule Systems.Project.ItemModel do
assignment:
%{
id: assignment_id,
status: status,
info: %{
subject_count: subject_count
subject_count: subject_count,
image_id: image_id,
logo_url: logo_url
}
} = assignment
},
{Project.NodePage, :item_card},
_user
) do
image_info = ImageHelpers.get_image_info(image_id, 120, 115)
tags = get_card_tags(assignment)
path = ~p"/assignment/#{assignment_id}/content"

Expand All @@ -112,7 +118,9 @@ defmodule Systems.Project.ItemModel do
type: :secondary,
id: id,
path: path,
label: get_label(:concept),
image_info: image_info,
icon_url: logo_url,
label: get_label(status),
title: name,
tags: tags,
info: ["#{subject_count} participants | 0 donations"],
Expand Down

0 comments on commit 94d27a4

Please sign in to comment.