1.3.0 • Published 4 years ago

@nfq/spacer v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@nfq/spacer

Table of Contents

Description: License: MIT

A simple component to help with spacing in coiponent based layout systems.

Installation:

To install the package run

npm install @nfq/spacer

if you are in yarn

yarn add @nfq/spacer

or on pnpm

pnpm install @nfq/spacer


PeerDependencies:

The following PeerDependencies are needed so the component does work:

  • core-decorators >= 0.20.0
  • prop-types >= 15
  • react >= 17
  • styled-components >= 5


Usage:

import {Component} from 'react';
import {Spacer} from '@nfq/spacer';

export default class App extends Component {
    render() {
        return (
            <Wrapper>
                <div>Content</div>
                <Spacer y={2}> {/* gives an vertical spacing of 10px or 1rem */}
                <div>Content2</div>
            </Wrapper>
        )
    }
}


Spacer Props:

ProptyperequiredDescription
isInlineBooleanTells the spacer if it should behave like an inline element (Good for in text spacings)
maxXNumberIf used in an flex container this defines the max horizontal spacing size. Wants an multiplication factor thats used with baseSpacing
maxYNumberIf used in an flex container this defines the max vertical spacing size. Wants an multiplication factor thats used with baseSpacing
xNumberDefines the horizontal spacing size. (In an flexbox it defines the base) Wants an multiplication factor thats used with baseSpacing
yNumberDefines the horizontal spacing size. (In an flexbox it defines the base) Wants an multiplication factor thats used with baseSpacing


Custom config

import {Component} from 'react';
import {ThemeProvider} from 'styled-components';

export default class App extends Component {
    render() {
        const customConf = {baseSpacing: 5};

        return (
            <ThemeProvider theme={{nfqspacer: customConf}}>
                <div>Content</div>
                <Spacer y={2}> {/* gives an vertical spacing of 10px or 1rem */}
                <div>Content2</div>
            </ThemeProvider>
        )
    }
}
ProptypedefaultDescription
baseSpacingNumber5The base spacing used to multiply in px


Contributions:

.NFQ | Christoph Kruppe



License:

The licence used is: MIT Click on licence badge for licence details: License: MIT



Questions:

If you have any furter questions please contact the following email address: email: c.kruppe@nfq.de

1.3.0

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.0

4 years ago