1.2.2 • Published 4 months ago

midnight-shadow v1.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

Small, simple set of React UI components

Based on Rebass these components can be used in React projects with styled components.

How it works

First, install the package:

npm i midnight-shadow

import React from 'react'
import { Flex, Box, Text } from 'midnight-shadow'
 
export default props =>
  <Box width={["100%", "50%", "33%"]}>
    <Text mb="20px" textAlign="center">Hello</Text>
    <Flex bg="#bbeeff" p="10px" justifyContent="center" alignItems="center>Friend</Flex>
  </Box>

What it looks like

There are three UI components: Flex, Box, and Text

Which mostly work like the Rebass versions:

Prop nameCSS val
width'width'
height'height'
minHeight'min-height'
maxHeight'max-height'
minWidth'min-width'
maxWidth'max-width'
px'padding-left'
px'padding-right'
py'padding-top'
py'padding-bottom'
pt'padding-top'
pb'padding-bottom'
pl'padding-left'
pr'padding-right'
m'margin'
mx'margin-left'
mx'margin-right'
my'margin-top'
my'margin-bottom'
mt'margin-top'
mb'margin-bottom'
ml'margin-left'
mr'margin-right'
bg'background'
position'position'
borderRadius'border-radius'
textAlign'text-align'
textTransform'text-transform'
textDecoration'text-decoration'
flex'flex'
flexDirection'flex-direction'
flexWrap'flex-wrap'
justifyContent'justify-content'
alignItems'align-items'
alignContent'align-content'
fontFamily'font-family'
fontSize'font-size'
fontWeight'font-weight'
lineHeight'line-height'
letterSpacing'letter-spacing'
color'color'
sxgeneral styles

Breakpoints

Each prop takes either a string or an array of strings. Arrays are used for breakpoints:

const breakpoints = {
  sm: '576px',
  md: '768px',
  lg: '992px',
}

eg.,

<Box mx={["30px", "50px", "100px"]}>...</Box>

General styles

General styles can be added like below:

<Text sx={{'letter-spacing': '0.02rem'}}>...</Text>

You can also pass an array of values for breakpoints into general styles like so:

<Text fontSize={['32px', '44px', '64px']} sx={{'letter-spacing': ['0', '0.01rem', '0.02rem']}}>...</Text>

HTML tags

You can pass an as prop through each Ui component

<Text as="h1">...</Text>
<Flex as="nav">...</Flex>
<Box as="section">...</Box>
1.2.2

4 months ago

1.2.0

4 months ago

1.2.1

4 months ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago