Skip to content

Commit

Permalink
Merge pull request #3823 from despatates/master
Browse files Browse the repository at this point in the history
feat(file-input): use theme for dropzone background
  • Loading branch information
djhi authored Oct 15, 2019
2 parents f54652f + 93a0994 commit 077653e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
25 changes: 13 additions & 12 deletions packages/ra-ui-materialui/src/input/FileInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ import Labeled from './Labeled';
import FileInputPreview from './FileInputPreview';
import sanitizeRestProps from './sanitizeRestProps';

const styles = createStyles({
dropZone: {
background: '#efefef',
cursor: 'pointer',
padding: '1rem',
textAlign: 'center',
color: '#999',
},
preview: {},
removeButton: {},
root: { width: '100%' },
});
const styles = theme =>
createStyles({
dropZone: {
background: theme.palette.background.default,
cursor: 'pointer',
padding: '1rem',
textAlign: 'center',
color: theme.palette.text.hint,
},
preview: {},
removeButton: {},
root: { width: '100%' },
});

export class FileInput extends Component {
static propTypes = {
Expand Down
49 changes: 25 additions & 24 deletions packages/ra-ui-materialui/src/input/ImageInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@ import { addField, translate } from 'ra-core';

import { FileInput } from './FileInput';

const styles = createStyles({
root: { width: '100%' },
dropZone: {
background: '#efefef',
cursor: 'pointer',
padding: '1rem',
textAlign: 'center',
color: '#999',
},
preview: {},
removeButton: {
display: 'inline-block',
position: 'relative',
float: 'left',
'& button': {
position: 'absolute',
top: '0.5rem',
right: '0.5rem',
minWidth: '2rem',
opacity: 0,
const styles = theme =>
createStyles({
root: { width: '100%' },
dropZone: {
background: theme.palette.background.default,
cursor: 'pointer',
padding: '1rem',
textAlign: 'center',
color: theme.palette.text.hint,
},
'&:hover button': {
opacity: 1,
preview: {},
removeButton: {
display: 'inline-block',
position: 'relative',
float: 'left',
'& button': {
position: 'absolute',
top: '0.5rem',
right: '0.5rem',
minWidth: '2rem',
opacity: 0,
},
'&:hover button': {
opacity: 1,
},
},
},
});
});

export class ImageInput extends FileInput {
static defaultProps = {
Expand Down

0 comments on commit 077653e

Please sign in to comment.