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

@team-griffin/react-heading-section

v3.1.1

Published

```sh npm i --save @team-griffin/react-heading-section

Downloads

13

Readme

react-heading-section

npm i --save @team-griffin/react-heading-section

yarn add @team-griffin/react-heading-section

This package's job is to automatically determine the depth of an H. This is super useful if you have written a reusable component that could be rendered anywhere in the tree that should have an H in it.

Usage

import { HeadingRoot, HeadingSection, Heading, H } from '@team-griffin/react-heading-section';

return (
  <HeadingRoot>
    <HeadingSection>
      <div>
        <Heading
          component={(
            <H>This is an h1</H>
          )}
        />
        <HeadingSection>
          <div>
            <Heading
              component={(
                <H>This is an h2</H>
              )}
            />
          </div>
        </HeadingSection>
      </div>
    </HeadingSection>
  </HeadingRoot>
);

// -->
<div>
  <h1>This is an h1</h1>
  <div>
    <h2>This is an h2</h2>
  </div>
</div>

Heading Root

Heading root's job is to setup the initial depth for the rest of the heading's down the tree. It's inital depth is 0, as each descendant heading section increments from it.

Has no props.

Heading Section

Heading section's job is to create a new scope. Any <Heading> rendered as a descedant of a <HeadingSection> will automatically know the scope / depth.

Heading sections can be as descendants of other heading sections. This will increment the depth even further.

HeadingRoot
-- HeadingSection
---- Heading (h1)
---- HeadingSection
------ Heading (h2)
---- Heading (h1)
---- HeadingSection
------ Heading (h2)

Has no props.

Heading

Heading will get the current depth / scope and render a given component and pass along that depth.

(
  <Heading component={(props) => {
    console.log(props.depth);
  }}>
)

Props:

  • Component = (string / Element / Component Constructor)

H

H is a utility component which will take a depth and spit out a an h(1-6).

This component passes through any other props you pass to it.

(
  <H depth={1}>
    My Title
  </H>
)

// -->
<h1>My Title</h1>

Props:

  • Depth

Heading Matrix

Heading matrix will allow you yo specify what you want to render at a given depth.

But... if one isn't provided it will look up the closest (going up).

(
  <HeadingMatrix
    depth={5}
    h1={(<MyFancyH1/>)}
    h2={(<MyFancyH2/>)}
    h3={(<MyFancyH3/>)}
    h4={(<MyFancyH4/>)}
    h5={(<MyFancyH5/>)}
    h6={(<MyFancyH6/>)}
  />
)

Props:

  • Depth
  • h1-h6