Coder Social home page Coder Social logo

ceciliamvrie / styled-material-components Goto Github PK

View Code? Open in Web Editor NEW

This project forked from homeservicesofamerica/styled-material-components

1.0 2.0 0.0 2.41 MB

Styled Components implementation of Material Design

License: Other

JavaScript 98.81% Shell 1.19%

styled-material-components's Introduction

Styled Material Components

Styled Components inspired library that implements Material Design for stress free React Application scaffolding.

Table of Contents

  1. Inspiration and goals
  2. Getting Started
  3. Contributing
  4. How to use
  5. Theme Provider
  6. Component Example
  7. Decorator Example

Inspiration and goals

  1. Styled Components is a great way to couple components with styles.
  2. Material Components is the best implementation of material design spec (it is google afterall)
  3. We want a native react implementation of the above, and Styled Components gives us that power.
  4. Sass Mixins can be mostly written as styled component mixins. See src/mixins/ for examples of this.

Getting Started

  • Fork the repo
  • Run:
yarn install
yarn run dev

Contributing

How to use

The components in this library are Styled Components and have full access to the Style Components v2 api. That means you can call .extend on any of the exported components to modify the styling of everything within the component.

Theme Provider

Similar to the Styled Components ThemeProvider (its a thin wrapper around it) except that it provides a default theme that matches material design's default theme. You can provide a custom theme here with any option from src/theme/defaultTheme.js overwritten. You can nest ThemeProviers just like with StyledComponents to overwrite portions of the theme for sections of your application

Component Example

Button

This component is for creating a material design button. It has props that match the documentation from Material Components

Example Implementation:

// Flat button with primary text color
<Button primary>I’m a Button</Button>

// Flat button with accent text color
<Button accent>I’m a Button</Button>

// Raised button with primary background color
<Button raised primary>I’m a Button</Button>

Decorator Example

withRipple

This is a decorator (higher order component) to add a javascript ripple effect to any element that is a styled component. (it must have the .extend function).

const JSRippleButton = withRipple(Button);
<JSRippleButton raised primary>Test</JSRippleButton>

styled-material-components's People

Contributors

arilfrankel avatar ashwoodall avatar brad-decker avatar calebjanderson avatar dekkofilms avatar iamdavid0091 avatar kristajg avatar martahj avatar petegivens avatar

Watchers

 avatar  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.