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

@growth-tools/core

v1.6.6

Published

A package for functions and React components shared across Growth Tools web domains.

Downloads

41

Readme

@growth-tools/core npm package

This npm package contains functions and React components shared across Growth Tools domains.

How to use

Install @growth-tools/core

$ npm install --save @growth-tools/core

Import dependencies

Example

import React from "react";
import ReactDOM from "react-dom";

// Import a React component and its styles.
import { Footer } from "@growth-tools/core";
import "@growth-tools/core/dist/main.css";


ReactDOM.render(<Footer />, document.getElementById("footer-root"));

As demonstrated above, remember to also import @growth-tools/core/dist/main.css if you're importing a React component.

Functions

insertReactComponentIntoRoot

A convenience function for inserting React components into the DOM.

Signature

insertReactComponentIntoRoot(ReactComponent, rootCSSSelector, props): void

Parameters

ReactComponent {React component class}: The class of the React component to be inserted

rootCSSSelector {string}: The CSS selector of the DOM node acting as the root for the component

props {object}: Passed to the component's props

Example Usage

import {insertReactComponentIntoRoot} from "@growth-tools/core";

const MyComponent = ...; // Some React component class


insertReactComponentIntoRoot(<MyComponent />, "root-node", { value: "123" });

React Components

Header

Displays a Growth Tools logo linking to the Growth Tools home page and navigation menus.

Prop Types

lightsAreOn

  • Affects the colors of the header elements. true assumes a page with a light background and is the default value.

Prop Types Definition

Header.defaultProps = {
  lightsAreOn: true
};

Header.propTypes = {
  lightsAreOn: PropTypes.bool.isRequired,
};

Example Usage

import { Header } from "@growth-tools/core";
import "@growth-tools/core/dist/main.css";

ReactDOM.render(
  <Header />,
  document.getElementById("header-root")
);

Footer

Displays navigation links, user sign-in, copyright, and privacy policy.

Prop Types

lightsAreOn

  • Affects the colors of the header elements. true assumes a page with a light background and is the default value.

Prop Types Definition

Footer.defaultProps = {
  lightsAreOn: true
};

Footer.propTypes = {
  lightsAreOn: PropTypes.bool.isRequired
};

Example Usage

import { Footer } from "@growth-tools/core";
import "@growth-tools/core/dist/main.css";

ReactDOM.render(
  <Footer />,
  document.getElementById("footer-root")
);

Using Font Assets

@growth-tools/core provides files for the Brandon Text fonts used by the React components.

In the (unlikely) event these font files are not already included in the consuming project, either copy them from this package into the proper directory or refer to the example stylesheet at /src/scss/EXAMPLE_FONTS_FILE.scss.

How to test locally

  1. Clone this repository to your local machine.
  2. Navigate to the core directory and install dependencies:
$ cd /path/to/@growth-tools/core
$ npm install
  1. Link the package to your local test project:
$ npm link; # while still in @growth-tools/core directory
$ cd /path/to/local/test/project
$ npm link @growth-tools/core

(Documentation for npm link).

  1. The package should now be accessible to your local project for testing. Use as described above.

How to update and release a new version

  1. Make sure main is up-to-date and contains latest changes ($ git checkout main && git pull).
  2. Follow the semantic versioning spec.
  3. Inside this project, on main, at the root, run: $ npm version <update_type> (patch, major, or minor) or enter new version number in place of <update_type>.
  4. Double check the local package.json file and commit the update (to main).
  5. Tag the commit with the version new version number ($ git tag v<version number; 1.2.2>).
  6. Run: $ npm publish.
  7. Check our package page to make sure the version was updated.
  8. Push the changes to Github ($ git push && git push --tags).