All Projects ā†’ coelhucas ā†’ mini-styled

coelhucas / mini-styled

Licence: MIT license
Small subset of styled-components šŸ’…

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to mini-styled

React Scoped Styles
Scoped Styles for React
Stars: āœ­ 45 (+181.25%)
Mutual labels:  styles
Paris
Define and apply styles to Android views programmatically
Stars: āœ­ 1,716 (+10625%)
Mutual labels:  styles
CustomWebRadioButton
An example of a make radio-button design on the web.
Stars: āœ­ 15 (-6.25%)
Mutual labels:  styles
Vertical Rhythm
Put some typographical vertical rhythm in your CSS. LESS, Stylus and SCSS/SASS versions included.
Stars: āœ­ 83 (+418.75%)
Mutual labels:  styles
Styled By
Simple and powerful lib to handle styled props in your components
Stars: āœ­ 122 (+662.5%)
Mutual labels:  styles
Figma Tokens
Official Repo of the Figma Plugin 'Figma Tokens'
Stars: āœ­ 134 (+737.5%)
Mutual labels:  styles
Ngx Ui
šŸš€ Style and Component Library for Angular
Stars: āœ­ 534 (+3237.5%)
Mutual labels:  styles
white-cursor
Provides a white I-bar cursor in the Atom editor for use with dark backgrounds
Stars: āœ­ 13 (-18.75%)
Mutual labels:  styles
Skin
Pure CSS framework designed & developed by eBay for a branded, e-commerce marketplace.
Stars: āœ­ 126 (+687.5%)
Mutual labels:  styles
Layouts
Grab-and-go layouts for React
Stars: āœ­ 202 (+1162.5%)
Mutual labels:  styles
Mapbox Gl Controls
Stars: āœ­ 93 (+481.25%)
Mutual labels:  styles
Rollup Plugin Styles
šŸŽØ Universal Rollup plugin for styles: PostCSS, Sass, Less, Stylus and more.
Stars: āœ­ 116 (+625%)
Mutual labels:  styles
Preset
A simple CSS preset for 2020
Stars: āœ­ 146 (+812.5%)
Mutual labels:  styles
Torch Models
Stars: āœ­ 65 (+306.25%)
Mutual labels:  styles
prop-styles
Utility to create flexible React components which accept props to enable/disable certain styles.
Stars: āœ­ 31 (+93.75%)
Mutual labels:  styles
Graphql Css
A blazing fast CSS-in-GQLā„¢ library.
Stars: āœ­ 672 (+4100%)
Mutual labels:  styles
Figma Theme
Generate development-ready theme JSON files from Figma Styles
Stars: āœ­ 130 (+712.5%)
Mutual labels:  styles
sauron-style
One library to observe them all (style changes) šŸ‘
Stars: āœ­ 37 (+131.25%)
Mutual labels:  styles
react-native-use-styles
A classy approach to manage your react native styles.
Stars: āœ­ 66 (+312.5%)
Mutual labels:  styles
Dropcss
An exceptionally fast, thorough and tiny unused-CSS cleaner
Stars: āœ­ 2,102 (+13037.5%)
Mutual labels:  styles

mini-styled šŸ’…

Abstract

This is meant to be a subset of styled-components features. It was made as a study project in order to give better understanding of the original styled-components source and some of the concepts usages.

ā„¹ļø This project is ~1.8% the size of real styled-components (package unpacked size);

āš ļø It doesn't work with SSR, since this library uses a browser API. If you need something for a real production application, use styled-components instead.

Installation

npm i mini-styled

or if you're using yarn

yarn add mini-styled

Example

import React from 'react';

import styled from 'mini-styled';

const Wrapper = styled.section`
  padding: 24px;
  background: papayawhip;
`;

const Button = styled.button`
  background-color: ${props => props.customBg || 'white'};
  color: palevioletred;
  border: 24px;

  &:hover {
    background-color: pink;
  }
`;

const MyComponent = () => (
  <Wrapper>
    <Button customBg="yellow">Click me</Button>
  </Wrapper>
);

And then you'll see this in your project:

image

API

The existing API at this moment expose only the styled factory, which works for HTML Elements and React Components, just as styled. It supports media queries, pseudo classes and general features oferred by Stylis.js. Check TODO for planned functionalities.

TODO

  • Add tests
  • Make proper use of stylis middleware to inject rules via CSSOM
  • Add vendor prefixes (also from stylis)
  • Make it work natively with SSR

Feel free to contribute to this project, to increase its features, improve its code and etc! And although this isn't a project I'm willing to take too seriously, feel free to report issues, I'll take a look as soon as possible.

Acknowledgements

  • Special thanks to Josh.

I started this project by navigating and studying styled-components source, but his post on Demystifying styled-components really gave me some insights that I applied to the final structure of the code for the sake of simplicity :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].