ant-design/components/page-header/demo/responsive.md
dependabot[bot] 775d1800bb
chore(deps-dev): bump eslint-config-prettier from 6.15.0 to 7.0.0 (#28253)
* chore(deps-dev): bump eslint-config-prettier from 6.15.0 to 7.0.0

Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.15.0 to 7.0.0.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-config-prettier/compare/v6.15.0...v7.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* chore: fix eslint style

* chore: prettier code style

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: afc163 <afc163@gmail.com>
2020-12-09 17:12:32 +08:00

118 lines
2.5 KiB
Markdown

---
order: 6
iframe: 228
title:
zh-CN: 响应式
en-US: responsive
---
## zh-CN
在不同大小的屏幕下,应该有不同的表现
## en-US
Under different screen sizes, there should be different performance
```jsx
import { PageHeader, Tabs, Button, Statistic, Descriptions } from 'antd';
const { TabPane } = Tabs;
const renderContent = (column = 2) => (
<Descriptions size="small" column={column}>
<Descriptions.Item label="Created">Lili Qu</Descriptions.Item>
<Descriptions.Item label="Association">
<a>421421</a>
</Descriptions.Item>
<Descriptions.Item label="Creation Time">2017-01-10</Descriptions.Item>
<Descriptions.Item label="Effective Time">2017-10-10</Descriptions.Item>
<Descriptions.Item label="Remarks">
Gonghu Road, Xihu District, Hangzhou, Zhejiang, China
</Descriptions.Item>
</Descriptions>
);
const extraContent = (
<div
style={{
display: 'flex',
width: 'max-content',
justifyContent: 'flex-end',
}}
>
<Statistic
title="Status"
value="Pending"
style={{
marginRight: 32,
}}
/>
<Statistic title="Price" prefix="$" value={568.08} />
</div>
);
const Content = ({ children, extra }) => (
<div className="content">
<div className="main">{children}</div>
<div className="extra">{extra}</div>
</div>
);
ReactDOM.render(
<>
<PageHeader
className="site-page-header-responsive"
onBack={() => window.history.back()}
title="Title"
subTitle="This is a subtitle"
extra={[
<Button key="3">Operation</Button>,
<Button key="2">Operation</Button>,
<Button key="1" type="primary">
Primary
</Button>,
]}
footer={
<Tabs defaultActiveKey="1">
<TabPane tab="Details" key="1" />
<TabPane tab="Rule" key="2" />
</Tabs>
}
>
<Content extra={extraContent}>{renderContent()}</Content>
</PageHeader>
</>,
mountNode,
);
```
<style>
tr:last-child td {
padding-bottom: 0;
}
.ant-statistic-content {
font-size: 20px;
line-height: 28px;
}
#components-page-header-demo-responsive .content {
display: flex;
}
@media (max-width: 576px) {
#components-page-header-demo-responsive .content {
display: block;
}
#components-page-header-demo-responsive .main {
width: 100%;
margin-bottom: 12px;
}
#components-page-header-demo-responsive .extra {
width: 100%;
margin-left: 0;
text-align: left;
}
}
</style>