MailglassAdmin.Components (MailglassAdmin v1.0.0)

Copy Markdown View Source

Brand-book-aligned shared UI atoms used throughout mailglass_admin.

Components

  • icon/1 — Heroicon via the vendored heroicons.js Tailwind plugin (Phoenix 1.8 installer convention). Classes matching the pattern hero-<name> are resolved at build time into inline SVG.
  • logo/1 — mailglass wordmark served from priv/static/mailglass-logo.svg via MailglassAdmin.Controllers.Assets.
  • flash/1 — toast-style flash message for LiveReload + success notifications. Brand-voice: no "Oops!", no "Uh oh!"; specific and composed per brand book §5.
  • badge/1 — sidebar status badge with two variants: :warning (preview_props/0 raised) and :stub (no preview_props defined).

Brand voice enforcement

Copy throughout these atoms follows the 05-UI-SPEC Copywriting Contract: clear, exact, confident, warm, technical — "a thoughtful maintainer." Banned phrases ("Oops", "Whoops", "Uh oh", "Something went wrong") never appear in this module; the voice test greps the rendered HTML to enforce the floor.

Boundary classification: submodule auto-classifies into the MailglassAdmin root boundary declared in lib/mailglass_admin.ex; classify_to: is reserved for mix tasks and protocol implementations and is not used here.

Summary

Functions

Sidebar status badge. Two variants

Renders a brand-voice flash message in a daisyUI toast wrapper.

Renders a Heroicon via the vendored heroicons.js Tailwind plugin.

Renders the mailglass logo. The src is relative so the browser resolves it against the current document URL — the logo is served by MailglassAdmin.Controllers.Assets at <mount>/logo.svg.

Functions

badge(assigns)

(since 0.1.0)

Sidebar status badge. Two variants:

  • :warning — preview_props/0 raised; shows an exclamation-triangle Heroicon + the literal copy "Error" (per 05-UI-SPEC Badge section).
  • :stub — mailable has no preview_props/0 defined; shows the "—" glyph in Slate (secondary) color.

Attributes

  • variant (:atom) (required) - Must be one of :warning, or :stub.

flash(assigns)

(since 0.1.0)

Renders a brand-voice flash message in a daisyUI toast wrapper.

Used for LiveReload notifications ("Reloaded: {file}") and other transient signals. Includes role="status" + aria-live="polite" per the 05-UI-SPEC Accessibility Interactions contract.

Attributes

  • kind (:atom) - Defaults to :info. Must be one of :info, :success, :warning, or :error.
  • message (:string) (required)

icon(assigns)

(since 0.1.0)

Renders a Heroicon via the vendored heroicons.js Tailwind plugin.

The plugin resolves classes matching hero-<name> into inline SVG at build time. Usage: <.icon name="hero-envelope" class="w-5 h-5" />.

Attributes

  • name (:string) (required)
  • class (:any) - Defaults to nil.

logo(assigns)

(since 0.1.0)

Renders the mailglass logo. The src is relative so the browser resolves it against the current document URL — the logo is served by MailglassAdmin.Controllers.Assets at <mount>/logo.svg.

Attributes

  • class (:any) - Defaults to nil.