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

react-styled-ghp

v0.1.8

Published

GitHub Pages component for React built with styled-components < 💅>

Downloads

5

Readme

react-styled-ghp

GitHub Pages component for React built with styled-components < 💅>

NPM JavaScript Style Guide

Install

npm install --save react-styled-ghp
yarn add react-styled-ghp

Basic Usage

  • Import the GhPage component from package
  • Wrap the demo conent inside GhPage
  • Pass the in the desired options
import React, { Component } from 'react';
import GhPage from 'react-styled-ghp';

class Example extends Component {
  render () {
    const options = {
      logo: './path/to/logo',
      username: 'username',
      github: './url/of/repo',
      npm: './url/of/module',
      title: 'title',
      description: 'description',
      readMe: './path/to/readMe',
    }
    return (
      <GhPage {...options}>
        <div>Demo content goes here</div>
      </GhPage>
    )
  }
}

Partial Usage

If you only want to render parts of the GhPage, you can import the indiviual components (Header, Demo, Layout). Make sure to pass the layout object to all of the components you wish to render.

import { Header, Demo }  from 'react-styled-ghp';

...
return (
  <div>
    <Header {...options} />
    <Demo {...options}>
      <div>Demo content goes here</div>
    </Demo>
  </div>
);
...

Features

  • Simple setup
  • Clean & responsive design
  • Readme w/ syntax highlighting
  • Easy to use BEM class hooks

Examples

  • Demo - https://alexcasche.github.io/react-styled-ghp/

Props

The GhPage component accepts the following props.

| Prop | Type | Default | Description: Options | |-------------------|-------------|------------------|----------------------------| | logo | string | null | Path to logo: url | | username | string | null | Github username | | github | string | null | Github repo: url | | npm | string | null | NPM pacakge: url | | title | string | null | Page title: [base]-subname | | description | string | null | Page decription | | readme | string | null | Path to readme: url | | theme | object | see below | Theme object: see below |

Note: The page title text is colored using the format [hoverText]-lightText. For example, the current page uses: [react]-styled-ghp

Theme

The theme object can be used to customize the look of the component, with the following values.

| Prop | Type | Default | |-------------------|-------------|------------------| | headerBG | string | #20232A | | bannerBG | string | #292C34 | | pageBG | string | #484C59 | | fontSans | string | inherit | | headerColor | string | #DDDDDD | | bannerColor | string | #DDDDDD | | pageColor | string | #20232A | | hoverColor | string | #34f96E |

There are two ways to use the theme object.

  1. Pass the theme to the styled-components ThemeProvider (recommended)
import { ThemeProvider } from 'styled-components';

...
return (
  <ThemeProvider theme={theme}>
    <GhPage>
      <div>Demo content goes here</div>
    </GhPage>
  </ThemeProvider>
);
...
  1. Pass the theme directly to the GhPage component (not recommended)
...
return (
  <GhPage theme={theme} />
);
...

Classes

For more control over the styles, you can use the following BEM classes.

| Class | Description | |--------------------------|----------------------| | .ghp__page | Page wrapper | | .ghp__header | Header section | | .ghp__username | Header username | | .ghp__logo | Header logo | | .ghp__link | Header link | | .ghp__demo | Demo section | | .ghp__title | Demo title | | .ghp__description | Demo description | | .ghp__readme | Readme section | | .ghp__markdown | Readme markdown |

Development

Follow these steps to setup a local development environment. Use yarn or npm - not both.

  1. Clone the repo from Github
git clone https://github.com/alexcasche/react-styled-ghp
  1. Setup project & start rollup watch
npm install && npm start
yarn install && yarn add
  1. Setup react app & start dev server
cd example
npm install && npm start
yarn install && yarn start

Shoutouts

License

MIT © alexcasche