PhoenixKitProjects.Web.Components.AssignmentStatusBadge (PhoenixKitProjects v0.4.0)

Copy Markdown View Source

Status presentation for an Assignment.status value ("todo", "in_progress", "done"). Mirrors DerivedStatusBadge but for the assignment lifecycle instead of the project lifecycle.

Helpers

All three helpers accept an arbitrary string and fall back to the "todo" styling on unknown values so a half-broken DB row still renders sensibly.

  • color/1 — Tailwind bg-* class for filled circles/dots.
  • badge_class/1 — daisyUI badge-* variant class.
  • label/1 — gettext'd human label (falls back to the raw value).

Component

<.assignment_status_badge status={assignment.status} />
<.assignment_status_badge status={assignment.status} size="sm" />

Summary

Functions

daisyUI badge variant class for an assignment status.

Tailwind background-color class for an assignment status.

Localized human label for an assignment status.

Functions

assignment_status_badge(assigns)

Attributes

  • status (:string) (required)
  • size (:string) - Defaults to "sm". Must be one of "xs", "sm", "md", or "lg".
  • class (:string) - Defaults to nil.

badge_class(_)

@spec badge_class(String.t() | nil) :: String.t()

daisyUI badge variant class for an assignment status.

color(_)

@spec color(String.t() | nil) :: String.t()

Tailwind background-color class for an assignment status.

label(other)

@spec label(String.t() | nil) :: String.t()

Localized human label for an assignment status.