diff --git a/src/photos/components/LoadMore.jsx b/src/photos/components/LoadMore.jsx new file mode 100644 index 0000000000..9c268887f0 --- /dev/null +++ b/src/photos/components/LoadMore.jsx @@ -0,0 +1,13 @@ +import React from 'react' + +import UILoadMore from 'cozy-ui/transpiled/react/LoadMore' + +const LoadMore = ({ label, fetchMore }) => { + return ( +
+ +
+ ) +} + +export { LoadMore } diff --git a/src/photos/components/LoadMoreButton.jsx b/src/photos/components/LoadMoreButton.jsx deleted file mode 100644 index 0cb3c4e1b3..0000000000 --- a/src/photos/components/LoadMoreButton.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import styles from '../styles/photoList.styl' - -import React, { Component } from 'react' -import { Button, Spinner } from 'cozy-ui/transpiled/react' -import palette from 'cozy-ui/stylus/settings/palette.json' - -class LoadMoreButton extends Component { - constructor(props) { - super(props) - this.state = { - fetching: false - } - } - - handleClick() { - this.setState({ fetching: true }) - // TODO: fix me - // eslint-disable-next-line promise/catch-or-return - this.props.onClick().then(() => this.setState({ fetching: false })) - } - - render() { - const { label, width = '100%' } = this.props - const { fetching } = this.state - return ( -
- {fetching && ( -
- ) - } -} - -export default LoadMoreButton diff --git a/src/photos/components/PhotoBoard.jsx b/src/photos/components/PhotoBoard.jsx index 44b4cdafc5..49ee950508 100644 --- a/src/photos/components/PhotoBoard.jsx +++ b/src/photos/components/PhotoBoard.jsx @@ -8,7 +8,7 @@ import PhotoList from './PhotoList' import { EmptyPhotos } from 'components/Error/Empty' import Loading from './Loading' import ErrorComponent from 'components/Error/ErrorComponent' -import LoadMoreButton from './LoadMoreButton' +import { LoadMore } from 'photos/components/LoadMore' const PhotoBoard = ({ lists, @@ -65,11 +65,7 @@ const PhotoBoard = ({ /> ))} {hasMore && ( - + )} ) diff --git a/src/photos/ducks/albums/components/AlbumsList.jsx b/src/photos/ducks/albums/components/AlbumsList.jsx index ff9b76ae38..274fca57eb 100644 --- a/src/photos/ducks/albums/components/AlbumsList.jsx +++ b/src/photos/ducks/albums/components/AlbumsList.jsx @@ -3,9 +3,10 @@ import styles from 'photos/styles/albumsList.styl' import React from 'react' import { Content } from 'cozy-ui/transpiled/react/Layout' import { translate } from 'cozy-ui/transpiled/react/I18n' + import { EmptyPhotos } from 'components/Error/Empty' -import LoadMoreButton from 'photos/components/LoadMoreButton' import AlbumItem from './AlbumItem' +import { LoadMore } from 'photos/components/LoadMore' const FALLBACK_CREATION_DATE = null const sortByCreationDate = (a, b) => { @@ -26,7 +27,7 @@ const AlbumsList = ({ data, hasMore, fetchMore, t }) => ))} {hasMore && ( - + )} diff --git a/src/photos/styles/photoList.styl b/src/photos/styles/photoList.styl index 7fe88313be..099b71ddc4 100644 --- a/src/photos/styles/photoList.styl +++ b/src/photos/styles/photoList.styl @@ -89,11 +89,3 @@ .pho-photo:hover .pho-photo-select opacity 1 - - .pho-list-morebutton - position relative - margin-bottom 2rem - - button - margin 0 auto - display block