From 0013e90eb08781b5ce8dd90a0ace8fe5df30c6b9 Mon Sep 17 00:00:00 2001 From: cyril lopez Date: Tue, 13 Feb 2018 18:56:53 +0100 Subject: [PATCH] Created InputFileWithErrors component and add it to the index --- .../components/InputFileWithErrors/index.js | 29 +++++++++++++++++++ .../InputFileWithErrors/styles.scss | 0 .../components/InputTextWithErrors/index.js | 2 +- .../lib/src/components/InputsIndex/index.js | 3 ++ .../admin/src/containers/HomePage/index.js | 7 +++-- 5 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js create mode 100644 packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/styles.scss diff --git a/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js new file mode 100644 index 0000000000..46e33792b6 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/index.js @@ -0,0 +1,29 @@ +/** + * + * InputFileWithErrors + * + */ + +import React from 'react'; +import PropTypes from 'prop-types'; +import cn from 'classnames'; + +// Design +import Label from 'components/Label'; +import InputDescription from 'components/InputDescription'; +import InputFile from 'components/InputFile'; + +class InputFileWithErrors extends React.Component { + // TODO handle errors lifecycle + render() { + return ( +
+
+ ); + } +} + +InputFileWithErrors.defaultProps = {}; +InputFileWithErrors.propTypes = {}; + +export default InputFileWithErrors; diff --git a/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/styles.scss b/packages/strapi-helper-plugin/lib/src/components/InputFileWithErrors/styles.scss new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js index ba7aa8bcf1..9cf9e6bcef 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputTextWithErrors/index.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { includes, isEmpty, isFunction, mapKeys, reject } from 'lodash'; +import { includes, isEmpty, isFunction } from 'lodash'; import cn from 'classnames'; // Design diff --git a/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js b/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js index fba940e064..8da0d937cf 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputsIndex/index.js @@ -12,6 +12,7 @@ import InputAddonWithErrors from 'components/InputAddonWithErrors'; import InputCheckboxWithErrors from 'components/InputCheckboxWithErrors'; import InputDateWithErrors from 'components/InputDateWithErrors'; import InputEmailWithErrors from 'components/InputEmailWithErrors'; +import InputFileWithErrors from 'components/InputFileWithErrors'; import InputNumberWithErrors from 'components/InputNumberWithErrors'; import InputSearchWithErrors from 'components/InputSearchWithErrors'; import InputSelectWithErrors from 'components/InputSelectWithErrors'; @@ -27,6 +28,7 @@ const inputs = { checkbox: InputCheckboxWithErrors, date: InputDateWithErrors, email: InputEmailWithErrors, + file: InputFileWithErrors, number: InputNumberWithErrors, password: InputPasswordWithErrors, search: InputSearchWithErrors, @@ -63,6 +65,7 @@ export { InputCheckboxWithErrors, InputDateWithErrors, InputEmailWithErrors, + InputFileWithErrors, InputNumberWithErrors, InputPasswordWithErrors, InputSearchWithErrors, 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 b0d563bb7d..3d6c4937c7 100755 --- a/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-upload/admin/src/containers/HomePage/index.js @@ -11,7 +11,7 @@ import { createStructuredSelector } from 'reselect'; import { injectIntl } from 'react-intl'; import { bindActionCreators, compose } from 'redux'; -import InputFile from 'components/InputFile'; +import Input from 'components/InputsIndex'; import injectReducer from 'utils/injectReducer'; import injectSaga from 'utils/injectSaga'; @@ -35,11 +35,12 @@ export class HomePage extends React.Component { return (
- + type="file" + />
);