1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-06 14:16:50 +02:00

Add simple grid

This commit is contained in:
Phuoc Nguyen
2019-11-22 11:08:05 +07:00
parent 0fff6299f9
commit a9f65f43cc
4 changed files with 161 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import ProgressBar from './layouts/progress-bar/Details';
import SameHeightColumns from './layouts/same-height-columns/Details';
import Separator from './layouts/separator/Details';
import Sidebar from './layouts/sidebar/Details';
import SimpleGrid from './layouts/simple-grid/Details';
import Slider from './layouts/slider/Details';
import SplitScreen from './layouts/split-screen/Details';
import StepperInput from './layouts/stepper-input/Details';
@@ -55,6 +56,7 @@ const App = () => {
<Route exact={true} path='/same-height-columns'><SameHeightColumns /></Route>
<Route exact={true} path='/separator'><Separator /></Route>
<Route exact={true} path='/sidebar'><Sidebar /></Route>
<Route exact={true} path='/simple-grid'><SimpleGrid /></Route>
<Route exact={true} path='/slider'><Slider /></Route>
<Route exact={true} path='/split-screen'><SplitScreen /></Route>
<Route exact={true} path='/stepper-input'><StepperInput /></Route>

View File

@@ -21,6 +21,7 @@ import ProgressBarCover from './layouts/progress-bar/Cover';
import SameHeightColumnsCover from './layouts/same-height-columns/Cover';
import SeparatorCover from './layouts/separator/Cover';
import SidebarCover from './layouts/sidebar/Cover';
import SimpleGridCover from './layouts/simple-grid/Cover';
import SliderCover from './layouts/slider/Cover';
import SplitScreenCover from './layouts/split-screen/Cover';
import StepperInputCover from './layouts/stepper-input/Cover';
@@ -217,6 +218,12 @@ const Home = () => {
<h4 className="f5 mv0 pt3">Separator</h4>
</Link>
</div>
<div className="pa1 w-20">
<Link to="/simple-grid" className="link flex flex-column items-center justify-center tc hover-bg-black-10 br2 pa3">
<SimpleGridCover />
<h4 className="f5 mv0 pt3">Simple grid</h4>
</Link>
</div>
<div className="pa1 w-20">
<Link to="/slider" className="link flex flex-column items-center justify-center tc hover-bg-black-10 br2 pa3">
<SliderCover />

View File

@@ -0,0 +1,31 @@
import React from 'react';
import Frame from '../../placeholders/Frame';
import Rectangle from '../../placeholders/Rectangle';
const Cover = () => {
return (
<Frame>
<div className="h-100 flex flex-column items-center justify-center">
<div className="w-80">
<div className="flex items-center mb1">
<div className="ph1" style={{ flex: '0 0 50%' }}><Rectangle /></div>
<div className="ph1" style={{ flex: '1' }}><Rectangle /></div>
</div>
<div className="flex items-center mb1">
<div className="ph1" style={{ flex: '0 0 33%' }}><Rectangle /></div>
<div className="ph1" style={{ flex: '0 0 33%' }}><Rectangle /></div>
<div className="ph1" style={{ flex: '0 0 33%' }}><Rectangle /></div>
</div>
<div className="flex items-center">
<div className="ph1" style={{ flex: '0 0 25%' }}><Rectangle /></div>
<div className="ph1" style={{ flex: '1' }}><Rectangle /></div>
<div className="ph1" style={{ flex: '0 0 25%' }}><Rectangle /></div>
</div>
</div>
</div>
</Frame>
);
};
export default Cover;

View File

@@ -0,0 +1,121 @@
import React from 'react';
import DetailsLayout from '../../DetailsLayout';
import BrowserFrame from '../../placeholders/BrowserFrame';
import Rectangle from '../../placeholders/Rectangle';
import SampleCode from '../../SampleCode';
const Details = () => {
return (
<DetailsLayout title="Simple grid">
<BrowserFrame
content={
<div className="h-100 flex flex-column items-center justify-center">
<div className="w-60">
<div className="flex" style={{ margin: '0 -8px 8px -8px' }}>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
</div>
<div className="flex" style={{ margin: '0 -8px 32px -8px' }}>
<div className="ph2" style={{ flex: '0 0 50%' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
</div>
<div className="flex" style={{ margin: '0 -8px 8px -8px' }}>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
</div>
<div className="flex" style={{ margin: '0 -8px 32px -8px' }}>
<div className="ph2" style={{ flex: '0 0 33.3333%' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
</div>
<div className="flex" style={{ margin: '0 -8px 8px -8px' }}>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
</div>
<div className="flex" style={{ margin: '0 -8px 0 -8px' }}>
<div className="ph2" style={{ flex: '0 0 25%' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '1' }}>
<Rectangle height={32} />
</div>
<div className="ph2" style={{ flex: '0 0 33.3333%' }}>
<Rectangle height={32} />
</div>
</div>
</div>
</div>
}
source={
<SampleCode
lang="html"
code={`
<!-- Row -->
<div style="
display: flex;
margin-left: -8px;
margin-right: -8px;
">
<!--Cell with given width. Replace 25% with whatever you want -->
<div style="
flex: 0 0 25%;
padding-left: 8px;
padding-right: 8px;
">25%</div>
<!-- Cell that takes remaining width -->
<div style="
flex: 1;
padding-left: 8px;
padding-right: 8px;
">
...
</div>
</div>
`}
/>
}
/>
</DetailsLayout>
);
};
export default Details;