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

teatime-components

v0.10.15

Published

React components + CSS Modules

Downloads

141

Readme

teatime-components

A set of React Components + CSS Modules :heart:

See the component's examples at http://sullenor.github.io/teatime-components/

👋 In case you are going to update to React@16 — check the necessity of adding polyfills: https://reactjs.org/docs/javascript-environment-requirements.html

Philosophy

  • What can be done with styles, should be done with styles.
  • No global dependencies neither in JS nor in CSS.

Features

  • Possibility to mix particular styles without CSS Modules using className property.
  • In case you want to overwrite the defined styles you may provide the styles property with custom class names or use the global referers (see the usage without CSS Modules).
  • Predictability.

Requirements

Usage

Using single-file distributives

Installation

Download the distributive via curl for example:

curl -O https://raw.githubusercontent.com/sullenor/teatime-components/0.8.14/dist/teatime.js

or the minified version:

curl -O https://raw.githubusercontent.com/sullenor/teatime-components/0.8.14/dist/teatime.min.js

Configutation

Simply add react and react-dom scripts into your html page and the downloaded version of the teatime-components after:

<script src='https://unpkg.com/react@15/dist/react.js'></script>
<script src='https://unpkg.com/react-dom@15/dist/react-dom.js'></script>
<script src='teatime.js'></script>

or the minified version:

<script src='https://unpkg.com/react@15/dist/react.min.js'></script>
<script src='https://unpkg.com/react-dom@15/dist/react-dom.min.js'></script>
<script src='teatime.min.js'></script>

Example

https://jsfiddle.net/r0byq6d8/

<!doctype html>
<html lang='en'>
<head>
  <meta charset="utf-8">
  <title>Awesome Button</title>
  <script src='https://unpkg.com/react@15/dist/react.min.js'></script>
  <script src='https://unpkg.com/react-dom@15/dist/react-dom.min.js'></script>
  <script src='https://rawgit.com/sullenor/teatime-components/master/dist/teatime.min.js'></script>
</head>
<body>
  <div id='entry'></div>

  <script type='text/javascript'>
    const createElement = React.createElement;
    const render = ReactDOM.render;

    render(createElement(Teatime.Button, {theme: 'action'}, 'Make Awesome'),
      document.getElementById('entry'));
  </script>
</body>
</html>

Using with compilation

Warning: Despite the fact that the published code is compatible with ECMAScript 5, it is highly recommended to include the babel-polyfill for the ECMAScript 6 constructor's basic methods (like String.startsWith and etc.).

Installation

Using npm do:

npm install teatime-components

Configutation

Using webpack do:

const {resolve} = require('path');

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              modules: true,
            },
          },
        ],
      },
    ],
  },

  entry: '...',
  output: {
    filename: 'index.js',
    path: resolve('dist'),
  },
};

Example

See examples/webpack-setup.

Tips

In order to remove various test helpers, which you don't need in your production environment, you should add the Webpack DefinePlugin to the plugins section. It will also decrease the bundle size and provide some performance. Configuration example:

plugins: [
  // ...
  new webpack.DefinePlugin({
    'process.env': {
      'NODE_ENV': JSON.stringify('production'),
    },
  }),
],

Reference Guides

  • React Component Specs and Lifecycle: https://facebook.github.io/react/docs/component-specs.html
  • React Event System: http://facebook.github.io/react/docs/events.html
  • React Forms: https://facebook.github.io/react/docs/forms.html
    • React Controlled Components: https://facebook.github.io/react/docs/forms.html#controlled-components
  • React Prop Validation: https://facebook.github.io/react/docs/reusable-components.html#prop-validation
  • React Supported Attributes: https://facebook.github.io/react/docs/tags-and-attributes.html#supported-attributes
  • CSS Modules: https://github.com/css-modules/css-modules#css-modules
    • CSS Modules Composition: https://github.com/css-modules/css-modules#composition
    • CSS Modules Values: https://github.com/css-modules/postcss-modules-values#css-modules-values

License

The MIT License