diff --git a/packages/strapi-plugin-upload/admin/src/components/ListHeader/index.js b/packages/strapi-plugin-upload/admin/src/components/ListHeader/index.js index f14ab90cea..fb0279918e 100644 --- a/packages/strapi-plugin-upload/admin/src/components/ListHeader/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/ListHeader/index.js @@ -20,21 +20,24 @@ function ListHeader({ changeSort, sort }) { '', '', ]; + console.log(sort); const handleChangeSort = name => { - if (sort === name) { - changeSort(`-${name}`); - } else if (sort === `-${name}`) { - changeSort('hash'); + if (sort === `${name}:ASC`) { + changeSort(`${name}:DESC`); + } else if (sort === `${name}:DESC`) { + changeSort('hash:ASC'); } else if (name === 'updated' || name === 'related') { - changeSort('hash'); + changeSort('hash:ASC'); } else { - changeSort(name); + changeSort(`${name}:ASC`); } }; const shouldDisplaySort = title => - (sort === title && 'icon') || (sort === `-${title}` && 'iconDesc') || ''; + (sort === `${title}:ASC` && 'icon') || + (sort === `${title}:DESC` && 'iconDesc') || + ''; return ( diff --git a/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/Label.js b/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/Label.js new file mode 100644 index 0000000000..eeffbfb5f6 --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/Label.js @@ -0,0 +1,82 @@ +import styled, { css, keyframes } from 'styled-components'; + +const Label = styled.label` + position: relative; + height: 146px; + width: 100%; + padding-top: 28px; + border: 2px dashed #e3e9f3; + border-radius: 2px; + text-align: center; + + > input { + display: none; + } + + .icon { + width: 82px; + path { + fill: ${({ showLoader }) => (showLoader ? '#729BEF' : '#ccd0da')}; + transition: fill 0.3s ease; + } + } + + .isDraging { + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + } + + .underline { + color: #1c5de7; + text-decoration: underline; + cursor: pointer; + } + + &:hover { + cursor: pointer; + } + + ${({ isDraging }) => { + if (isDraging) { + return css` + background-color: rgba(28, 93, 231, 0.01) !important; + border: 2px dashed rgba(28, 93, 231, 0.1) !important; + `; + } + }} + + ${({ showLoader }) => { + if (showLoader) { + return css` + -webkit-animation: ${smoothBlink('transparent', 'rgba(28,93,231,0.05)')} + 2s linear infinite; + -moz-animation: ${smoothBlink('transparent', 'rgba(28,93,231,0.05)')} 2s + linear infinite; + -o-animation: ${smoothBlink('transparent', 'rgba(28,93,231,0.05)')} 2s + linear infinite; + animation: ${smoothBlink('transparent', 'rgba(28,93,231,0.05)')} 2s + linear infinite; + `; + } + }} +`; + +const smoothBlink = (firstColor, secondColor) => keyframes` + 0% { + fill: ${firstColor}; + background-color: ${firstColor}; + } + 26% { + fill: ${secondColor}; + background-color: ${secondColor}; + } + 76% { + fill: ${firstColor}; + background-color: ${firstColor}; + } +`; + +export default Label; diff --git a/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/P.js b/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/P.js new file mode 100644 index 0000000000..d8b2695a2c --- /dev/null +++ b/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/P.js @@ -0,0 +1,14 @@ +import styled from 'styled-components'; + +const P = styled.p` + margin-top: 10px; + text-align: center; + font-size: 13px; + color: #9ea7b8; + + u { + color: #1c5de7; + } +`; + +export default P; diff --git a/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/index.js b/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/index.js index 612ce4daf8..014543c6af 100644 --- a/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/index.js +++ b/packages/strapi-plugin-upload/admin/src/components/PluginInputFile/index.js @@ -7,9 +7,8 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; -import cn from 'classnames'; - -import styles from './styles.scss'; +import Label from './Label'; +import P from './P'; /* eslint-disable react/no-string-refs */ /* eslint-disable jsx-a11y/label-has-for */ @@ -37,17 +36,14 @@ class PluginInputFile extends React.PureComponent { const { isDraging } = this.state; const link = ( - {message => {message}} + {message => {message}} ); return ( -