From 16f51625416116d962b9844a9329ec57b1c66ba7 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Tue, 9 Sep 2025 13:30:59 +0200 Subject: [PATCH] Create Grid component --- webui/src/common/components/Grid/Grid.jsx | 26 ++++++++++++++++++++ webui/src/common/components/Grid/index.js | 1 + webui/src/common/components/Grid/styles.sass | 8 ++++++ 3 files changed, 35 insertions(+) create mode 100644 webui/src/common/components/Grid/Grid.jsx create mode 100644 webui/src/common/components/Grid/index.js create mode 100644 webui/src/common/components/Grid/styles.sass diff --git a/webui/src/common/components/Grid/Grid.jsx b/webui/src/common/components/Grid/Grid.jsx new file mode 100644 index 0000000..4db0ffd --- /dev/null +++ b/webui/src/common/components/Grid/Grid.jsx @@ -0,0 +1,26 @@ +import React from 'react'; +import './styles.sass'; + +export const Grid = ({ + children, + columns = 'auto-fill', + minWidth = '300px', + gap = '1.5rem', + className = '', + ...rest +}) => { + const gridStyle = { + '--grid-columns': columns === 'auto-fill' ? `repeat(auto-fill, minmax(${minWidth}, 1fr))` : `repeat(${columns}, 1fr)`, + '--grid-gap': gap + }; + + return ( +
+ {children} +
+ ); +}; \ No newline at end of file diff --git a/webui/src/common/components/Grid/index.js b/webui/src/common/components/Grid/index.js new file mode 100644 index 0000000..5ac9a91 --- /dev/null +++ b/webui/src/common/components/Grid/index.js @@ -0,0 +1 @@ +export { Grid as default } from './Grid.jsx'; \ No newline at end of file diff --git a/webui/src/common/components/Grid/styles.sass b/webui/src/common/components/Grid/styles.sass new file mode 100644 index 0000000..a72277f --- /dev/null +++ b/webui/src/common/components/Grid/styles.sass @@ -0,0 +1,8 @@ +.grid + display: grid + grid-template-columns: var(--grid-columns) + gap: var(--grid-gap) + +@media (max-width: 768px) + .grid + grid-template-columns: 1fr \ No newline at end of file