Environment notice
A thin band above the app bar that says this deployment is a development version — its data can be reset and it is not a commercial offer — driven by the deployment's stage: it renders nothing in production.
import { EnvironmentNotice, environmentNotice } from "@krizaka/ui/environment-notice";Web et mobile — le même composant pour React et React Native. Bêta : son API peut encore changer à une version mineure.
Pourquoi il est là. Yomizaka (krizaka/yomizaka#364) on every surface of its dev deployment, then Akinaza and Orazaka.
Quand l’utiliser
- On every screen of a development, staging or preview deployment that people can reach (dev.<product>.com, the admin console, the phone app, the Mac app).
- Whenever the app must tell a visitor that what they see is not the real offer, with the stage read once from configuration.
Quand ne pas l’utiliser
- The announcement of a chapter on a told page (« Step 02 · Payments »).À la place : Stage banner
- A message about the visitor's own situation (a quota, a failure, a maintenance window).À la place : Alert
- A transient confirmation.À la place : Toast
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { EnvironmentNotice, environmentNotice } from "@krizaka/ui/environment-notice";Exemples
A development version
The band above the app bar, with its line and a link; the stage development shows it, production renders nothing.
Another stage
Any stage but production shows the notice; the words are the app's.
Props
| Prop | Type | Défaut | Description |
|---|---|---|---|
messagerequis | string | — | The line (« Data can be reset at any time. Not a commercial offer. »). Passed translated. |
stagerequis | string | null | undefined | — | The deployment's stage, read once by the app. production (or prod) renders nothing; any other value shows the notice. |
titlerequis | string | — | The headline (« Development version »): also the region's accessible name. Passed translated. |
link | { label: string; href: string; } | — | An optional way to learn more. linkAs renders it with your router's Link. |
linkAs | ElementType<any, keyof IntrinsicElements> | — | Renders the link with your router's Link (next/link) instead of an <a>. |
Accessibilité
- A region named by its title (
role=region,aria-label), not a live region: it is there from the first render, not an event. - Its colours are the warning tint over the surface and the text roles (readable in dark and light); there is no motion.
- It cannot be dismissed: the line is part of the page for as long as the stage is not production.
Clavier
| Touches | Action |
|---|---|
| Tab / Enter | Reaches the link, when there is one. |
Bonnes pratiques
- Read the stage once (an env var named by context, such as
APP_ENVIRONMENT, or a setting in the database) and pass it down from the root layout: never anifper page. - Pass the words from your messages (
@krizaka/i18n), French first where the app defaults to French; the package ships none. - Put it above the app bar, outside the content, so it never covers anything and shifts nothing (it is server-rendered with a minimum height).
environmentNotice(config)is the rule if you need it elsewhere (a native shell, a test): it returnsnullforproductionandprod.- Set the stage in the deployment spec of the dev environment; no production spec sets it to development.
Composants liés
Générée depuis le code de @krizaka/ui 3.63.1 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub