From a098274fa85b9bc901fdb840daa4116cd22eb5be Mon Sep 17 00:00:00 2001 From: Sander Vocke Date: Tue, 11 Feb 2020 17:34:14 +0100 Subject: [PATCH] Replace gallery by flexbox. --- src/browser.js | 3 +- src/gridgallery.js | 81 ++++++++++++++++++++++++++++++++++++++++++++-- src/main.js | 3 ++ src/resultsview.js | 4 +-- 4 files changed, 85 insertions(+), 6 deletions(-) diff --git a/src/browser.js b/src/browser.js index 487aedd..2c2befd 100644 --- a/src/browser.js +++ b/src/browser.js @@ -123,10 +123,11 @@ const useStyles = makeStyles(theme => ({ root: { width: '100%', maxWidth: 360, - backgroundColor: theme.palette.background.paper, + color: theme.color, }, nested: { paddingLeft: theme.spacing(4), + color: theme.color, }, })); diff --git a/src/gridgallery.js b/src/gridgallery.js index 01c80ec..265dacb 100644 --- a/src/gridgallery.js +++ b/src/gridgallery.js @@ -1,9 +1,83 @@ import React from 'react'; -import Gallery from 'react-grid-gallery'; +import Box from '@material-ui/core/Box'; import { makeStyles } from '@material-ui/core/styles'; -// TODO: some nice options: ModuloBox, +const useStyles = makeStyles(theme => ({ + gallery: { + width: "100%", + display: "flex", + 'flex-wrap': "wrap", + 'justify-content': "center", + }, + imgitem: { + width: "100%", + } +})); + +export function GridGalleryItem(props) { + const { width, height, children } = props; + const classes = makeStyles(theme => ({ + item: { + width: width, + height: height, + margin: "3px", + }, + }))(); + + return ( + + {children} + + ) +} + +export function PhotoItem(props) { + const { photo, row_height } = props; + const classes = useStyles(); + + const photo_width = (photo.state.fullsize[0] / photo.state.fullsize[1]) * row_height; + + return ( + + + + ); +} + +export function ItemGridGallery(props) { + const { children } = props; + const classes = useStyles(); + + return ( + + {children} + + ); +} + +export function GridGallery(props) { + const { photos } = props; + + return ( + + {photos.map(photo => { + return + })} + + ); +} + + + +/* const useStyles = makeStyles(theme => ({ root: { @@ -30,4 +104,5 @@ export function GridGallery(props) { return ( photo_to_gallery_photo(x))} /> ) -} \ No newline at end of file +} +*/ \ No newline at end of file diff --git a/src/main.js b/src/main.js index abd1c45..5cfd0b2 100644 --- a/src/main.js +++ b/src/main.js @@ -143,6 +143,9 @@ const theme = createMuiTheme({ typography: { fontFamily: ['Roboto', 'sans-serif'].join(','), }, + palette: { + type: 'light', + }, }); diff --git a/src/resultsview.js b/src/resultsview.js index 4ce83d2..47349b0 100644 --- a/src/resultsview.js +++ b/src/resultsview.js @@ -127,7 +127,7 @@ export function ResultsView(props) { }; return ( -
+ @@ -156,6 +156,6 @@ export function ResultsView(props) { -
+ ); } \ No newline at end of file