Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
styled-bootstrap-grid
Advanced tools
This module is based on the styled-components module.
This module is highly inspired by the awesome work done on the react-bootstrap module.
This module is also based on the Twitter Bootstrap v4.0.0-alpha.6 layout CSS. The css provided to styled components is not mine.
For more information about how does this grid system works (I mean with classes like containers, row, col, offset, push) , please refer to the official Twitter Bootstrap layout documentation.
npm i -S styled-bootstrap-grid
Bootstrap is developed mobile first, a strategy in which we optimize code for mobile devices first and then scale up components as necessary using CSS media queries. To ensure proper rendering and touch zooming for all devices, add the responsive viewport meta tag to your .
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
You also must include these css lines in your head
to make it work :
@-ms-viewport {
width: device-width;
}
html {
-webkit-box-sizing: border-box;
box-sizing: border-box;
-ms-overflow-style: scrollbar;
}
*,
*::before,
*::after {
-webkit-box-sizing: inherit;
box-sizing: inherit;
}
import React from 'react';
import { Container, Row, Col } from 'styled-bootstrap-grid';
export default (props) => {
<Whatever>
<Container>
<Row>
<Col xl="1" lg="2" md="3" sm="12">
Hello Bootstrap Layout
</Col>
</Row>
</Container>
<Container fluid>
<Row>
<Col xl={1} xlOffset={4}>
Hello Bootstrap Fluid Layout
</Col>
</Row>
</Container>
</Whatever>
}
This packages also exposes the media
element. It can be used in your styled-components like this :
import React from 'react';
import styled from 'styled-components';
import { media } from 'styled-bootstrap-grid';
const CustomDiv = styled.div`
color: black;
${media.phone`
color: blue;
`}
${media.tablet`
color: red;
`}
${media.desktop`
color: purple;
`}
${media.giant`
color: yellow;
`}
`;
export default CustomDiv;
Using this media
object will help you to build media-queries that will fit the same way as Bootstrap do.
name | css generated |
---|---|
phone | @media (min-width: 576px) { /* */ } |
tablet | @media (min-width: 768px) { /* */ } |
desktop | @media (min-width: 992px) { /* */ } |
giant | @media (min-width: 1200px) { /* */ } |
props | default | type | description |
---|---|---|---|
fluid | false | boolean | Equivalent to container and container-fluid |
Plus the ones inherited from styled-components div . |
Row
element has no props, except the ones inherited from styled-components div
.
props | default | type | description |
---|---|---|---|
sm | 0 | number or string | Goes from 1 to 12. Equivalent to col-sm-* |
smOffset | 0 | number or string | Goes from 1 to 11. Equivalent to offset-sm-* |
smPush | 0 | number or string | Goes from 1 to 11. Equivalent to push-sm-* |
md | 0 | number or string | Goes from 1 to 12. Equivalent to col-md-* |
mdOffset | 0 | number or string | Goes from 1 to 11. Equivalent to offset-md-* |
mdPush | 0 | number or string | Goes from 1 to 11. Equivalent to push-md-* |
lg | 0 | number or string | Goes from 1 to 12. Equivalent to col-lg-* |
lgOffset | 0 | number or string | Goes from 1 to 11. Equivalent to offset-lg-* |
lgPush | 0 | number or string | Goes from 1 to 11. Equivalent to push-lg-* |
xl | 0 | number or string | Goes from 1 to 12. Equivalent to col-xl-* |
xlOffset | 0 | number or string | Goes from 1 to 11. Equivalent to offset-xl-* |
xlPush | 0 | number or string | Goes from 1 to 11. Equivalent to push-xl-* |
Plus the ones inherited from styled-components div . |
Because the module is meant to become 100% cssless, I must :
<meta />
head element.FAQs
bootstrap grid system using styled components
The npm package styled-bootstrap-grid receives a total of 9,464 weekly downloads. As such, styled-bootstrap-grid popularity was classified as popular.
We found that styled-bootstrap-grid demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.