+
@@ -89,12 +291,27 @@ function Dropzone(props) {
,
])
) : (
-
-
+
+
{isDragActive
? `Drag files here`
- : `Drag 'n' drop some files here, or click to select files`}
+ : `Drag 'n' drop some files here`}
+
+
+ Or
+
+
+
)}
@@ -103,7 +320,16 @@ function Dropzone(props) {
}
Dropzone.propTypes = {
+ acceptedFileTypes: PropTypes.array,
onDrop: PropTypes.func,
+ maxFiles: PropTypes.number,
+ maxFileSize: PropTypes.number,
+};
+
+Dropzone.defaultProps = {
+ acceptedFileTypes: ['image/*'],
+ maxFiles: 5,
+ maxFileSize: 1,
};
const styles = theme => ({
@@ -118,20 +344,52 @@ const styles = theme => ({
},
textIcon: {
- fontSize: 75,
+ fontSize: 50,
+ padding: 20,
fontWeight: 'bold',
+ },
+
+ textCenter: {
textAlign: 'center',
},
removeLink: {
- textAlign: 'center',
'&:hover': {
cursor: 'pointer',
},
},
+ fileWrapper: {
+ position: 'relative',
+ '&:hover div': {
+ display: 'block',
+ },
+ },
+
+ fileInfo: {
+ position: 'absolute',
+ width: '100%',
+ backgroundColor: 'rgba(255, 255, 255, 0.4)',
+ color: theme.palette.grey[900],
+ },
+
+ fileSize: {
+ top: 30,
+ },
+
+ fileName: {
+ bottom: 30,
+ },
+
+ fileIcon: {
+ display: 'none',
+ position: 'absolute',
+ width: '100%',
+ fontSize: 35,
+ top: 45,
+ },
+
file: {
- border: `3px solid ${theme.palette.grey[500]}`,
borderRadius: '5%',
width: 120,
height: 120,
@@ -139,15 +397,32 @@ const styles = theme => ({
image: {
'&:hover': {
- filter: 'blur(4px)',
+ filter: 'blur(2px)',
},
},
- addFile: {
+ fileSuccess: {
+ border: `2px solid ${colors.green[600]}`,
+ },
+
+ fileError: {
+ border: `2px solid ${theme.palette.error.light}`,
+ },
+
+ filePrimary: {
+ border: `2px solid ${theme.palette.primary.main}`,
+ },
+
+ fileAdd: {
+ border: `2px dashed ${theme.palette.grey[500]}`,
'&:hover': {
cursor: 'pointer',
},
},
+
+ fileInvalid: {
+ backgroundColor: theme.palette.grey[300],
+ },
});
export default withStyles(styles)(Dropzone);
diff --git a/resources/js/ui/Loaders/LinearDeterminate.js b/resources/js/ui/Loaders/LinearDeterminate.js
index 595f6a6..20b9f94 100644
--- a/resources/js/ui/Loaders/LinearDeterminate.js
+++ b/resources/js/ui/Loaders/LinearDeterminate.js
@@ -9,13 +9,43 @@ class LinearDeterminate extends Component {
};
componentDidMount() {
- this.timer = setInterval(this.progress, 500);
+ this.timer = setInterval(
+ this.progress,
+ this.convertSpeed(this.props.speed),
+ );
}
componentWillUnmount() {
clearInterval(this.timer);
}
+ convertSpeed = speed => {
+ switch (speed) {
+ case 'verySlow':
+ return 5000;
+ break;
+
+ case 'slow':
+ return 2500;
+ break;
+
+ case 'moderate':
+ return 1000;
+ break;
+
+ case 'fast':
+ return 500;
+ break;
+
+ case 'veryFast':
+ return 250;
+ break;
+
+ default:
+ break;
+ }
+ };
+
progress = () => {
const { completed } = this.state;
@@ -46,8 +76,19 @@ class LinearDeterminate extends Component {
}
}
+LinearDeterminate.defaultProps = {
+ speed: 'moderate',
+};
+
LinearDeterminate.propTypes = {
classes: PropTypes.object.isRequired,
+ speed: PropTypes.oneOf([
+ 'verySlow',
+ 'slow',
+ 'moderate',
+ 'fast',
+ 'veryFast',
+ ]),
};
const styles = {
diff --git a/resources/js/utils/String.js b/resources/js/utils/String.js
index 54f7d17..26f4cd8 100644
--- a/resources/js/utils/String.js
+++ b/resources/js/utils/String.js
@@ -8,3 +8,16 @@
export function _uppercaseFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
+
+/**
+ * Trim the string based on number of characters.
+ *
+ * @param {string} string
+ * @param {number} count
+ * @param {string} delimiter
+ *
+ * @return {string}
+ */
+export function _limit(string, count, delimiter = '...') {
+ return string.slice(0, count) + (string.length > count ? delimiter : '');
+}
diff --git a/resources/js/views/__backoffice/users/Forms/Avatar.js b/resources/js/views/__backoffice/users/Forms/Avatar.js
index 7dfd167..b38dffc 100644
--- a/resources/js/views/__backoffice/users/Forms/Avatar.js
+++ b/resources/js/views/__backoffice/users/Forms/Avatar.js
@@ -14,7 +14,7 @@ const Avatar = props => {
Avatar Upload
-
+