diff --git a/packages/strapi-plugin-upload/admin/src/components/CardEmpty/Bar.js b/packages/strapi-plugin-upload/admin/src/components/CardEmpty/Bar.js new file mode 100644 index 0000000000..9390bb23f0 --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/CardEmpty/Bar.js @@ -0,0 +1,10 @@ +import styled from 'styled-components'; + +const Bar = styled.div` + height: 10px; + width: ${({ isSmall }) => (isSmall ? '64px' : '110px')}; + margin-top: ${({ isSmall }) => (isSmall ? '15px' : '8px')}; + background: #f6f6f6; +`; + +export default Bar; diff --git a/packages/strapi-plugin-upload/admin/src/components/CardEmpty/Wrapper.js b/packages/strapi-plugin-upload/admin/src/components/CardEmpty/Wrapper.js new file mode 100644 index 0000000000..f7e1aa9b57 --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/CardEmpty/Wrapper.js @@ -0,0 +1,7 @@ +import styled from 'styled-components'; + +const Wrapper = styled.div` + margin-bottom: 35px; +`; + +export default Wrapper; diff --git a/packages/strapi-plugin-upload/admin/src/components/CardEmpty/index.js b/packages/strapi-plugin-upload/admin/src/components/CardEmpty/index.js new file mode 100644 index 0000000000..2ec65d3559 --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/CardEmpty/index.js @@ -0,0 +1,16 @@ +import React from 'react'; +import CardImgWrapper from '../CardImgWrapper'; +import Bar from './Bar'; +import Wrapper from './Wrapper'; + +const CardEmpty = () => { + return ( + + + + + + ); +}; + +export default CardEmpty; diff --git a/packages/strapi-plugin-upload/admin/src/components/CardImgWrapper/index.js b/packages/strapi-plugin-upload/admin/src/components/CardImgWrapper/index.js index 0b054801bd..515ef8e804 100644 --- a/packages/strapi-plugin-upload/admin/src/components/CardImgWrapper/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/CardImgWrapper/index.js @@ -3,9 +3,9 @@ import PropTypes from 'prop-types'; const CardImgWrapper = styled.div` height: ${({ isSmall }) => (isSmall ? '127px' : '156px')}; - width: ${({ isSmall }) => (isSmall ? '200px' : '245px')}; + min-width: ${({ isSmall }) => (isSmall ? '200px' : '245px')}; border-radius: 2px; - background: #333740; + background: ${({ withOverlay }) => (withOverlay ? '#F6F6F6' : '#333740')}; `; CardImgWrapper.defaultProps = { diff --git a/packages/strapi-plugin-upload/admin/src/components/ListEmpty/Wrapper.js b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/Wrapper.js new file mode 100644 index 0000000000..8df9aa3aaf --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/Wrapper.js @@ -0,0 +1,33 @@ +import styled from 'styled-components'; + +const Wrapper = styled.div` + position: relative; + margin-top: 25px; + padding: 0; + + .btn-wrapper { + position: absolute; + top: 161px; + // left: 50%; + height: 100px; + width: 100%; + margin-left: -50px; + margin-top: -50px; + text-align: center; + + > p { + line-height: 18px; + } + .title { + margin-bottom: 2px; + + font-size: 18px; + font-weight: 500; + } + .subtitle { + font-size: 13px; + } + } +`; + +export default Wrapper; diff --git a/packages/strapi-plugin-upload/admin/src/components/ListEmpty/index.js b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/index.js new file mode 100644 index 0000000000..640422e655 --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/index.js @@ -0,0 +1,59 @@ +import React from 'react'; +import { Button } from '@buffetjs/core'; +import { FormattedMessage } from 'react-intl'; +import PropTypes from 'prop-types'; +import getTrad from '../../utils/getTrad'; +import generateRows from './utils/generateRows'; +import CardEmpty from '../CardEmpty'; +import Wrapper from './Wrapper'; + +const ListEmpty = ({ onClick }) => { + const rows = generateRows(4); + + return ( + + {rows.map(row => { + return ( +
+ {row.rows.map(key => { + return ( +
+ +
+ ); + })} +
+ ); + })} +
+ + {content =>

{content}

} +
+ + {content =>

{content}

} +
+ + + {label => ( +
+
+ ); +}; + +ListEmpty.defaultProps = { + onClick: () => {}, +}; + +ListEmpty.propTypes = { + onClick: PropTypes.func, +}; + +export default ListEmpty; diff --git a/packages/strapi-plugin-upload/admin/src/components/ListEmpty/utils/generateRows.js b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/utils/generateRows.js new file mode 100644 index 0000000000..acb0cc743f --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/utils/generateRows.js @@ -0,0 +1,12 @@ +const generateRows = numberOfRows => { + const rows = Array.from({ length: numberOfRows }, (_, i) => { + return { + key: i, + rows: Array.from({ length: 4 }, (_, i) => i), + }; + }); + + return rows; +}; + +export default generateRows; diff --git a/packages/strapi-plugin-upload/admin/src/components/ListEmpty/utils/tests/generateRows.test.js b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/utils/tests/generateRows.test.js new file mode 100644 index 0000000000..18beeb22fc --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/ListEmpty/utils/tests/generateRows.test.js @@ -0,0 +1,29 @@ +import generateRows from '../generateRows'; + +describe('MEDIA LIBRARY | components | ListEmpty | utils', () => { + describe('generateRows', () => { + it('should return an array of object', () => { + const numberOfRows = 4; + const expected = [ + { + key: 0, + rows: [0, 1, 2, 3], + }, + { + key: 1, + rows: [0, 1, 2, 3], + }, + { + key: 2, + rows: [0, 1, 2, 3], + }, + { + key: 3, + rows: [0, 1, 2, 3], + }, + ]; + + expect(generateRows(numberOfRows)).toEqual(expected); + }); + }); +}); diff --git a/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js index 7e02424ae8..f01ba9c634 100644 --- a/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js @@ -7,6 +7,7 @@ import ControlsWrapper from '../../components/ControlsWrapper'; import SelectAll from '../../components/SelectAll'; import SortPicker from '../../components/SortPicker'; // import List from '../../components/List'; +import ListEmpty from '../../components/ListEmpty'; import getHeaderLabel from './utils/getHeaderLabel'; import init from './init'; import reducer, { initialState } from './reducer'; @@ -72,6 +73,10 @@ const HomePage = () => { + {}} + /> {/* */} ); diff --git a/packages/strapi-plugin-upload/admin/src/translations/en.json b/packages/strapi-plugin-upload/admin/src/translations/en.json index d6bc1a9ad6..de91113e0b 100644 --- a/packages/strapi-plugin-upload/admin/src/translations/en.json +++ b/packages/strapi-plugin-upload/admin/src/translations/en.json @@ -3,6 +3,8 @@ "header.content.assets-empty": "No asset", "header.content.assets-multiple": "{number} assets", "header.content.assets-single": "1 asset", + "list.assets-empty.title": "There is no asset yet", + "list.assets-empty.subtitle": "Add a first one to the list.", "plugin.name": "Media Library", "plugin.description.long": "Media file management.", "plugin.description.short": "Media file management.",