1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-09 07:36:30 +02:00

Add holy grail layout

This commit is contained in:
Phuoc Nguyen
2019-11-16 23:48:22 +07:00
parent 2f1fe67f2a
commit 365808afcc
2 changed files with 89 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Home from './Home';
import Badge from './layouts/Badge';
import Centering from './layouts/Centering';
import HolyGrail from './layouts/HolyGrail';
import InputAddon from './layouts/InputAddon';
import MediaObject from './layouts/MediaObject';
import Sidebar from './layouts/Sidebar';
@@ -18,6 +19,7 @@ const App = () => {
<Route exact={true} path='/'><Home /></Route>
<Route exact={true} path='/badge'><Badge /></Route>
<Route exact={true} path='/centering'><Centering /></Route>
<Route exact={true} path='/holy-grail'><HolyGrail /></Route>
<Route exact={true} path='/input-add-on'><InputAddon /></Route>
<Route exact={true} path='/media-object'><MediaObject /></Route>
<Route exact={true} path='/sidebar'><Sidebar /></Route>

View File

@@ -0,0 +1,87 @@
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 HolyGrail = () => {
useDocumentTitle('CSS Layout ∙ Holy grail');
return (
<DetailsLayout>
<h1 className="f1 tc">Holy grail</h1>
<BrowserFrame
content={
<div className="h-100 flex flex-column">
<div className="flex-shrink-0 bb b--black-30 pa3">
<div className="w-50"><Rectangle /></div>
</div>
<div className="flex-grow-1 flex flex-row">
<div className="b--black-30 br pa3 w-25">
<Block numberOfBlocks={10} />
</div>
<div className="pa3 flex-auto">
<Block numberOfBlocks={20} />
</div>
<div className="b--black-30 bl pa3 w-20">
<Block numberOfBlocks={5} />
</div>
</div>
<div className="flex-shrink-0 bt b--black-30 pa3">
<div className="w-40"><Rectangle /></div>
</div>
</div>
}
source={
<SampleCode
lang="html"
code={`
<div style="
display: flex;
flex-direction: column;
">
<header>
...
</header>
<main style="
/* Take the remaining height */
flex-grow: 1;
/* Layout the left sidebar, main content and right sidebar */
display: flex;
flex-direction: row;
">
<!-- Left sidebar -->
<aside style="
width: 25%;
">...</aside>
<!-- Main content -->
<article style="
/* Take the remaining width */
flex-grow: 1;
">
...
</article>
<!-- Right sidebar -->
<nav style="
width: 20%;
">...</nav>
</main>
<footer>
...
</footer>
</div>
`}
/>
}
/>
</DetailsLayout>
);
};
export default HolyGrail;