| 1 | //! The design system reference pages. |
| 2 | //! |
| 3 | //! Static: they render tokens and components, and touch neither the database |
| 4 | //! nor the store. Public, because a design system is not a secret and the |
| 5 | //! implementation team should be able to link to it. |
| 6 | |
| 7 | use axum::response::{IntoResponse, Response}; |
| 8 | |
| 9 | use crate::error::AppResult; |
| 10 | use crate::state::{CsrfToken, CurrentUser, Nonce}; |
| 11 | use crate::views::{self, Chrome}; |
| 12 | |
| 13 | /// `GET /design` |
| 14 | pub async fn sheet( |
| 15 | CurrentUser(user): CurrentUser, |
| 16 | CsrfToken(csrf): CsrfToken, |
| 17 | Nonce(nonce): Nonce, |
| 18 | ) -> AppResult<Response> { |
| 19 | Ok(views::page( |
| 20 | Chrome { title: "Component sheet", user: user.as_deref(), csrf: &csrf, nonce: &nonce }, |
| 21 | views::design::sheet(), |
| 22 | ) |
| 23 | .into_response()) |
| 24 | } |
| 25 | |
| 26 | /// `GET /design/rationale` |
| 27 | pub async fn rationale( |
| 28 | CurrentUser(user): CurrentUser, |
| 29 | CsrfToken(csrf): CsrfToken, |
| 30 | Nonce(nonce): Nonce, |
| 31 | ) -> AppResult<Response> { |
| 32 | Ok(views::page( |
| 33 | Chrome { title: "Design rationale", user: user.as_deref(), csrf: &csrf, nonce: &nonce }, |
| 34 | views::design::rationale(), |
| 35 | ) |
| 36 | .into_response()) |
| 37 | } |
37 lines · Rust