npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@redsift/ui-rs-hero

v0.4.0

Published

A customizable Hero unit.

Downloads

15

Readme

ui-rs-hero

Circle CI npm MIT

ui-rs-hero is a component for creating a customizable Hero unit for your application. It is provided as a custom element for easy integration into your projects.

If your browser does NOT support custom elements natively (see caniuse) you have to install the web components shim and include it in your project before including this component!

The component is part of the RedsiftUI library. For a documentation of the hero unit see the official RedsiftUI documentation.

Builds

Circle CI

A UMD build is available from //static.redsift.io/reusable/ui-rs-hero/latest/ui-rs-hero.umd-es2015.min.js.

To build locally checkout this repository and

> cd ui-rs-hero
> npm install
> npm run build

This will create a ./dist folder with the Javascript and CSS files.

Browser Usage

First include the CSS file in the <head> of your page:

<link rel="stylesheet" href="//static.redsift.io/reusable/ui-rs-hero/latest/css/ui-rs-hero.min.css">
<!-- (optional) include RedsiftUI theme -->
<link rel="stylesheet" href="//static.redsift.io/reusable/ui-rs-core/latest/css/ui-rs-core.min.css">

Note that the ui-rs-core theme is also included. This is only to use the typical Redsift style and purely optional. ui-rs-hero does not depend on ui-rs-core.

Additionally include the Javascript on the bottom of the <body>:

<script src="//static.redsift.io/reusable/ui-rs-hero/latest/js/ui-rs-hero.umd-es2015.min.js"></script>

Including the Javascript already registers the custom element rs-hero with the browser.

Use the following HTML code to create a rs-hero element:

<rs-hero header="My Header" bg-class="-bg-hero -effect-darken" scroll-target="#scroll-anchor" sticky-header=".content">
    <h1>I'm a Hero!</h1>
</rs-hero>

-bg-hero is a user provided class which defines the background of the hero unit and is optional. If you do not provide a background class a simple grey background is displayed. More detailed information is available in the official RedsiftUI documentation. An example CSS background is here:

.-bg-hero {
  background-image: url('//static.redsift.io/assets/images/taxi-1.jpg');
}

rs-hero Configuration Attributes

  • header: (optional) A text appearing in the header of the hero component

  • bg-class: (optional) One or multiple comma separated CSS classes applied to the component (due to technical reasons it is not possible to apply classes directly via the class attribute). -bg-taxi is defining a background image (see below for the CSS code), -effect-darken is an effect class to improve the contrast between the background image and the displayed text in the hero. The effect class is provided by RedsiftUI, its counterpart -effect-lighten is also available.

  • scroll-target: (optional) If specified an arrow is displayed within the hero which scrolls to the given element on the page. Depending on the height of the whole page a click on the arrow might not cause any action, i.e. if the page is not overflowing.

  • sticky-header: (optional) If specified the header part of the hero unit will act as a sticky header. When the element specified in the attribute is scrolling out on the top of the page the class hero-sticky-header--active is added to the header div, allowing you to style the header when it is showing on its own withouth the hero unit.

The content put within the rs-hero element will be displayed vertically and horizontally centered within the hero.

All attributes can be set and changed with ordinary Javascript, e.g.:

var $hero = document.querySelector('rs-hero');

setTimeout(function() {
  $hero.removeAttribute('sticky-header');
  $hero.setAttribute('Not Sticky Anymore');
}, 3000);

CAUTION:

If your browser does not support custom elements (and only then!) make sure to wrap the Javascript logic into the following code:

window.addEventListener('WebComponentsReady', function(e) {
  // setup code ...
});

Development Setup

For development run

> npm run serve

within the repository folder. It will start a web server serving the content of ./samples and supports live-reloading when a source file is changed.