From dfff5d2d18470b82b90e170ee4009f027d011ee9 Mon Sep 17 00:00:00 2001 From: Pierre-Gilles Leymarie Date: Mon, 2 Dec 2024 15:47:57 +0100 Subject: [PATCH] Improve mobile view on scene list (#2176) --- front/src/routes/scene/SceneCard.jsx | 54 ++++++++++++++++++++++- front/src/routes/scene/SceneCards.jsx | 21 ++++++--- front/src/routes/scene/ScenePage.jsx | 4 +- front/src/routes/scene/SceneTagFilter.jsx | 2 +- front/src/routes/scene/style.css | 10 +++++ 5 files changed, 82 insertions(+), 9 deletions(-) diff --git a/front/src/routes/scene/SceneCard.jsx b/front/src/routes/scene/SceneCard.jsx index 916bde91d3..8dce97a4db 100644 --- a/front/src/routes/scene/SceneCard.jsx +++ b/front/src/routes/scene/SceneCard.jsx @@ -24,7 +24,52 @@ class SceneCard extends Component { await this.setState({ saving: false }); }; - render(props, { saving }) { + getMobileView = (props, { saving }) => { + return ( +
+ +
+ ); + }; + + getDesktopView = (props, { saving }) => { return (
); + }; + + render(props, state) { + if (props.showMobileView) { + return this.getMobileView(props, state); + } + return this.getDesktopView(props, state); } } diff --git a/front/src/routes/scene/SceneCards.jsx b/front/src/routes/scene/SceneCards.jsx index 03889755fe..1a56f0bdc0 100644 --- a/front/src/routes/scene/SceneCards.jsx +++ b/front/src/routes/scene/SceneCards.jsx @@ -1,11 +1,22 @@ import SceneCard from './SceneCard'; const SceneCards = ({ children, ...props }) => ( -
- {props.scenes.map((scene, index) => ( - - ))} -
+ <> +
+ {/* Only visible on small screens */} + {props.scenes.map((scene, index) => ( + + ))} +
+
+
+ {/* Only visible on bigger screens */} + {props.scenes.map((scene, index) => ( + + ))} +
+
+ ); export default SceneCards; diff --git a/front/src/routes/scene/ScenePage.jsx b/front/src/routes/scene/ScenePage.jsx index 33be006a1f..6f951063dc 100644 --- a/front/src/routes/scene/ScenePage.jsx +++ b/front/src/routes/scene/ScenePage.jsx @@ -13,7 +13,7 @@ const ScenePage = ({ children, ...props }) => (
-