1.1.1 • Published 3 months ago

react-layouter v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

React-Layouter

CI npm version code style: prettier npm bundle size types included

Is a component that give us the use of the library Layouter.js in React JS.

🔧 Installation

npm install layouter.js react-layouter
// o
yarn add layouter.js react-layouter

✨ How Use It?

  1. First we have to init the library, with the <Provider>, there if where we can declare the configuration:
import { Provider } from 'react-layouter';
import App from './App';

const layouterConfig = {
  // Here we can add the configuration of the library
  // I mean: los breakpoints, the prefix, etc
};

<Provider config={layouterConfig}>
  <App />
</Provider>;

Is require to be in root, so that I feed the whole application.

  1. Second and finally, you have to use the component <Box> where you want, in other component for example:
import { Box } from 'react-layouter';

const App = () => {
  return (
    <Box w="100" h={100} c="13/15" as="main">
      content
    </Box>
  );
};

export default App;

That's it!, that is all of we have to do to use the layouter in React. Just use the component Box wherever you want.

🚀 Demo

⚡ Directives

Are practically the same of the library, just the names was changed from kebab-case to camelCase, let see:

NameAliasExamplesDescription
asasas="span", as="p"Define the html tag that will be rendered
Colsccols="13/15", c="5/10"Determines the columns, that is, the 'width' as a percentage.
ddisplayd="bl", display="inline"Determines the display that the node will have.
Martmt, margin-topmart="10", mt="20", margin-top="12"Determines the top margin of a node.
Marrmr, margin-rightmarr="2/15", mr="5/10", margin-right="3/5"Determine the right margin of a node.
Marbmb, margin-bottommarb="30", mb="50", margin-bottom="25"Determine the bottom margin of a node.
Marlml, margin-leftmarl="3/15", ml="5/10", margin-left="3/5"Determine the left margin of a node.
Marm, marginmar="20-2/15-30-3/15", m="20-2/15-30-3/15", margin="20-2/15-30-3/15"It is a shorthand of the directives: mart, marr, marb, y marl.
Marymy, margin-ymary="10", my="20", margin-y="30"Determine the top and bottom margin of a node.
Marxmx, maring-xmarx="10", mx="20", margin-x="30"Determine the right and left margin at the same time of a node.
Padtpt, padding-toppadt="10", pt="20", padding-top="30"Determine the top padding of a node.
Padrpr, padding-rightpadr="2/15", pr="3/16", padding-right="4/17"Determine the padding right of a node.
Padbpb, padding-bottompadb="30", pb="40", padding-bottom="50"Determine the bottom padding of a node.
Padlpl, padding-leftpadl="3/15", pl="4/16", padding-left="5/17"Determine the left padding of a node.
Padp, paddingpad="20-2/15-30-3/15", p="20-2/15-30-3/15", padding="20-2/15-30-3/15"It is a shorthand of the directives: padt, padr, padb, y padl.
Padypy, padding-ypady="10", py="20", padding-y="30"Determine the padding top and bottom than the same time of a node.
Padxpx, padding-xpadx="10", px="20", padding-x="30Determine the right and left padding at the same time of a node.
Flexfxflex="jc:ce ai:fs fd:co", flex="jc:fe ai:fs, fx="align-items:center flex-wrap:wrap"Determine the display Flex of the node and its derivatives.
Wdhw, widthwdh="100", w="200", width="300"Determine the width of the node in pixels or other unit of measure.
Hgth, heighthgt="100", h="200", height="300"Determine the height of the node in pixels or other unit of measure.
Mxwmax-widthmxw="200", max-width="300"Determine the maximum width of the node in pixels or other unit of measure.
Mxhmax-heightmxh="200", max-height="300"Determine the maximum height of the node in pixels or other unit of measure.
Miwmin-widthmiw="300", min-width="400"Determine the minimum width of the node in pixels or other unit of measure.
Mihmin-heightmih="300", min-height="400"Determine the high height of the node in pixels or other unit of measure.
Pospositionpos="re", position="relative"Determine the position of node.
Ttopt="10", top="20"Determine the top of the node in pixels or other unit of measure.
Rrightr="10", right="20"Determine the right of the node in pixels or other unit of measure.
Bbottomb="10", bottom="20"Determine the bottom of the node in pixels or other unit of measure.
Lleftl="10", left="20"Determine the left of the node in pixels or other unit of measure.

📚 ¿Where I can get help?

Exist a extensive documentation here: DOCS.md.

🧾 Licence

The code and the documentation is under the Licence MIT.