รายละเอียดสำหรับเรียนรู้ React ปี 2020-2023 โดยโค้ชพล ดูหลักสูตรได้ที่ https://www.nextflow.in.th/react-training
เปิดไฟล์ src/App.js
เราจะทำการ import Row
และ Col
component จาก antd
import { Row, Col } from 'antd';
จากนั้นเราจะกำหนด grid layout ในส่วน content ของ App component
return (
<div>
<Layout className="layout">
<MenuBar />
<Content style=>
<div
style=>
{/* กำหนด layout 3 ช่วง */}
<Row>
<Col span={8}>col-8</Col>
<Col span={8}>col-8</Col>
<Col span={8}>col-8</Col>
</Row>
</div>
</Content>
<Footer style=>React Redux Workshop ©2012-2020 Created by Nextflow.in.th</Footer>
</Layout>,
</div>
);
เราจะทำการ import Card
component มาจาก antd
import { Card } from 'antd';
จากนั้นจะวาง Card 3 ตัวลงไปใน Column แต่ละช่อง
<Row>
{/* กำหนด margin left ของ column เป็น 10 */}
<Col span={8} style=>
{/* กำหนด property ชื่อ title และ loading */}
<Card title="จำนวนผู้ติดเชื้อ" loading={true}>
<p>0 คน</p>
</Card>
</Col>
{/* กำหนด margin left ของ column เป็น 10 */}
<Col span={8} style=>
<Card title="จำนวนป่วยที่หายดีแล้ว" loading={true}>
<p>0 คน</p>
</Card>
</Col>
{/* กำหนด margin left และ margin top ของ column เป็น 10 */}
<Col span={8} style=>
<Card title="จำนวนผู้เสียชีวิต" loading={true}>
<p>0 คน</p>
</Card>
</Col>
</Row>