From 1d8d3ebcd904b91f87f7cb3bc13ae634e7e3b7cd Mon Sep 17 00:00:00 2001 From: Pierre-Gilles Leymarie Date: Fri, 29 Nov 2024 11:27:23 +0100 Subject: [PATCH] Improve mobile view on scene list --- front/src/routes/scene/SceneCard.jsx | 44 ++++++++++++++++++++++- 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 | 6 ++++ 5 files changed, 68 insertions(+), 9 deletions(-) diff --git a/front/src/routes/scene/SceneCard.jsx b/front/src/routes/scene/SceneCard.jsx index 916bde91d3..2c507b1a75 100644 --- a/front/src/routes/scene/SceneCard.jsx +++ b/front/src/routes/scene/SceneCard.jsx @@ -24,7 +24,42 @@ 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 }) => (
-