1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-12 00:54:45 +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

@@ -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;