Remove layout-fixed

This commit is contained in:
afc163 2016-02-25 16:48:03 +08:00
parent b4d4fb4d4a
commit 54db7ec32b
6 changed files with 38 additions and 69 deletions

View File

@ -1,15 +1,17 @@
import React from 'react';
import React, { PropTypes } from 'react';
import classNames from 'classnames';
const stringOrNumber = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
const Col = React.createClass({
propTypes: {
span: React.PropTypes.string,
order: React.PropTypes.string,
offset: React.PropTypes.string,
push: React.PropTypes.string,
pull: React.PropTypes.string,
className: React.PropTypes.string,
children: React.PropTypes.node,
span: stringOrNumber,
order: stringOrNumber,
offset: stringOrNumber,
push: stringOrNumber,
pull: stringOrNumber,
className: PropTypes.string,
children: PropTypes.node,
},
render() {
const { span, order, offset, push, pull, className, ...others } = this.props;
@ -19,7 +21,7 @@ const Col = React.createClass({
[`col-offset-${offset}`]: offset,
[`col-push-${push}`]: push,
[`col-pull-${pull}`]: pull,
[className]: className,
[className]: !!className,
});
return <div {...others} className={classes}>{ this.props.children }</div>;
},

View File

@ -2,7 +2,7 @@
- order: 1
栅格常常需要和间隔进行配合,我们推荐使用 `(16+8n)px` 作为栅格间隔。
栅格常常需要和间隔进行配合,你可以使用 `Row``gutter` 属性,我们推荐使用 `(16+8n)px` 作为栅格间隔。
---

View File

@ -1,30 +0,0 @@
# 响应式
- order: 7
支持 xs、sm、md、lg 四种屏幕大小的响应式设计配置。
---
````jsx
import { Row, Col } from 'antd';
ReactDOM.render(
<div className="gutter-example">
<Row gutter={16}>
<Col xs={0} xs={2} xs={4} lg={6}>
<div className="gutter-box">col</div>
</Col>
<Col xs={12} xs={10} xs={8} lg={6}>
<div className="gutter-box">col</div>
</Col>
<Col xs={12} xs={10} xs={8} lg={6}>
<div className="gutter-box">col</div>
</Col>
<Col xs={0} xs={10} xs={4} lg={6}>
<div className="gutter-box">col</div>
</Col>
</Row>
</div>
, mountNode);
````

View File

@ -79,6 +79,32 @@
Flex 布局是基于 24 栅格来定义每一个『盒子』的宽度,但排版则不拘泥于栅格。
## API
Ant Design 的布局组件暂不支持响应式设计和元素对齐等特性,若不能满足你的需求,你可以直接使用社区的优秀布局组件:
- [react-flexbox-grid](http://roylee0704.github.io/react-flexbox-grid/)
- [react-blocks](http://whoisandie.github.io/react-blocks/)
### Row
| 成员 | 说明 | 类型 | 默认值 |
|------------|-----------------|--------------------|-------------|
| gutter | 栅格间隔 | number | 0 |
| type | 布局模式,可选 `flex`,现代浏览器下有效 | string | |
| align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | string | `top` |
| justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | string | `start` |
### Col
| 成员 | 说明 | 类型 | 默认值 |
|------------|-----------------|--------------------|-------------|
| span | 栅格占位格数 | number | 0 |
| order | 栅格顺序,`flex` 布局模式下有效 | number | 0 |
| offset | 栅格左侧的间隔格数,间隔内不可以有栅格 | number | 0 |
| push | 栅格向右移动格数 | number | 0 |
| pull | 栅格向左移动格数 | number | 0 |
<style>
.demo-row {
background-image: linear-gradient(90deg, #F5F5F5 4.16666667%, transparent 4.16666667%, transparent 8.33333333%, #F5F5F5 8.33333333%, #F5F5F5 12.5%, transparent 12.5%, transparent 16.66666667%, #F5F5F5 16.66666667%, #F5F5F5 20.83333333%, transparent 20.83333333%, transparent 25%, #F5F5F5 25%, #F5F5F5 29.16666667%, transparent 29.16666667%, transparent 33.33333333%, #F5F5F5 33.33333333%, #F5F5F5 37.5%, transparent 37.5%, transparent 41.66666667%, #F5F5F5 41.66666667%, #F5F5F5 45.83333333%, transparent 45.83333333%, transparent 50%, #F5F5F5 50%, #F5F5F5 54.16666667%, transparent 54.16666667%, transparent 58.33333333%, #F5F5F5 58.33333333%, #F5F5F5 62.5%, transparent 62.5%, transparent 66.66666667%, #F5F5F5 66.66666667%, #F5F5F5 70.83333333%, transparent 70.83333333%, transparent 75%, #F5F5F5 75%, #F5F5F5 79.16666667%, transparent 79.16666667%, transparent 83.33333333%, #F5F5F5 83.33333333%, #F5F5F5 87.5%, transparent 87.5%, transparent 91.66666667%, #F5F5F5 91.66666667%, #F5F5F5 95.83333333%, transparent 95.83333333%);

View File

@ -1,24 +1,3 @@
// Layout
.layout-fixed {
.container-fixed();
@media (min-width: @screen-sm-min) {
width: @container-sm;
}
@media (min-width: @screen-md-min) {
width: @container-md;
}
@media (min-width: @screen-lg-min) {
width: @container-lg;
}
}
.layout-fluid {
.container-fixed()
}
// Grid system
.row {
.make-row();

View File

@ -1,13 +1,5 @@
// mixins for grid system
// ------------------------
.container-fixed(@gutter: @grid-gutter-width) {
margin-right: auto;
margin-left: auto;
padding-left: (@gutter / 2);
padding-right: (@gutter / 2);
&:extend(.clearfix all);
}
.make-row(@gutter: @grid-gutter-width) {
position: relative;
margin-left: (@gutter / -2);