Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
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