Trial banner
How long a trial has left, with a ring and the way to upgrade: a
ds::announcement-bar above the app, or a card in a page. Plain Blade but for
dismissKey.
Anatomy
bar: ds::announcement-bar[data-ds-trial=state] (tone, href, actionLabel, dismissKey)
└── [ring: ds::progress circle sm, in aria-hidden] message (+ slot)
card: div[data-ds-trial=state] (dsDismiss root with dismissKey)
└── div.rounded-panel.border.{wash}
├── ring (ds::progress circle md, the days in its middle) or a clock
├── p.font-semibold message, then the slot
└── ds::button href (primary, sm), ✕ (data-ds-dismiss) with dismissKey
Counting
In PHP, once, at render. endsAt is parsed with Carbon and compared with
Carbon::now() in the end date's timezone; days are calendar days between the
two dates' starts of day. Past the end is expired. daysLeft instead: 0 is
the last day, negative has ended. One of the two is required (throws).
| State | When | Tone | Text | Ring |
|---|---|---|---|---|
days | 2+ days, above warnAt | accent | message (:count) | yes |
days / tomorrow | warnAt days or fewer | warning | message / tomorrowMessage | yes |
today | 0 days | danger | todayMessage | no: a clock (card) |
expired | after the end | danger | expiredMessage | no: a clock (card) |
The ring is ds::progress variant="circle", value = days left (clamped to
total), max = total, in the tone. It is hidden from assistive technology
because the sentence carries the same thing; a progressbar's percentage would
be the time said twice, worse.
Variants
- bar: the announcement bar with
:icon="false", the ring in its message. A landmark named bylabel("Trial"); never a live region, never urgent. Dismissal, pre-paint check and all, is the bar's own. - card: the alert's washes per tone,
rounded-panel, wrapping. WithdismissKeyit is adsDismissroot with the announcement bar's grid-row collapse and the same pre-paintDismissal::script; its ✕ is invisible until the script starts. No key, no ✕.
Accessibility
| Role | bar: region named label; card: none |
| State | in words; tone and ring repeat it |
| Keyboard | the action link; the ✕ when shown |
| Motion | the collapse is motion-safe:; nothing else moves |
Do not
- Do not count in the browser. The server's count is the one the billing code agrees with.
- Do not show "0 days left". The last day and the end have sentences.
- Do not dismiss without a key. It would be back on the next load.
From the package repo: edit this page on GitHub.