mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-12 09:04:26 +02:00
Add same height columns
This commit is contained in:
36
client/layouts/same-height-columns/Cover.jsx
Normal file
36
client/layouts/same-height-columns/Cover.jsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
|
||||
import Frame from '../../placeholders/Frame';
|
||||
import Line from '../../placeholders/Line';
|
||||
import Square from '../../placeholders/Square';
|
||||
|
||||
const Cover = () => {
|
||||
return (
|
||||
<Frame>
|
||||
<div className="flex h-100 pa2">
|
||||
<div className="mh1" style={{ flex: 1 }}>
|
||||
<div className="w2 h2 mb1">
|
||||
<Square />
|
||||
</div>
|
||||
<div className="w-100 mb1"><Line /></div>
|
||||
<div className="w-100 mb1"><Line /></div>
|
||||
<div className="w-80 mb1"><Line /></div>
|
||||
<div className="w-60"><Line /></div>
|
||||
</div>
|
||||
<div className="mh1" style={{ flex: 1 }}>
|
||||
<div className="w2 h2 mb1">
|
||||
<Square />
|
||||
</div>
|
||||
<div className="w-100 mb1"><Line /></div>
|
||||
<div className="w-80 mb1"><Line /></div>
|
||||
<div className="w-60 mb2"><Line /></div>
|
||||
|
||||
<div className="w-100 mb1"><Line /></div>
|
||||
<div className="w-60"><Line /></div>
|
||||
</div>
|
||||
</div>
|
||||
</Frame>
|
||||
);
|
||||
};
|
||||
|
||||
export default Cover;
|
93
client/layouts/same-height-columns/Details.jsx
Normal file
93
client/layouts/same-height-columns/Details.jsx
Normal file
@@ -0,0 +1,93 @@
|
||||
import React from 'react';
|
||||
|
||||
import DetailsLayout from '../../DetailsLayout';
|
||||
import Block from '../../placeholders/Block';
|
||||
import BrowserFrame from '../../placeholders/BrowserFrame';
|
||||
import Rectangle from '../../placeholders/Rectangle';
|
||||
import SampleCode from '../../SampleCode';
|
||||
import useDocumentTitle from '../../useDocumentTitle';
|
||||
|
||||
const Details = () => {
|
||||
useDocumentTitle('CSS Layout ∙ Same height columns');
|
||||
|
||||
return (
|
||||
<DetailsLayout>
|
||||
<h1 className="f1 tc">Same height columns</h1>
|
||||
<BrowserFrame
|
||||
content={
|
||||
<div className="h-100 flex flex-column items-center justify-center pa3">
|
||||
<div className="flex h-100 w-100">
|
||||
<div className="b--black-20 ba br2 mh2 flex flex-column" style={{ flex: 1 }}>
|
||||
<Rectangle height={200} />
|
||||
<div className="pa3" style={{ flex: 1 }}>
|
||||
<Block numberOfBlocks={10} />
|
||||
</div>
|
||||
<div className="pa3 w4">
|
||||
<Rectangle height={32} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="b--black-20 ba br2 mh2 flex flex-column" style={{ flex: 1 }}>
|
||||
<Rectangle height={200} />
|
||||
<div className="pa3" style={{ flex: 1 }}>
|
||||
<div className="mb3"><Block numberOfBlocks={15} /></div>
|
||||
<Block numberOfBlocks={5} />
|
||||
</div>
|
||||
<div className="pa3 w4">
|
||||
<Rectangle height={32} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="b--black-20 ba br2 mh2 flex flex-column" style={{ flex: 1 }}>
|
||||
<Rectangle height={200} />
|
||||
<div className="pa3" style={{ flex: 1 }}>
|
||||
<div className="mb3"><Block numberOfBlocks={5} /></div>
|
||||
<Block numberOfBlocks={10} />
|
||||
</div>
|
||||
<div className="pa3 w4">
|
||||
<Rectangle height={32} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
source={
|
||||
<SampleCode
|
||||
lang="html"
|
||||
code={`
|
||||
<div style="display: flex;">
|
||||
<!-- Column -->
|
||||
<div style="
|
||||
flex: 1;
|
||||
/* Space between columns */
|
||||
margin: 0 8px;
|
||||
|
||||
/* Layout each column */
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
">
|
||||
<!-- Cover -->
|
||||
...
|
||||
|
||||
<!-- Content -->
|
||||
<div style="
|
||||
/* Take available height */
|
||||
flex: 1;
|
||||
">
|
||||
...
|
||||
</div>
|
||||
|
||||
<!-- Button sticks to the bottom -->
|
||||
...
|
||||
</div>
|
||||
|
||||
<!-- Repeat with other columns -->
|
||||
...
|
||||
</div>
|
||||
`}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</DetailsLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default Details;
|
Reference in New Issue
Block a user