• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

HomeServicesOfAmerica/styled-material-components: Styled Components implementati ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

HomeServicesOfAmerica/styled-material-components

开源软件地址(OpenSource Url):

https://github.com/HomeServicesOfAmerica/styled-material-components

开源编程语言(OpenSource Language):

JavaScript 99.8%

开源软件介绍(OpenSource Introduction):

No Longer Maintained

Our humble recommendation is to use material-ui, which now interops with styled-components fairly well.

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 build
yarn run dev

Contributing

How to use

All components in this library are either:

  1. Already styled components and will work when wrapping with styled()
  2. Handle the className prop correctly so that wrapping with styled() will work.

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

Global Style Helpers (^0.1.1-beta)

Prior to version 0.1.1-beta we injected global styles behind the scenes. In our use case this lead to us having to override these often. Styled-components v4 created a new createGlobalStyle builder that exports components. So now you can import these global styles manually and add them to your code where and if you want.

  1. SMCGlobalStyles (includes the app wide styles that are typical in most material apps)
  2. DrawerGlobalStyles (includes some global styles that push content around on the screen when the presence of a drawer is detected)

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 can have a className attached to it.

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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap