Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Layout manager not to give margins to components

NotificationsYou must be signed in to change notification settings

osamu38/react-layout-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Layout manager not to give margins to components

Table of Contents

Installation

To install, you can usenpm oryarn:

$ npm install -S react-layout-manager$ yarn add react-layout-manager

Usage

Example:

importRLMfrom'react-layout-manager';functionEmail(){constEmailStyle={width:[100,'100%'],horizontalSpace:5,responsive:[{breakpoint:480,settings:{wrap:true,wrapVerticalSpace:5,},},],};constEmailInnerStyle={width:['65%',16,'35%'],horizontalSpace:5,};return(<RLM{...EmailStyle}><Label>Email</Label><RLM{...EmailInnerStyle}><Inputplaceholder="react-layout-manager"/><Unit>@</Unit><Inputplaceholder="gmail.com"/></RLM></RLM>);}

Props

PropsTypeDefault ValueDescription
horizontalSpacestring | number | Array<string | number>0Horizontal space of element and element
verticalSpacestring | number | Array<string | number>0Vertical space of element and element
wrapVerticalSpacestring | number | Array<string | number>0Vertical space of element and element when wrap
widthstring | number | Array<string | number>nullWidth of elements
innerWidthstring | number | Array<string | number>nullWidth in element
verticalAlignstring | number | Array<string | number>nullVertical align
align'left' | 'center' | 'right' | Array<'left' | 'center' | 'right'>nullAlign inner element
visibleboolean | Array<boolean>trueWhether the elements are displayed or not
wrapbooleanfalseWhether to wrap or not

responsive property

Array of objects in the form of{ breakpoint: int, settings: { ... } } The breakpointnumber is themaxWidth so the settings will be applied when resolution is below this value.Example:[ { breakpoint: 1024, settings: { wrap: true, width: ['20%', 100, '80%'] } }, { breakpoint: 768, settings: { visible: false } }]

Examples

Demo Source:

importReact,{Component}from'react';importstyledfrom'styled-components';importRLMfrom'react-layout-manager';constInput=styled.input`  ...`;constUnit=styled.div`  ...`;constLabel=styled.div`  ...`;functionEmail(){constEmailStyle={width:[100,'100%'],horizontalSpace:5,responsive:[{breakpoint:480,settings:{wrap:true,wrapVerticalSpace:5,},},],};constEmailInnerStyle={width:['65%',16,'35%'],horizontalSpace:5,};return(<RLM{...EmailStyle}><Label>Email</Label><RLM{...EmailInnerStyle}><Inputplaceholder="react-layout-manager"/><Unit>@</Unit><Inputplaceholder="gmail.com"/></RLM></RLM>);}functionTel(){constTelStyle={width:[100,160],horizontalSpace:5,responsive:[{breakpoint:480,settings:{width:'100%',wrap:true,wrapVerticalSpace:5,},},],};return(<RLM{...TelStyle}><Label>Tel</Label><Inputplaceholder="090XXXXXXXX"/></RLM>);}functionPassword(){constPasswordStyle={width:[100,240],horizontalSpace:5,responsive:[{breakpoint:480,settings:{width:'100%',wrap:true,wrapVerticalSpace:5,},},],};return(<RLM{...PasswordStyle}><Label>Password</Label><Inputplaceholder="rEaCtLaYoUtMaNaGeR"/></RLM>);}functionBirthday(){constBirthdayStyle={width:[100,'100%'],horizontalSpace:5,responsive:[{breakpoint:480,settings:{wrap:true,wrapVerticalSpace:5,},},],};constBirthdayInnerStyle={width:[56,16,44,16,44],horizontalSpace:5,responsive:[{breakpoint:480,settings:{width:['40%',16,'30%',16,'30%'],},},],};return(<RLM{...BirthdayStyle}><Label>Birthday</Label><RLM{...BirthdayInnerStyle}><Inputplaceholder="YYYY"/><Unit></Unit><Inputplaceholder="MM"/><Unit></Unit><Inputplaceholder="DD"/></RLM></RLM>);}functionPostalCode(){constPostalCodeStyle={width:[100,'100%'],horizontalSpace:5,responsive:[{breakpoint:480,settings:{wrap:true,wrapVerticalSpace:5,},},],};constPostalCodeInnerStyle={width:[64,16,80],horizontalSpace:5,responsive:[{breakpoint:480,settings:{width:['50%',16,'50%']},},],};return(<RLM{...PostalCodeStyle}><Label>PostalCode</Label><RLM{...PostalCodeInnerStyle}><Inputplaceholder="XXX"/><Unit></Unit><Inputplaceholder="XXXX"/></RLM></RLM>);}functionCardNumber(){constCardNumberStyle={width:[100,'100%'],horizontalSpace:5,responsive:[{breakpoint:480,settings:{wrap:true,wrapVerticalSpace:5,},},],};constCardNumberInnerStyle={width:['50%',16,'50%'],horizontalSpace:5,wrapVerticalSpace:10,responsive:[{breakpoint:480,settings:{width:['100%',null,'100%'],wrap:true,visible:[true,false,true],},},],};constCardNumberCellStyle={width:['50%',16,'50%'],horizontalSpace:5,};return(<RLM{...CardNumberStyle}><Label>CardNumber</Label><RLM{...CardNumberInnerStyle}><RLM{...CardNumberCellStyle}><Inputplaceholder="XXXX"/><Unit></Unit><Inputplaceholder="XXXX"/></RLM><Unit></Unit><RLM{...CardNumberCellStyle}><Inputplaceholder="XXXX"/><Unit></Unit><Inputplaceholder="XXXX"/></RLM></RLM></RLM>);}functionMain(){constMainStyle={width:'100%',verticalSpace:10,innerWidth:500,align:'center',};return(<RLM{...MainStyle}><Email/><Tel/><Password/><Birthday/><PostalCode/><CardNumber/></RLM>);}classAppextendsComponent{render(){return(<Main/>);}}exportdefaultApp;

Demos

About

Layout manager not to give margins to components

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp