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

@theconversation/ui

v2.44.0

Published

A collection of React components used to build our apps at The Conversation

Downloads

498

Readme

UI

Build Status

This library contains a collection of React components used to build our apps at The Conversation. It is based on the excellent Material UI library. Examples of the available components can be viewed in our styleguide.

Table of Contents

Usage

npm install --save-dev @theconversation/ui

Be sure to wrap any react components in a ThemeProvider component from @theconversation/ui. This will provide the correct theme to all of the components in this library.

You will also need to install the typeface packages and import them into your project.

For example:

import 'typeface-libre-baskerville'
import 'typeface-montserrat'
import 'typeface-noto-sans'

import { Button, ThemeProvider } from '@theconversation/ui'

const App = () => (
  <ThemeProvider>
    <Button>Hello World!</Button>
  </ThemeProvider>
)

Developing

When working on components, you can run storybook locally:

make storybook

Alternatively, you can run storybook through Docker:

make storybook-docker

This will give you a hot reloading environment to rapidly develop in.

If you want to test your newly developed components in a local app, the easiest way is likely going to be to use npm link. Just be certain that the version of node and npm matches or you might run into problems.

First in the root directory of this library, call npm link. This sets up a symlink so that this library will behave as if it's been globally installed.

Next, in the project that you want to use the local version of this libray in, run npm link @theconversation/ui, which creates a symlink in that projects node_modules/ to the global @theconversation/ui.

From there it should just work, but if you run into issues at this point, try either resetting or deleting your package-lock.json then running npm install again.

To undo the symlink, just run npm unlink @theconversation/ui.

Server-side Rendering

<ThemeProvider> supports two optional props, sheetsRegistry and sheetsManager. These can be used to keep track of the JSS so it can be rendered inline when doing server side rendering.

You can then call sheetsRegistry.toString() to get a string containing the CSS in order to render the current page server side.

const sheetsRegistry = new SheetsRegistry();
const sheetsManager = new Map();

const App = () => (
  <ThemeProvider sheetsRegistry={sheetsRegistry} sheetsManager={sheetsManager}>
    <Button>Hello World!</Button>
  </ThemeProvider>
)
<style type="text/css" id="ssr-styles">${sheetsRegistry.toString()}</style>

Examples

To run the example react app:

> cd examples/react-app
> npm i
> npm start

Publishing a Release

Tagged releases of this library will be automatically published to NPM by a GitHub workflow.

To create a new (major/minor/patch) release, first update the changelog. Then on the master branch:

> npm version minor
> git push --follow-tags

You can then create a release from the tag either using the web UI, or from the CLI:

> gh release create v1.2.3

Licence

This project is licensed under the MIT licence. See the LICENCE file for more details.