diff --git a/index.html b/index.html index f805db5..939ac37 100644 --- a/index.html +++ b/index.html @@ -12,7 +12,7 @@ body, #root { min-height: 100%; - background-color: #dceeea; + background-color: #c5ddd8; } html, diff --git a/src/colors.js b/src/colors.js index d012e4c..c1471f4 100644 --- a/src/colors.js +++ b/src/colors.js @@ -1,2 +1,2 @@ // Mirrored in index.html and index.css for paint before JS loads. -export const MAIN_BACKGROUND = '#dceeea'; +export const MAIN_BACKGROUND = '#c5ddd8'; diff --git a/src/components/article/ArticleView.jsx b/src/components/article/ArticleView.jsx index 5a877a4..75cd845 100644 --- a/src/components/article/ArticleView.jsx +++ b/src/components/article/ArticleView.jsx @@ -13,6 +13,7 @@ import { primaryPrice, } from '../../utils/articleDetail'; import { formatPrice } from '../../utils/price'; +import { PANEL_TILE_KEYS } from '../../theme'; import { formatStock } from '../../pages/artikel/searchFormat'; function PanelValue({ label, children }) { @@ -46,7 +47,6 @@ function ArticlePhoto() { } const headerTileSx = { - p: 1.25, minHeight: 0, }; @@ -99,6 +99,7 @@ export default function ArticleView({ article: articleData, onArticleUpdated }) - + - + {articleData.stock != null ? formatStock(articleData.stock) : null} - + {brandName(articleData)} - + {articleData.sku} {eans.map((ean) => ( @@ -168,7 +169,7 @@ export default function ArticleView({ article: articleData, onArticleUpdated }) ))} - + {basePrice?.net != null ? formatPrice(basePrice.net) : null} @@ -180,14 +181,14 @@ export default function ArticleView({ article: articleData, onArticleUpdated }) - + {articleData.slug} {articleData.seoTitle} {articleData.seoDescription} {articleData.description} - + 0} diff --git a/src/components/panels/EditablePanelTile.jsx b/src/components/panels/EditablePanelTile.jsx index 865d7c1..01dece1 100644 --- a/src/components/panels/EditablePanelTile.jsx +++ b/src/components/panels/EditablePanelTile.jsx @@ -8,6 +8,7 @@ import CircularProgress from '@mui/material/CircularProgress'; import IconButton from '@mui/material/IconButton'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; +import { injectMuiTheme } from './injectMuiTheme'; import { enqueueSnackbar } from 'notistack'; import { backendErrorFrom } from '../../utils/backendError'; import { panelTilePaperSx } from './panelTileLayout'; @@ -20,7 +21,7 @@ function valuesEqual(a, b) { * Panel tile with centralized inline-edit chrome. * Pass `onSave` to enable edit UI; omit it for read-only tiles (no edit icon). */ -export class EditablePanelTile extends Component { +class EditablePanelTileBase extends Component { constructor(props) { super(props); this.inputRef = createRef(); @@ -186,9 +187,11 @@ export class EditablePanelTile extends Component { render() { const { + theme, wide = 1, sx, minHeight = 120, + tileKey, renderDisplay, renderEdit, } = this.props; @@ -198,8 +201,15 @@ export class EditablePanelTile extends Component { return ( {this.renderActions()} {this.renderTitle()} @@ -220,3 +230,5 @@ export class EditablePanelTile extends Component { ); } } + +export const EditablePanelTile = injectMuiTheme(EditablePanelTileBase); diff --git a/src/components/panels/PanelTile.jsx b/src/components/panels/PanelTile.jsx index 9c57254..c1de686 100644 --- a/src/components/panels/PanelTile.jsx +++ b/src/components/panels/PanelTile.jsx @@ -2,9 +2,10 @@ import { Component } from 'react'; import Box from '@mui/material/Box'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; +import { injectMuiTheme } from './injectMuiTheme'; import { GRID_COLUMNS, panelTilePaperSx } from './panelTileLayout'; -export class PanelTile extends Component { +class PanelTileBase extends Component { renderTitle() { const { title } = this.props; if (!title) return null; @@ -20,12 +21,18 @@ export class PanelTile extends Component { } render() { - const { wide = 1, children, sx, minHeight = 120 } = this.props; + const { theme, wide = 1, children, sx, minHeight = 120, tileKey } = this.props; return ( {this.renderTitle()} {children} @@ -34,6 +41,8 @@ export class PanelTile extends Component { } } +export const PanelTile = injectMuiTheme(PanelTileBase); + export function PanelTileGrid({ children, sx }) { return ( ; + } + + const name = Wrapped.displayName || Wrapped.name || 'Component'; + ComponentWithTheme.displayName = `injectMuiTheme(${name})`; + return ComponentWithTheme; +} diff --git a/src/components/panels/panelTileLayout.js b/src/components/panels/panelTileLayout.js index 66760ba..e9b39ab 100644 --- a/src/components/panels/panelTileLayout.js +++ b/src/components/panels/panelTileLayout.js @@ -17,7 +17,21 @@ export function responsiveColumnSpan(wide) { export const PENDING_EDIT_RING_PX = 4; -export function panelTilePaperSx({ wide, sx, minHeight = 120, pending = false }) { +export function panelTileBackground(theme, tileKey) { + if (!tileKey || !theme?.panelTiles) return undefined; + return theme.panelTiles[tileKey]; +} + +export function panelTilePaperSx({ + wide, + sx, + minHeight = 120, + pending = false, + tileKey, + theme, +}) { + const tileBg = panelTileBackground(theme, tileKey); + return { gridColumn: responsiveColumnSpan(wide), position: 'relative', @@ -25,6 +39,9 @@ export function panelTilePaperSx({ wide, sx, minHeight = 120, pending = false }) minHeight, display: 'flex', flexDirection: 'column', + border: 'none', + boxShadow: 'none', + ...(tileBg ? { bgcolor: tileBg } : {}), ...(pending ? { boxShadow: `inset 0 0 0 ${PENDING_EDIT_RING_PX}px ${PENDING_EDIT_BORDER}`, diff --git a/src/index.css b/src/index.css index 5859d65..68f0a94 100644 --- a/src/index.css +++ b/src/index.css @@ -2,7 +2,7 @@ html, body, #root { min-height: 100%; - background-color: #dceeea; + background-color: #c5ddd8; } html, diff --git a/src/main.jsx b/src/main.jsx index e42040e..f32854d 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -6,7 +6,7 @@ import { SnackbarProvider } from 'notistack'; import AuthBootstrap from './components/AuthBootstrap'; import App from './App'; import { store } from './store'; -import theme from './theme'; +import { getActiveTheme } from './theme'; import './index.css'; async function clearDevServiceWorker() { @@ -25,7 +25,7 @@ if (import.meta.env.DEV) { createRoot(document.getElementById('root')).render( - + ({ start_url: '/', scope: '/', display: 'standalone', - background_color: '#dceeea', + background_color: '#c5ddd8', theme_color: '#3b5bdb', icons: [ {