nckblu/react-image-and-background-image-fade

Default loader configuration

Closed this issue · 4 comments

Hello, first of all, thank you for your work.

I see that I can develop my own loader with ImageLoader or with renderLoader but I only want to modify a little bit the default one.

Can you give me some hits to acomplish that, please? Or put an example like the one you put for ImageLoader but with the default loader:

import { ImageLoader } from "react-image-and-background-image-fade";

class AwesomeOLoader extends Component {
  render() {
    return (
      <ImageLoader src="awesome-o.gif" transitionTime="0.3s">
        {({ hasLoaded, shouldShowLoader, hasFailed, src }) => (
          <div className="AwesomeOLoader">
            {shouldShowLoader && !hasFailed && (
              <div className="AwesomeoLoader__loading">
                Awesome-o is loading ...
              </div>
            )}

            {hasFailed && (
              <div className="AwesomeoLoader__failed">
                Awesome-o has failed :(
              </div>
            )}

            {hasLoaded && (
              <div
                className="AwesomeoLoader__failed"
                style={{ backgroundImage: `url(${src})` }}
              >
                Awesome-o has Loaded!! :(
              </div>
            )}
          </div>
        )}
      </ImageLoader>
    );
  }
}

For the moment I only want to change the color to a darker one and the posibility to put it translucid too, I tell you this via Issues in the case you want consider this as a enhancement or something.

Thanks!

hey @DarkHollow, is it just the loader you would like to modify? Have you looked at this section:
https://github.com/nckblu/react-image-and-background-image-fade#image--customLoaders

Does that answer your question? Or is it that you want to modify the default loader?

Yes I would like to modify the default loader if it is possible, I don't need to implement a complete one, is there a way to do it properly?

If it is not possible I will impelment a custom loader like your link.

Thank you.

I see, at the moment the default loader isn't exposed for public export however in the next version I will ensure that it is importable/modifiable.

Thanks for the feedback!

That would be nice!

Thank you for your work =)