Giter VIP home page Giter VIP logo

react-fluid-header's Introduction

react-fluid-header

Hero image header React component for fluid layouts

What it does?

This component makes it easy to set up a hero image as header background by pushing the image source and anchoring positions through the props and setting up style attribute appropriately. This allows to create fluid layouts with cover hero image, which has a unique background position specific for this image, allowing to control the position of the central image feature on the screen.

Installation

npm i -S react-fluid-header

Required CSS support code

CSS properties set up on the component are the following:

  • background-image
  • background-position

There's no extra code injected into style attribute, authors expected to supply the necessary styling code in a separate stylesheet. Suggested example:

header {
  background-clip: content-box;
  background-size: cover;
  background-repeat: no-repeat;
  height: 100vh;
}

Use in JSX

This will set up /img/hero.jpg as a header background and anchor the point at 85% right and 20% down of the image dimension from the top left corner to serve as image focal point, if screen dimensions does not allow to show the whole image.

<Header anchorX="85%" anchorY="20%" src="/img/hero.jpg">
  <h1>Some clickbait phrase</h1>
</Header>

By default, the hero image is positioned in the center of the screen.

react-fluid-header's People

Contributors

sprrw avatar

Stargazers

Hill Liu avatar

Watchers

 avatar

react-fluid-header's Issues

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.