提交 a9bb8fd6f0a38b2c144712accd4e196dada2a9c3

作者 sorrycc
1 个父辈 7ffc8b4b

add layout holy grail

@@ -4,8 +4,8 @@ import { Row, Col } from 'antd'; @@ -4,8 +4,8 @@ import { Row, Col } from 'antd';
4 export default () => { 4 export default () => {
5 return ( 5 return (
6 <Row> 6 <Row>
7 - <Col span={12}>INSERT_BLOCK_PLACEHOLDER:Col 12</Col>  
8 - <Col span={12}>INSERT_BLOCK_PLACEHOLDER:Col 12</Col> 7 + <Col span={12} style={{ minHeight: '20px', background: '#fecccc' }}>INSERT_BLOCK_PLACEHOLDER:Col 12</Col>
  8 + <Col span={12} style={{ minHeight: '20px', background: '#82caff' }}>INSERT_BLOCK_PLACEHOLDER:Col 12</Col>
9 </Row> 9 </Row>
10 ); 10 );
11 } 11 }
  1 +{
  2 + "name": "圣杯布局",
  3 + "description": "包含简单的响应式。",
  4 + "block": {
  5 + "category": "布局"
  6 + }
  7 +}
  1 +import React from 'react';
  2 +import styles from './index.less';
  3 +
  4 +export default function() {
  5 + return (
  6 + <div className={styles.wrapper}>
  7 + <header>INSERT_BLOCK_PLACEHOLDER:HEADER</header>
  8 + <div className={styles.body}>
  9 + <main>INSERT_BLOCK_PLACEHOLDER:CONTENT</main>
  10 + <nav>INSERT_BLOCK_PLACEHOLDER:NAV</nav>
  11 + <aside>INSERT_BLOCK_PLACEHOLDER:ASIDE</aside>
  12 + </div>
  13 + <footer>INSERT_BLOCK_PLACEHOLDER:FOOTER</footer>
  14 + </div>
  15 + );
  16 +}
  1 +
  2 +.wrapper {
  3 + display: flex;
  4 + min-height: 100vh;
  5 + flex-direction: column;
  6 +
  7 + header, footer {
  8 + background: #82caff;
  9 + flex: 0 0 6em;
  10 + }
  11 +}
  12 +
  13 +.body {
  14 + display: flex;
  15 + flex: 1;
  16 + flex-direction: column;
  17 +
  18 + main {
  19 + flex: 1;
  20 + background: #fecccc;
  21 + }
  22 + aside, nav {
  23 + flex: 0 0 12em;
  24 + background: #c9c;
  25 + }
  26 + nav {
  27 + order: -1;
  28 + }
  29 +}
  30 +
  31 +@media (min-width: 768px) {
  32 + .body {
  33 + flex-direction: row;
  34 + }
  35 +}
注册登录 后发表评论