Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/ReactCompareImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ const propTypes = {
leftImageAlt: PropTypes.string,
leftImageCss: PropTypes.object, // eslint-disable-line
leftImageLabel: PropTypes.string,
leftLabelCss: PropTypes.object, // eslint-disable-line
onSliderPositionChange: PropTypes.func,
rightImage: PropTypes.string.isRequired,
rightImageAlt: PropTypes.string,
rightImageCss: PropTypes.object, // eslint-disable-line
rightImageLabel: PropTypes.string,
rightLabelCss: PropTypes.object, // eslint-disable-line
skeleton: PropTypes.element,
sliderLineColor: PropTypes.string,
sliderLineWidth: PropTypes.number,
Expand All @@ -31,10 +33,12 @@ const defaultProps = {
leftImageAlt: '',
leftImageCss: {},
leftImageLabel: null,
leftLabelCss: {},
onSliderPositionChange: () => {},
rightImageAlt: '',
rightImageCss: {},
rightImageLabel: null,
rightLabelCss: {},
skeleton: null,
sliderLineColor: '#ffffff',
sliderLineWidth: 2,
Expand All @@ -52,11 +56,13 @@ function ReactCompareImage(props) {
leftImageAlt,
leftImageCss,
leftImageLabel,
leftLabelCss,
onSliderPositionChange,
rightImage,
rightImageAlt,
rightImageCss,
rightImageLabel,
rightLabelCss,
skeleton,
sliderLineColor,
sliderLineWidth,
Expand Down Expand Up @@ -435,12 +441,16 @@ function ReactCompareImage(props) {
{/* labels */}
{leftImageLabel && (
<div style={styles.leftLabelContainer}>
<div style={styles.leftLabel}>{leftImageLabel}</div>
<div style={{ ...styles.leftLabel, ...leftLabelCss }}>
{leftImageLabel}
</div>
</div>
)}
{rightImageLabel && (
<div style={styles.rightLabelContainer}>
<div style={styles.rightLabel}>{rightImageLabel}</div>
<div style={{ ...styles.rightLabel, ...rightLabelCss }}>
{rightImageLabel}
</div>
</div>
)}
</div>
Expand Down