61 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-02-13 18:29:47 +01:00
/**
*
* ImgPreviewHint
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import { FormattedMessage } from 'react-intl';
2019-10-09 15:44:56 +02:00
import P from './P';
2018-02-13 18:29:47 +01:00
function ImgPreviewHint(props) {
let pStyle;
switch (true) {
case props.showWhiteHint:
pStyle = { zIndex: 999, color: '#fff' };
break;
case props.displayHint:
pStyle = { zIndex: 4 };
break;
default:
pStyle = { display: 'none' };
}
2018-02-13 18:46:54 +01:00
const browse = (
<FormattedMessage id="app.components.ImgPreview.hint.browse">
2019-10-09 15:44:56 +02:00
{message => <u onClick={props.onClick}>{message}</u>}
2018-02-13 18:46:54 +01:00
</FormattedMessage>
);
2018-02-13 18:29:47 +01:00
return (
2019-10-09 15:44:56 +02:00
<P
style={pStyle}
onDragEnter={e => e.stopPropagation()}
onDrop={props.onDrop}
>
2018-02-13 18:29:47 +01:00
<FormattedMessage
id="app.components.ImgPreview.hint"
2018-02-13 18:46:54 +01:00
values={{ browse }}
2018-02-13 18:29:47 +01:00
/>
2019-10-09 15:44:56 +02:00
</P>
2018-02-13 18:29:47 +01:00
);
}
ImgPreviewHint.defaultProps = {
displayHint: false,
onClick: () => {},
onDrop: () => {},
2018-02-13 18:29:47 +01:00
showWhiteHint: false,
};
ImgPreviewHint.propTypes = {
displayHint: PropTypes.bool,
onClick: PropTypes.func,
onDrop: PropTypes.func,
2018-02-13 18:29:47 +01:00
showWhiteHint: PropTypes.bool,
};
export default ImgPreviewHint;