0.1.8 • Published 6 years ago

react-styled-ghp v0.1.8

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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

Props

The GhPage component accepts the following props.

PropTypeDefaultDescription: Options
logostringnullPath to logo: url
usernamestringnullGithub username
githubstringnullGithub repo: url
npmstringnullNPM pacakge: url
titlestringnullPage title: [base]-subname
descriptionstringnullPage decription
readmestringnullPath to readme: url
themeobjectsee belowTheme 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.

PropTypeDefault
headerBGstring#20232A
bannerBGstring#292C34
pageBGstring#484C59
fontSansstringinherit
headerColorstring#DDDDDD
bannerColorstring#DDDDDD
pageColorstring#20232A
hoverColorstring#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.

ClassDescription
.ghp__pagePage wrapper
.ghp__headerHeader section
.ghp__usernameHeader username
.ghp__logoHeader logo
.ghp__linkHeader link
.ghp__demoDemo section
.ghp__titleDemo title
.ghp__descriptionDemo description
.ghp__readmeReadme section
.ghp__markdownReadme 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

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.0

6 years ago