-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added row component - added col component - available lg, md, sm, and xs
- Loading branch information
Showing
10 changed files
with
143 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Style utils of grid, row and col | ||
import styled, { css } from "styled-components"; | ||
import { MaxWidth } from "../../../styles/utils"; | ||
import { RowProps, ColProps } from "./interface"; | ||
|
||
const GridWrapper = styled.div<RowProps>` | ||
display: flex; | ||
justify-content: left; | ||
flex-wrap: wrap; | ||
margin-left: -16px; | ||
margin-right: -16px; | ||
${props => | ||
props.align && | ||
css` | ||
align-items: ${props.align}; | ||
`}; | ||
${props => | ||
props.justify && | ||
css` | ||
justify-content: ${props.justify}; | ||
`}; | ||
${props => | ||
props.text && | ||
css` | ||
text-align: ${props.text}; | ||
`}; | ||
`; | ||
|
||
const ColWrapper = styled.div<ColProps>` | ||
padding: 8px 16px; | ||
${props => | ||
props.lg && | ||
css` | ||
display: inline-block; | ||
flex-basis: unset; | ||
width: ${props.lg ? `${(props.lg / 12) * 100}%` : null}; | ||
${props.lg === "hidden" && | ||
css` | ||
display: none; | ||
`}; | ||
}; | ||
`}; | ||
${props => | ||
props.md && | ||
css` | ||
${MaxWidth.md` | ||
display: inline-block; | ||
flex-basis: unset; | ||
width: ${props.md ? `${(props.md / 12) * 100}%` : null}; | ||
${props.md === "hidden" && | ||
css` | ||
display: none; | ||
`}; | ||
`}; | ||
`}; | ||
${props => | ||
props.sm && | ||
css` | ||
${MaxWidth.sm` | ||
display: inline-block; | ||
flex-basis: unset; | ||
width: ${props.sm ? `${(props.sm / 12) * 100}%` : null}; | ||
${props.sm === "hidden" && | ||
css` | ||
display: none; | ||
`}; | ||
`}; | ||
`}; | ||
${props => | ||
props.xs && | ||
css` | ||
${MaxWidth.xs` | ||
display: inline-block; | ||
flex-basis: unset; | ||
width: ${props.xs ? `${(props.xs / 12) * 100}%` : null}; | ||
${props.xs === "hidden" && | ||
css` | ||
display: none; | ||
`}; | ||
`}; | ||
`}; | ||
`; | ||
|
||
export { GridWrapper, ColWrapper }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Lib grid component | ||
import React from "react"; | ||
import { RowProps, ColProps } from "./interface"; | ||
import { GridWrapper, ColWrapper } from "./Styled"; | ||
|
||
const Row: React.FC<RowProps> = ({ justify, align, text, children }) => { | ||
return ( | ||
<GridWrapper justify={justify} align={align} text={text}> | ||
{children} | ||
</GridWrapper> | ||
); | ||
}; | ||
|
||
const Col: React.FC<ColProps> = ({ lg, md, sm, xs, children }) => ( | ||
<ColWrapper lg={lg} md={md} sm={sm} xs={xs}> | ||
{children} | ||
</ColWrapper> | ||
); | ||
|
||
export { Row, Col }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// interface of grid for row and col utils | ||
export interface RowProps { | ||
justify?: string; | ||
align?: string; | ||
text?: string; | ||
} | ||
|
||
export interface ColProps { | ||
lg?: any; | ||
md?: any; | ||
sm?: any; | ||
xs?: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters