feat: Refactor dashboard layout with new DashboardSection and DashboardTile components for improved responsiveness and organization
This commit is contained in:
1 parent
d51bfd3daa
commit
422a117026
5 files changed
+390
-167
No files matched your search
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Abschnitt mit optionalem Kopf (Titel, Beschreibung, Aktionen) und unterem Rand zur optischen Trennung.
|
||||
*/
|
||||
export default function DashboardSection({
|
||||
title,
|
||||
description,
|
||||
headerRight,
|
||||
children,
|
||||
className = '',
|
||||
bodyClassName = ''
|
||||
}) {
|
||||
const showHeader = title || description || headerRight
|
||||
return (
|
||||
<section className={`dashboard-section ${className}`.trim()}>
|
||||
{showHeader && (
|
||||
<header className="dashboard-section__header">
|
||||
<div className="dashboard-section__headline">
|
||||
{title ? <h2 className="dashboard-section__title">{title}</h2> : null}
|
||||
{description ? (
|
||||
<p className="dashboard-section__description">{description}</p>
|
||||
) : null}
|
||||
</div>
|
||||
{headerRight ? (
|
||||
<div className="dashboard-section__actions">{headerRight}</div>
|
||||
) : null}
|
||||
</header>
|
||||
)}
|
||||
<div className={`dashboard-section__body ${bodyClassName}`.trim()}>{children}</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
clampTileSpan,
|
||||
DASHBOARD_TILE_GRID_COLS
|
||||
} from '../utils/dashboardLayout'
|
||||
|
||||
/**
|
||||
* Kachel im Raster `.dashboard-tile-grid` / `.dashboard-stat-grid`.
|
||||
* Standard: volle Zeile (Mobile 2/2, Desktop 4/4). Anpassbar via spanMobile / spanDesktop.
|
||||
*/
|
||||
export default function DashboardTile({
|
||||
children,
|
||||
spanMobile = DASHBOARD_TILE_GRID_COLS.mobile,
|
||||
spanDesktop = DASHBOARD_TILE_GRID_COLS.desktop,
|
||||
className = ''
|
||||
}) {
|
||||
const sm = clampTileSpan(spanMobile, DASHBOARD_TILE_GRID_COLS.mobile)
|
||||
const lg = clampTileSpan(spanDesktop, DASHBOARD_TILE_GRID_COLS.desktop)
|
||||
return (
|
||||
<div
|
||||
className={`dashboard-tile ${className}`.trim()}
|
||||
style={{
|
||||
'--tile-sm': String(sm),
|
||||
'--tile-lg': String(lg)
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user