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

Expose Typings for all Props #121

Merged
merged 1 commit into from Feb 12, 2019

Conversation

martinmckenna
Copy link
Contributor

@martinmckenna martinmckenna commented Feb 5, 2019

Purpose

Expose all props for the purposes of extending them in other projects.

Example Usage:

import { Dot, DotProps } from 'pure-react-carousel';
import React from 'react';

/**
 * Abstraction of Dot for purposes of setting the active
 * slide when the onClick event is triggered. Basically lets
 * us make the active slide highlighted
 */
interface ExtendedDotProps extends DotProps {
  setActiveSlide: (slide: number) => void;
}

const _ExtendedDot: React.SFC<ExtendedDotProps> = (props) => {
  const { setActiveSlide, ...rest } = props;
  const handleSlideChange = () => {
    return setActiveSlide(props.slide)
  }

  return <Dot {...rest} onClick={handleSlideChange} />
}

const ExtendedDot = React.memo(_ExtendedDot)

closes #102

@martinmckenna
Copy link
Contributor Author

@mrbinky3000 @tim-steele Any update on this? I would love to start leveraging this

@tim-steele tim-steele merged commit 5ecb176 into express-labs:master Feb 12, 2019
@tim-steele
Copy link
Contributor

@martinmckenna added to 1.18.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose Interfaces for Component Props
2 participants