Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added rightImageLabelCss and leftImageLabelCss props #76

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
dist
node_modules
storybook-static
yarn-error.log
firebase-debug.log
firebase-debug.log
25 changes: 25 additions & 0 deletions dist/ReactCompareImage.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
interface IProps {
aspectRatio?: 'taller' | 'wider';
handle?: React.ReactNode;
handleSize?: number;
hover?: boolean;
leftImage: string;
leftImageAlt?: string;
leftImageCss?: object;
leftImageLabel?: string | React.ReactNode;
leftImageLabelCss?: string;
onSliderPositionChange?: (position: number) => void;
rightImage: string;
rightImageAlt?: string;
rightImageCss?: object;
rightImageLabel?: string | React.ReactNode;
rightImageLabelCss?: string;
skeleton?: React.ReactNode;
sliderLineColor?: string;
sliderLineWidth?: number;
sliderPositionPercentage?: number;
vertical?: boolean;
}
declare const ReactCompareImage: React.FC<IProps>;
export default ReactCompareImage;
1 change: 1 addition & 0 deletions dist/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions src/ReactCompareImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ interface IProps {
leftImage: string;
leftImageAlt?: string;
leftImageCss?: object;
leftImageLabel?: string;
leftImageLabel?: string | React.ReactNode;
leftImageLabelCss?: string;
onSliderPositionChange?: (position: number) => void;
rightImage: string;
rightImageAlt?: string;
rightImageCss?: object;
rightImageLabel?: string;
rightImageLabel?: string | React.ReactNode;
rightImageLabelCss?: string;
skeleton?: React.ReactNode;
sliderLineColor?: string;
sliderLineWidth?: number;
Expand All @@ -29,10 +31,12 @@ const defaultProps = {
leftImageAlt: '',
leftImageCss: {},
leftImageLabel: null,
leftImageLabelCss: '',
onSliderPositionChange: () => {},
rightImageAlt: '',
rightImageCss: {},
rightImageLabel: null,
rightImageLabelCss: '',
skeleton: null,
sliderLineColor: '#ffffff',
sliderLineWidth: 2,
Expand All @@ -50,11 +54,13 @@ const ReactCompareImage: React.FC<IProps> = props => {
leftImageAlt,
leftImageCss,
leftImageLabel,
leftImageLabelCss,
onSliderPositionChange,
rightImage,
rightImageAlt,
rightImageCss,
rightImageLabel,
rightImageLabelCss,
skeleton,
sliderLineColor,
sliderLineWidth,
Expand Down Expand Up @@ -422,12 +428,16 @@ const ReactCompareImage: React.FC<IProps> = props => {
{/* labels */}
{leftImageLabel && (
<div style={styles.leftLabelContainer}>
<div style={styles.leftLabel}>{leftImageLabel}</div>
<div style={{ ...styles.leftLabel, ...leftImageLabelCss }}>
{leftImageLabel}
</div>
</div>
)}
{rightImageLabel && (
<div style={styles.rightLabelContainer}>
<div style={styles.rightLabel}>{rightImageLabel}</div>
<div style={styles.rightLabel} className={rightImageLabelCss}>
{rightImageLabel}
</div>
</div>
)}
</div>
Expand Down