Add sorting and filters

This commit is contained in:
viktorstrate
2019-07-23 22:38:41 +02:00
parent 3560c2cae8
commit 7c714449f9
5 changed files with 13 additions and 10 deletions

View File

@@ -10,7 +10,7 @@ const albumQuery = gql`
query albumQuery($id: ID) {
album(id: $id) {
title
subAlbums {
subAlbums(orderBy: title_asc) {
id
title
photos {
@@ -19,7 +19,7 @@ const albumQuery = gql`
}
}
}
photos {
photos(orderBy: title_desc) {
id
thumbnail {
url

View File

@@ -6,7 +6,7 @@ import { Query } from 'react-apollo'
const getAlbumsQuery = gql`
query getMyAlbums {
myAlbums(filter: { parentAlbum: null }) {
myAlbums(filter: { parentAlbum: null }, orderBy: title_asc) {
id
title
photos {

View File

@@ -6,7 +6,7 @@ import PhotoGallery from '../../PhotoGallery'
const photoQuery = gql`
query allPhotosPage {
myPhotos {
myPhotos(orderBy: title_desc) {
id
title
thumbnail {

View File

@@ -66,9 +66,12 @@ const PhotoGallery = ({ activeIndex = -1, photos, loading, onSelectImage }) => {
photoElements = photos.map((photo, index) => {
const active = activeIndex == index
const minWidth = Math.floor(
(photo.thumbnail.width / photo.thumbnail.height) * 200
)
let minWidth = 100
if (photo.thumbnail) {
minWidth = Math.floor(
(photo.thumbnail.width / photo.thumbnail.height) * 200
)
}
return (
<PhotoContainer