style: align with the ep-corporate-design skill

This commit is contained in:
fromme committed 2026-11-12 15:24:35 +01:00
1 parent 50ef662dd3
commit ebad54e989
162 files changed
+768 -640

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import { Controller } from '@hotwired/stimulus'
/*
* The sidebar as a drawer on small screens: a modal <dialog> (target "dialog"), so focus stays inside
* and Escape closes it. A click on the dimmed page beside it closes it too, and so does widening the
* window until the sidebar shows (lg).
*/
export default class extends Controller {
static targets = ['dialog']
connect () {
this.wide = window.matchMedia('(min-width: 64rem)')
this.onWide = (event) => event.matches && this.close()
this.wide.addEventListener('change', this.onWide)
}
disconnect () {
this.wide.removeEventListener('change', this.onWide)
}
open () {
this.dialogTarget.showModal()
}
close () {
this.dialogTarget.close()
}
// a click on the dialog element itself, not on its content, is a click on the backdrop
closeOnBackdrop (event) {
if (event.target === this.dialogTarget) {
this.close()
}
}
}
@@ -1,16 +0,0 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static outlets = [ 'mobilenav' ]
static classes = [ 'closed' ]
trigger({ params: { mode } }) {
this.mobilenavOutlet.toggle(mode)
}
toggle(mode) {
// Add animation classes only now to avoid fouc
this.element.classList.add('transition-transform', 'duration-300')
this.element.classList.toggle(this.closedClass, 'close' === mode)
}
}
@@ -1,30 +0,0 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static classes = ['closed', 'iconClosed', 'iconExpanded']
static targets = ['submenu', 'button', 'icon']
static values = { expanded: Boolean }
toggleSubmenu() {
this.expandedValue = !this.expandedValue
}
expandedValueChanged(expanded) {
this.submenuTarget.classList.toggle(this.closedClass, false === expanded)
if (false === this.hasButtonTarget) {
return
}
this.buttonTarget.setAttribute('aria-expanded', expanded)
if (false === this.hasIconTarget) {
return
}
if (true === expanded) {
this.iconTarget.classList.add(...this.iconExpandedClasses)
this.iconTarget.classList.remove(...this.iconClosedClasses)
} else {
this.iconTarget.classList.add(...this.iconClosedClasses)
this.iconTarget.classList.remove(...this.iconExpandedClasses)
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-33
View File
@@ -1,36 +1,3 @@
/* lato-regular - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Lato';
font-style: normal;
font-weight: 400;
src: url('../fonts/lato-v24-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* lato-italic - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Lato';
font-style: italic;
font-weight: 400;
src: url('../fonts/lato-v24-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* lato-700 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Lato';
font-style: normal;
font-weight: 700;
src: url('../fonts/lato-v24-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
/* lato-900 - latin */
@font-face {
font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
font-family: 'Lato';
font-style: normal;
font-weight: 900;
src: url('../fonts/lato-v24-latin-900.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}
.htmx-indicator{
@apply invisible;
}
-34
View File
@@ -1,43 +1,9 @@
@import "./components/badge.css";
@import "./components/autocomplete.css";
@import "./components/button.css";
@import "./components/datatable.css";
@import "./components/datepicker.css";
@import "./components/toast.css";
@import "./components/tooltip.css";
@import "./components/timeline.css";
@import "./components/mail-body.css";
@import "./components/questionnaire.css";
/* the entries of the header's account menu (_partials/_user_menu.html.twig) */
.user-menu-item {
@apply flex items-center gap-x-3 px-4 py-2 text-ink no-underline hover:bg-page hover:text-brand;
}
/* white box on the light blue page, as the card of the apps portal (EP/apps frontend/components/ui.ts) */
.card {
@apply border border-line bg-white;
}
/* heading of a section or card */
.section-title {
@apply text-base font-semibold uppercase tracking-wide text-brand;
}
/*
* A row of tabs (_partials/_tabs.html.twig, the questionnaire list). The row scrolls sideways on
* narrow screens, which makes it a vertical scroll container too, so nothing may stick out below
* it: the base line is an inset shadow the tabs' underline paints over, not a border they would
* have to overlap with a negative margin.
*/
.tabs {
@apply flex overflow-x-auto shadow-[inset_0_-1px_0_var(--color-line)];
}
.tab {
@apply shrink-0 whitespace-nowrap border-b-4 border-transparent px-3 py-2 text-sm text-ink hover:text-brand;
}
.tab--current {
@apply border-brand-bright font-bold text-brand;
}
+2 -66
View File
@@ -1,4 +1,6 @@
@import "tailwindcss";
@import "toastify-js/src/toastify.css";
@import "./ep-design.css";
@import "./_base.css" layer(base);
@import "./_components.css" layer(components);
@@ -6,66 +8,6 @@
@source inline("rotate-90");
/*
* Corporate design of the internal E&P tools, as defined by the apps portal (Gitea EP/apps,
* frontend/app/globals.css) and ported to Symfony by epbms: Lato, deep blue as the brand colour,
* magenta only for the main action, square shapes, light blue page.
* Status colours (green, red, amber) always come with text, never alone.
*/
@theme {
--font-sans: Lato, sans-serif;
--font-weight-semibold: 700;
--font-weight-bold: 900;
/* square everywhere; rounded-full stays round. Plain `rounded` reads --radius. */
--radius: 0px;
--radius-xs: 0px;
--radius-sm: 0px;
--radius-md: 0px;
--radius-lg: 0px;
--radius-xl: 0px;
--radius-2xl: 0px;
--radius-3xl: 0px;
--radius-4xl: 0px;
--color-brand: #18527b; /* E&P deep blue, 8.5:1 on white */
--color-brand-dark: #103c5b;
--color-brand-mid: #165883;
--color-brand-bright: #009fff; /* underlines and focus, never text */
--color-brand-light: #e3eef8;
--color-page: #ebf3fa; /* page background */
--color-line: #d8e3ed; /* borders */
--color-ink: #27272a; /* text */
--color-muted: #52525b; /* secondary text, 7.7:1 on white */
--color-accent: #c4097c; /* magenta of the main action */
--color-accent-from: #960167;
--color-accent-to: #fa1a8c;
/* the colour name the templates were written with, now on the brand colour */
--color-primary: var(--color-brand);
}
/*
* Tailwind 3 defaults that Tailwind 4 changed: borders were gray-200 instead of currentColor,
* and buttons had a pointer cursor.
*/
@layer base {
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-line, currentcolor);
}
button:not(:disabled),
[role="button"]:not(:disabled) {
cursor: pointer;
}
}
/*
* Thin scrollbars without a track for inner scrolling areas. The page scrollbar takes its
* style from <html>, which body * leaves out. Firefox and Chrome/Edge 121+ honour these;
@@ -76,10 +18,4 @@
scrollbar-width: thin;
scrollbar-color: var(--color-gray-300) transparent;
}
/* visible keyboard focus everywhere (WCAG 2.4.7) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
outline: 3px solid var(--color-brand-bright);
outline-offset: 2px;
}
}
-28
View File
@@ -1,28 +0,0 @@
/*
* Buttons as in the apps portal (EP/apps frontend/components/ui.ts): square, small bold uppercase.
* The default is filled brand blue; magenta (.btn--cta) only for the one main action of a page.
*/
.btn {
@apply inline-flex space-x-1 justify-center items-center text-xs uppercase tracking-wide font-semibold py-2.5 px-4 no-underline transition-colors;
@apply bg-brand text-white hover:bg-brand-dark disabled:opacity-50 disabled:cursor-not-allowed;
}
.btn--small {
@apply py-1 px-2;
}
.btn--secondary {
@apply border border-brand bg-white text-brand hover:bg-brand hover:text-white;
}
.btn--cta {
background-image: linear-gradient(120deg, var(--color-accent-from), #9e036a 40%, var(--color-accent-to));
}
.btn--cta:hover {
background-image: linear-gradient(120deg, #7d0156, #8a035d 40%, #e3107c);
}
.btn--cta:disabled {
background-image: none;
}
-23
View File
@@ -1,23 +0,0 @@
@import "toastify-js/src/toastify.css";
.toastify {
@apply max-w-sm border-l-4 px-4 py-3 text-sm shadow-lg;
background: none;
}
/* in the colours of the alerts, as in epbms */
.toastify--success {
@apply border-emerald-700 bg-emerald-50 text-emerald-950;
}
.toastify--warning {
@apply border-red-700 bg-red-50 text-red-950;
}
.toastify--info {
@apply border-brand bg-brand-light text-ink;
}
.toastify .toast-close {
@apply ml-3 text-current opacity-60 hover:opacity-100;
}
+5 -5
View File
@@ -1,18 +1,18 @@
@import "tippy.js/dist/tippy.css";
.tippy-box {
background-color: var(--color-primary);
background-color: var(--color-brand);
}
.tippy-box[data-placement^='top'] > .tippy-arrow::before {
border-top-color: var(--color-primary);
border-top-color: var(--color-brand);
}
.tippy-box[data-placement^='bottom'] > .tippy-arrow::before {
border-bottom-color: var(--color-primary);
border-bottom-color: var(--color-brand);
}
.tippy-box[data-placement^='left'] > .tippy-arrow::before {
border-left-color: var(--color-primary);
border-left-color: var(--color-brand);
}
.tippy-box[data-placement^='right'] > .tippy-arrow::before {
border-right-color: var(--color-primary);
border-right-color: var(--color-brand);
}
+316
View File
@@ -0,0 +1,316 @@
/*
* E&P corporate design for the internal Symfony tools, taken from the E&P apps template (Gitea EP/apps,
* frontend/app/globals.css, frontend/components/): Lato, deep blue as the brand colour, magenta only
* for the one main action of a page, square shapes, light blue page.
* Status colours (green, red, amber) always come with text, never alone.
*
* Import after Tailwind: @import "tailwindcss"; @import "./ep-design.css"; @plugin "@tailwindcss/forms";
* The toast styles expect toastify-js (@import "toastify-js/src/toastify.css" before this file).
*/
/*
* Lato (OFL) ships with the app, so browsers load nothing from Google: 400 (and italic), 700, 900. No 600:
* font-semibold renders as 700, like font-bold; font-black is 900. The weights are not remapped.
*/
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("../fonts/lato-400.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: italic;
font-weight: 400;
font-display: swap;
src: url("../fonts/lato-400-italic.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 700;
font-display: swap;
src: url("../fonts/lato-700.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 900;
font-display: swap;
src: url("../fonts/lato-900.woff2") format("woff2");
}
@theme {
--font-sans: "Lato", ui-sans-serif, system-ui, sans-serif;
/* square everywhere; rounded-full stays round. Plain `rounded` reads --radius. */
--radius: 0px;
--radius-xs: 0px;
--radius-sm: 0px;
--radius-md: 0px;
--radius-lg: 0px;
--radius-xl: 0px;
--radius-2xl: 0px;
--radius-3xl: 0px;
--radius-4xl: 0px;
--color-brand: #18527b; /* E&P deep blue, 8.5:1 on white */
--color-brand-dark: #103c5b;
--color-brand-mid: #165883;
--color-brand-bright: #009fff; /* underlines and focus, never text */
--color-brand-light: #e3eef8;
--color-page: #ebf3fa; /* page background */
--color-line: #d8e3ed; /* borders */
--color-ink: #27272a; /* text */
--color-muted: #52525b; /* secondary text, 7.7:1 on white */
--color-accent: #c4097c; /* magenta of the main action */
--color-accent-from: #960167;
--color-accent-to: #fa1a8c;
}
/*
* Tailwind 3 defaults that Tailwind 4 changed: borders were a light gray instead of currentColor,
* and buttons had a pointer cursor.
*/
@layer base {
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-line, currentcolor);
}
button:not(:disabled),
[role="button"]:not(:disabled) {
cursor: pointer;
}
/* modals: centred (Preflight resets the browser's margin: auto), the page behind dimmed and blurred */
dialog:modal {
margin: auto;
max-height: 85vh;
}
dialog::backdrop {
background: rgb(39 39 42 / 0.35);
backdrop-filter: blur(3px);
}
/* visible keyboard focus everywhere (WCAG 2.4.7) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
outline: 3px solid var(--color-brand-bright);
outline-offset: 2px;
}
}
/*
* Components as in the apps template (frontend/components/ui.ts, Field.tsx, Alert.tsx). Magenta
* only for the one main action of a page.
*/
@layer components {
.btn,
.btn-primary,
.btn-secondary {
@apply inline-flex items-center justify-center gap-2 px-4 py-2.5 text-xs font-bold uppercase tracking-wide no-underline transition-colors disabled:cursor-not-allowed;
}
.btn-primary {
@apply text-white;
background-image: linear-gradient(120deg, var(--color-accent-from), #9e036a 40%, var(--color-accent-to));
}
.btn-primary:hover {
background-image: linear-gradient(120deg, #7d0156, #8a035d 40%, #e3107c);
}
.btn-primary:disabled {
background-image: none;
background-color: #64748b;
}
.btn-secondary {
@apply border border-brand bg-white text-brand hover:bg-brand hover:text-white;
}
/* small actions in toolbars and on cards, next to the one main action */
.btn-tool {
@apply inline-flex items-center gap-1 rounded border border-line bg-white px-2 py-1 text-sm text-ink hover:border-brand hover:text-brand disabled:cursor-default disabled:border-line disabled:text-gray-400;
}
/* the "⋯" behind which the actions of a card or row wait (menu_controller.js) */
.btn-more {
@apply inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-muted hover:bg-page hover:text-brand aria-expanded:bg-page aria-expanded:text-brand;
}
.menu-panel {
@apply fixed z-40 min-w-48 border border-line bg-white py-1 text-sm shadow-lg;
}
.menu-item {
@apply block w-full px-3 py-1.5 text-left text-ink no-underline hover:bg-page hover:text-brand focus:bg-page;
}
.menu-item-danger {
@apply block w-full px-3 py-1.5 text-left text-red-800 hover:bg-page hover:text-red-900 focus:bg-page;
}
.input {
@apply block w-full border border-slate-500 bg-white px-3 py-2 text-sm text-slate-900 placeholder:text-slate-500 focus:border-brand-bright aria-[invalid=true]:border-red-700 aria-[invalid=true]:ring-1 aria-[invalid=true]:ring-red-700 disabled:bg-slate-100 disabled:text-slate-600;
}
.field-label {
@apply block text-xs font-bold uppercase tracking-wide text-slate-700;
}
/* white box on the light blue page */
.card {
@apply border border-line bg-white;
}
.section-title {
@apply text-base font-bold uppercase tracking-wide text-brand;
}
/* a row of tabs; the base line is an inset shadow, so a row that scrolls sideways doesn't scroll vertically too */
.tabs {
@apply flex overflow-x-auto shadow-[inset_0_-1px_0_var(--color-line)];
}
.tab {
@apply shrink-0 whitespace-nowrap border-b-4 border-transparent px-3 py-2 text-sm text-ink no-underline hover:text-brand;
}
.tab[aria-current],
.tab[aria-selected="true"] {
@apply border-brand-bright font-bold text-brand;
}
/* the main views as tabs in the header (_partials/_header.html.twig), for apps with few views */
.header-tab {
@apply flex items-center whitespace-nowrap border-b-4 border-transparent px-3 text-ink no-underline hover:text-brand;
}
.header-tab[aria-current] {
@apply border-brand-bright font-bold text-brand;
}
/*
* Sidebar navigation for apps with many views (_partials/_sidebar_menu.html.twig): on the light
* blue page, the current item is a white box.
*/
.sidebar-heading {
@apply px-2 pt-5 pb-1 text-[11px] font-bold uppercase tracking-wide text-muted;
}
.sidebar-link {
@apply flex w-full items-center gap-x-3 p-2 text-left text-sm leading-6 font-bold text-ink no-underline hover:bg-white/60 hover:text-brand;
}
.sidebar-sublink {
@apply block py-2 pr-2 pl-10 text-sm leading-6 text-ink no-underline hover:bg-white/60 hover:text-brand;
}
:is(.sidebar-link, .sidebar-sublink)[aria-current],
.sidebar-link--ancestor {
@apply bg-white text-brand;
}
.sidebar-group > summary {
@apply list-none;
}
.sidebar-group > summary::-webkit-details-marker {
display: none;
}
/* chevron of a group that opens in place */
.sidebar-group > summary::after {
@apply ml-auto size-2 shrink-0 rotate-45 border-r-2 border-b-2 border-current opacity-60 transition-transform content-[''];
}
.sidebar-group[open] > summary::after {
@apply -rotate-135;
}
/* the sidebar as a drawer from the left on small screens (drawer_controller.js) */
dialog.drawer {
@apply m-0 h-dvh max-h-none w-80 max-w-[calc(100vw-4rem)] bg-page p-0;
}
/* lists in a card: the outer cells line up with the card's padding */
.data-table {
@apply w-full;
}
.data-table thead tr {
@apply border-b-2 border-brand text-left text-[11px] font-bold uppercase tracking-wide text-brand;
}
.data-table th {
@apply px-2 py-2;
}
.data-table td {
@apply px-2 py-1.5;
}
.data-table :is(th, td):first-child {
@apply pl-5;
}
.data-table :is(th, td):last-child {
@apply pr-5;
}
.data-table tbody tr {
@apply border-b last:border-b-0;
}
/* notices (_partials/_alert.html.twig): light, with a coloured bar on the left */
.notice {
@apply border-l-4 px-4 py-2;
}
/* toasts (toast_controller.js) in the colours of the notices */
.toastify {
@apply max-w-sm rounded-none border-l-4 bg-none px-4 py-3 text-sm shadow-lg;
}
.toastify--success {
@apply border-emerald-700 bg-emerald-50 text-emerald-950;
}
.toastify--error {
@apply border-red-700 bg-red-50 text-red-950;
}
.toastify--warning {
@apply border-amber-600 bg-amber-50 text-amber-950;
}
.toastify--info {
@apply border-brand bg-brand-light text-ink;
}
.toastify .toast-close {
@apply ml-3 text-current opacity-60 hover:opacity-100;
}
}
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
scroll-behavior: auto !important;
}
}