Coder Social home page Coder Social logo

danistefanovic / react-lazy-hero Goto Github PK

View Code? Open in Web Editor NEW
145.0 145.0 20.0 11.16 MB

⚡️ A hero component for React

Home Page: http://react-lazy-hero.danielstefanovic.com

License: MIT License

JavaScript 93.61% HTML 5.26% CSS 1.13%
header hero-component parallax parallax-scrolling preload-images react

react-lazy-hero's People

Contributors

clodal avatar danistefanovic avatar raisedadead avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-lazy-hero's Issues

direction

Is it possible to make parallax scroll to another direction? i tried negative offset but it doesn't work

Can't resolve 'styled-components'

Hi. When loading the application, the error occurs
Module not found: Can't resolve 'styled-components' in '.../node_modules/react-lazy-hero/lib'

If I install the dependency in my project everything works.

node 8.11.4
react 16.3.1

aria-labels

Would you be able to add an optional attribute for the component that adds in aria-labels for accessibility?

Hero image not displaying

Hi,

It may seem simple and stupid but i'm at a dead end.
Been staring at this for a long time...

I can't seem to get the image to display in the hero...
I've tried coping your example and still nothing...

image
image
image

Any assistance would be much appreciated.

Regards,
Elliot

background image not loading

Hey,

Saw a few other similar issues but the solutions for them don't seem to fix this.

let props = {
    imageSrc: 'https://www.alm.com/wp-content/uploads/2017/10/NYC_Contact-Us-Page-Form-image.jpg" />',
    color: '#ffff33',
    minHeight: '14vh',
}

const LargeHero = () => (
    <LazyHero {...props}>
        <h1>Generic Startup Hype Headline</h1>
    </LazyHero>
)

I also tried with your imageSrc from docs imageSrc="https://unsplash.it/2000/1000" and also no joy.

Changing minHeight works, but nothing around background image or color can be changed.

Versions:

"react": "^16.8.1",
"react-lazy-hero": "2.0.0",
"styled-components": "4.0.0",

Test fail

I'm import react-lazy-hero into a component, but when i make test to my component fails.

import LazyHero from 'react-lazy-hero';

class Hero extends Component {

    constructor(props) {
	super(props);
    }

   render() {
       const {
           image,
	   parallaxOffset,
	   isFixed,
	   isCentered,
	   overlayColor,
	   opacity,
	   minHeight,
           children
     } = this.props;
     <LazyHero 
         isFixed={isFixed}
         isCentered={isCentered}
         imageSrc={image}
         opacity={opacity}
         color={overlayColor}
         parallaxOffset={parallaxOffset}
         minHeight={minHeight}>
         {children}
      </LazyHero>
   }
}

when run test of this component fail:

image

Please can you say me why ???

Background image not rendereing from props

Hi, I'm having problems with rendering my BG in the lazy-hero!... can you help me figure ot the reason for this? Thank you!

This is how the browser looks:

image
This is my index where I import my Hero.js:
image

In Hero.js I import lazy-hero
image

Do you have an idea about why the background-image: attribute doesn't show the picture?

Multiple instances on the same page makes the background image huge

Greetings!

The problem as the title says, the "background-size" css property of the "background-image" container div becomes bigger and bigger after each LazyHero component.

The style prop applies to the parent div, so cant use that to set manually the correct values.

SSR Support

Any chance if server-side rendering is supported via styled-components?

TypeError: styleSheet.getName is not a function
    at ComponentStyle.generateAndInjectStyles (/Users/clodal/sites/abc/node_modules/react-lazy-hero/node_modules/styled-components/lib/models/ComponentStyle.js:95:37)
    at StyledComponent.generateAndInjectStyles (/Users/clodal/sites/abc/node_modules/react-lazy-hero/node_modules/styled-components/lib/models/StyledComponent.js:154:40)
    at StyledComponent.componentWillMount (/Users/clodal/sites/abc/node_modules/react-lazy-hero/node_modules/styled-components/lib/models/StyledComponent.js:192:40)
    at processChild (/Users/clodal/sites/abc/packages/server/node_modules/react-dom/cjs/react-dom-server.node.development.js:2167:16)
    at resolve (/Users/clodal/sites/abc/packages/server/node_modules/react-dom/cjs/react-dom-server.node.development.js:2061:5)
    at ReactDOMServerRenderer.render (/Users/clodal/sites/abc/packages/server/node_modules/react-dom/cjs/react-dom-server.node.development.js:2380:22)
    at ReactDOMServerRenderer.read (/Users/clodal/sites/abc/packages/server/node_modules/react-dom/cjs/react-dom-server.node.development.js:2354:19)
    at Object.renderToString (/Users/clodal/sites/abc/packages/server/node_modules/react-dom/cjs/react-dom-server.node.development.js:2726:25)
    at /Users/clodal/sites/abc/packages/server/build/index.js:56:257515
    at tryCatch (/Users/clodal/sites/abc/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (/Users/clodal/sites/abc/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (/Users/clodal/sites/abc/node_modules/babel-runtime/node_modules/regenerator-runtime/runtime.js:114:21)
    at step (/Users/clodal/sites/abc/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
    at /Users/clodal/sites/abc/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
    at <anonymous>

Bug in a TypeScript Project

I am in the process of migrating my portfolio from a regular CRA application to a CRA-typescript app.

I am having issue with this LazyHero, as the background image is not displayed and this error pops up in the console:

LazyHero.js:167 Uncaught TypeError: Cannot read property 'offsetHeight' of undefined
    at LazyHero.updateSize (LazyHero.js:167)
    at Image.image.onload (LazyHero.js:156)

I am new to TypeScript so it might be a problem with type declarations (maybe not). I just added a simple declare module 'react-lazy-hero'; to have the app not crash, but might be not enough to have it work properly.
Any advice ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.