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

Requesting for this change in _handleFigureClick #74

Open
leroyvaughan opened this issue Oct 28, 2019 · 0 comments
Open

Requesting for this change in _handleFigureClick #74

leroyvaughan opened this issue Oct 28, 2019 · 0 comments

Comments

@leroyvaughan
Copy link

I don't like the fact that clicking an image opens the URL in a new window. I'm not sure how to create my own NPM package using yours and don't have the time to remove any reference to you in the module and replace it with reference to me.

I tried to override it using my own module class, but it's not working:

newMod.jsx
`
import newMod from 'react-coverflow';

delete newMod["_handleFigureClick"];

newMod._handleFigureClick = { method below with small change };

export default newMod
`

image-carousel-page.jsx
`
import CoverFlow from '../components/newMod';

{yada, yada, yada}
`

I thought that maybe Radium was the problem, so I did this...but that didn't work either:

newMod.jsx
`
import Radium from 'radium';

import newMod from 'react-coverflow';

delete newMod["_handleFigureClick"];

newMod._handleFigureClick = { method below with small change };

export default Radium(newMod)
`

Here is the small change I'm requesting:

`
._handleFigureClick = (index, action, e) => {

if (!this.props.clickable) {
    e.preventDefault();
    return;
}
if (this.state.current === index) {
    // If on the active figure
    if (typeof action === 'string') {
        // If action is a URL (string), follow the link
        **document.location.href = action;** //<-- HERE ####
    }

    this._removePointerEvents();
} else {
    // Move to the selected figure
    e.preventDefault();
    const { displayQuantityOfSide } = this.props;
    const { width } = this.state;
    const baseWidth = width / (displayQuantityOfSide * 2 + 1);
    const distance = this._center() - index;
    const move = distance * baseWidth;
    this.setState({ current: index, move });
}

};
`

Thanks for any help you can provide.

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

No branches or pull requests

1 participant