GithubHelp home page GithubHelp logo

leonardoleo / lemon-reset Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yelp/lemon-reset

0.0 1.0 0.0 142 KB

Consistent, cross-browser React DOM tags, powered by CSS Modules. ๐Ÿ‹

License: MIT License

Shell 0.06% JavaScript 93.61% Makefile 6.34%

lemon-reset's Introduction

๐Ÿ‹ Lemon Reset

npm Build Status gzip size install size

A set of React components that provide Meyer Reset styles for use with CSS Modules.

For all the DOM tags used in Meyer Reset, Lemon Reset provides a React component with those reset styles, minimizing the effect of browser quirks. In a React world, we prefer components that are self-contained and not reliant on global styling.

Read more about the motivation behind Lemon Reset in our blog post!

Installation

yarn add lemon-reset

Usage

Use these components as a drop in replacement for your existing HTML tags!

import { P } from 'lemon-reset';

ReactDOM.render(<P>Hello World</P>, myContainer);

Wrap Lemon Reset components in your own custom components!

import { Span, Div } from 'lemon-reset';
import styles from './Container.css';

type Props = {
    display: 'inline' | 'inline-block' | 'block' | 'none',
};

const Container = ({ children, display }: Props) => {
    const Tag = display === 'inline' ? Span : Div;
    const classes = styles[`display--${display}`];

    return <Tag className={classes}>{children}</Tag>;
};

export default Container;

Pass in any props! If you need to pass in a ref, you'll need to pass it in as a tagRef:

<Span tagRef={span => console.log(span)}>This has a ref</Span>

Build

Our makefile assumes that you have virtualenv available globally, as we use a python environment for running pre-commit.

If you have virtualenv, simply run:

make build

Otherwise, you can do:

NODE_ENV=production yarn babel src --out-dir lib --copy-files

lemon-reset's People

Contributors

asottile avatar brianokeefe avatar domanchi avatar greenkeeper[bot] avatar jdb8 avatar magicmark avatar mxmul avatar theresama avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.