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

cra-template-bushido

v1.3.1

Published

CRA plus redux, router, axios, normalize.css, styled components

Downloads

22

Readme

Welcome to Jimmy's Custom Template!

How To Install

yarn

yarn create react-app <app-name> --template bushido

npm

npm init react-app <app-name> --template bushido

npx

npx create-react-app <app-name> --template bushido

global

If create-react-app is installed globally on your computer you can use this command:

create-react -app <app-name> --template bushido

Just like regular create-react-app but so much more. This template includes:

  • @callstack/react-theme-provider
  • axios
  • bushido-strap
  • node-sass
  • react-redux
  • react-router
  • react-router-dom
  • redux
  • redux-logger
  • redux-thunk
  • serve
  • styled-components
  • webfontloader

There is also a serve script that let's your run serve -s build and a build-and-serve script that runs npm run build && npm run serve.

Redux boilerplate is set up with combine reducers and has a simple counter reducer used in one of the routes that use's react-redux's beautiful hooks to access actions and state from reducer's.

Reducer and action folders are inside a store folder so they are in the same spot.

| src |
| --- | components
| --- | *store* |
| --- | ------- |actions*
| --- | ------- | reducers*
| App.js
| index.js

Routes are set in App.js and all components for routes are built in components folder.

BUSHIDO-STRAP

What is bushido-strap? Well, friend, it is a personal style library I create. It's just a bunch of nifty little styled components I've slowly crafted over time. Learning from my peers has probably been the greatest contribution to this project! It's already set up in this template, so check it out! Here's the documentation, so you can to see everything this modest style library has to offer!

Using Google Fonts

WebFontLoader is used for this. Although, they do more than just load Google fonts efficiently. Check out their documentation here!.

In the App.js you will see:

// Using Web Font Loader for google fonts
import WebFont from "webfontloader";

// setting our font variables
const h_font = "Comfortaa";
const r_font = "Montserrat";

// using WebFont to easily access Google fonts
WebFont.load({
  google: {
    families: [h_font, r_font],
  },
});

export default function App() {
  return (
    <AppWrapper head_font={h_font} font={r_font}>
      <Route path="/" exact component={Dashboard} />
      <Route path="/counter" component={ReduxCounter} />
    </AppWrapper>
  );
}

All you need to do is add any Google font name to the h_font variable to change the heading (h1-h6) font for the whole site and add change the r_font variable to change the font for everything else.

Adding A Custom Theme

React Theme Provider is set up so you can edit bushido-strap theme's or add your own to use! Just add a theme prop in the ThemeProvider in src/index.js and pass in your custom theme object. You can then import the useTheme hook from your scr/index.js and set const theme = useTheme(); in your component and you can freely access any of your theme variables by simply accessing your theme variable: color={theme.myCustomColor}.

Example:

Create a theme.js file in your src folder:

const theme = {
  myColorOne: "red",
  myColorTwo: "blue",
  // if you want to override bushido strap values just reassign them here
  gray0: "black",
};

export default theme;

Add your custom theme object to your src/index.js:

import theme from "./theme";

Now pass that theme to your ThemeProvider:

ReactDOM.render(
  <Provider store={store}>
    <Router>
      <ThemeProvider theme={theme}>
        <App />
      </ThemeProvider>
    </Router>
  </Provider>,
  document.getElementById("root")
);

And now you can access both your and bushido-strap's theme objects by importing the useTheme hook from scr/index.js. Any overrides in your theme object will be favored over bushido-strap's theme. 👌

If you don't set up your own custom theme you can just import theme from "bushido-strap/styled/theme and use the default theme.