All Projects → winkerVSbecks → draper

winkerVSbecks / draper

Licence: MIT License
🍸 React Native style utilities

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to draper

CustomWebRadioButton
An example of a make radio-button design on the web.
Stars: ✭ 15 (-37.5%)
Mutual labels:  styles
stylez
dark css style overrides for sites i use
Stars: ✭ 38 (+58.33%)
Mutual labels:  styles
chameleon
CSS like framework for Android
Stars: ✭ 56 (+133.33%)
Mutual labels:  styles
react-native-use-styles
A classy approach to manage your react native styles.
Stars: ✭ 66 (+175%)
Mutual labels:  styles
less-mix
LESS-Mix - is a functional, powerful and convenient library LESS-mixins.
Stars: ✭ 22 (-8.33%)
Mutual labels:  styles
jss-material-ui
A enhanced styling engine for material-ui
Stars: ✭ 15 (-37.5%)
Mutual labels:  styles
Dropcss
An exceptionally fast, thorough and tiny unused-CSS cleaner
Stars: ✭ 2,102 (+8658.33%)
Mutual labels:  styles
WPFControls-ThemePack
Custom designed themes for WPF controls to make your app look better. Simple to modify.
Stars: ✭ 28 (+16.67%)
Mutual labels:  styles
Giotto
Theme manager for your app: apply styles to anything you want through a plist file
Stars: ✭ 18 (-25%)
Mutual labels:  styles
log-utils
Basic logging utils: colors, symbols and timestamp.
Stars: ✭ 24 (+0%)
Mutual labels:  styles
white-cursor
Provides a white I-bar cursor in the Atom editor for use with dark backgrounds
Stars: ✭ 13 (-45.83%)
Mutual labels:  styles
mini-styled
Small subset of styled-components 💅
Stars: ✭ 16 (-33.33%)
Mutual labels:  styles
leeks.js
Simple ANSI styling for your terminal
Stars: ✭ 12 (-50%)
Mutual labels:  styles
prop-styles
Utility to create flexible React components which accept props to enable/disable certain styles.
Stars: ✭ 31 (+29.17%)
Mutual labels:  styles
tsstyled
A small, fast, and simple CSS-in-JS solution for React.
Stars: ✭ 52 (+116.67%)
Mutual labels:  styles
Layouts
Grab-and-go layouts for React
Stars: ✭ 202 (+741.67%)
Mutual labels:  styles
CustomWebCheckbox
An example of a make checkbox design on the web.
Stars: ✭ 12 (-50%)
Mutual labels:  styles
highcharts-themes-collection
Highcharts themes collection
Stars: ✭ 30 (+25%)
Mutual labels:  styles
postcss-gtk
Processes GTK+ CSS into browser CSS
Stars: ✭ 23 (-4.17%)
Mutual labels:  styles
stylenames
A simple JavaScript utility for conditionally joining inline styles together
Stars: ✭ 18 (-25%)
Mutual labels:  styles

Draper

Atomic, functional and modular styling for React Native. Inspired by Basscss and Tachyons.

Don Draper smile

Usage

npm i Draper -S

Build draper styles in a styles.js module:

import draper from 'Draper';
export default draper();

Then to use them:

import s from './styles';

<View style={[ s.bgWhite, s.p2, s.mt2, s.rounded ]}>
  { ... }
</View>

Customizing

The base config contains defaults for rem, borderWidth, typeScale, (whitespace)scale, lineHeightScale and clrs. You can modify these by passing in options to the build function. For example:

import draper from 'Draper';
export default draper({
  clrs: { mauve: '#E0B0FF' },
  scale: [1, 2, 3, 4],
  typeScale: {
    f2: 1.5,
    f3: 1.25,
  },
});

Extending

import draper from 'Draper';
import { StyleSheet } from 'react-native';

export default {
  ...draper(),
  ...StyleSheet.create({
    myCustomClass: { color: 'magenta' },
    o0: { opacity: 0 },
    o10: { opacity: 0.1 },
    o20: { opacity: 0.2 },
    o30: { opacity: 0.3 },
    o40: { opacity: 0.4 },
    o50: { opacity: 0.5 },
    o60: { opacity: 0.6 },
    o70: { opacity: 0.7 },
    o80: { opacity: 0.8 },
    o90: { opacity: 0.9 },
    o100: { opacity: 1 },
  }),
};

Modules

Absolute

Absolute positioning and zIndex utilities. It also aliases StyleSheet.absoluteFill.

📑source

Border

Border radius and sizing utilities. Border radius scale: 1rem, 2rem, 3rem, 4rem, 8rem, 16rem. Border sizing supports three options:

  • 0
  • StyleSheet.hairlineWidth
  • config.borderWidth

📑source

#### Colors

Text, border and background colour utilities. The colour values used in this module are from mrmrs/colors. For example:

{ black:        { color: '#515163' } }
{ bgBlack:      { backgroundColor: '#515163' } }
{ borderBlack:  { borderColor: '#515163' } }

📑source

Dimensions

Width and height utilities using this scale: 1rem, 2rem, 3rem, 4rem, 8rem, 16rem.

📑source

Flexbox

These entire flexbox module as utilities.

📑source

Typography

Font style, weight and size utilities. Font weight: normal, bold, 100 - 900. Font sizes are generated using a type scale.

const typeScale = {
  f1: 2, // * rem
  f2: 1.5, // * rem
  f3: 1.25, // * rem
  f4: 1, // * rem
  f5: 0.875, // * rem
  f6: 0.75, // * rem
};

📑source

In React Native lineHeight is not a multiplier. This makes it hard to create line height utilities. Instead you can create text components which have all the fontSize and lineHeight stylings. See text.js for an example.

Whitespace

Margin and padding utilities.

Padding
	base: p
	modifiers: h, v, t, r, b, l
	scale: 0, 1, 2, 3, 4, 5, 6

Margin
	base: m
	modifiers: h, v, t, r, b, l
	scale: 0, 1, 2, 3, 4, 5, 6

Example:
	mb1 = marginBottom: 0.5 * rem
	ph1 = paddingHorizontal: 4 * rem

📑source

Example

To run the example:

  • npm install
  • npm run dev:ios for iOS and npm run dev:android for Android.

Credits

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