mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
2e4b9cb098
* site: use CSS logical properties * Update components/anchor/demo/targetOffset.tsx Co-authored-by: afc163 <afc163@gmail.com> Signed-off-by: lijianan <574980606@qq.com> * fix: fix * fix: fix * chore: fix * fix: add more * fix: add more * site: rewrite with CSS logical properties --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: afc163 <afc163@gmail.com>
80 lines
2.4 KiB
TypeScript
80 lines
2.4 KiB
TypeScript
import React, { useState } from 'react';
|
|
import type Icon from '@ant-design/icons';
|
|
import { LikeOutlined, MessageOutlined, StarOutlined } from '@ant-design/icons';
|
|
import { Avatar, List, Skeleton, Switch } from 'antd';
|
|
|
|
interface IconTextProps {
|
|
icon: typeof Icon;
|
|
text: React.ReactNode;
|
|
}
|
|
|
|
const listData = Array.from({ length: 3 }).map((_, i) => ({
|
|
href: 'https://ant.design',
|
|
title: `ant design part ${i + 1}`,
|
|
avatar: `https://api.dicebear.com/7.x/miniavs/svg?seed=${i}`,
|
|
description:
|
|
'Ant Design, a design language for background applications, is refined by Ant UED Team.',
|
|
content:
|
|
'We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.',
|
|
}));
|
|
|
|
const IconText: React.FC<IconTextProps> = ({ icon, text }) => (
|
|
<>
|
|
{React.createElement(icon, { style: { marginInlineEnd: 8 } })}
|
|
{text}
|
|
</>
|
|
);
|
|
|
|
const App: React.FC = () => {
|
|
const [loading, setLoading] = useState(true);
|
|
|
|
const onChange = (checked: boolean) => {
|
|
setLoading(!checked);
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<Switch checked={!loading} onChange={onChange} style={{ marginBottom: 16 }} />
|
|
<List
|
|
itemLayout="vertical"
|
|
size="large"
|
|
dataSource={listData}
|
|
renderItem={(item) => (
|
|
<List.Item
|
|
key={item.title}
|
|
actions={
|
|
!loading
|
|
? [
|
|
<IconText icon={StarOutlined} text="156" key="list-vertical-star-o" />,
|
|
<IconText icon={LikeOutlined} text="156" key="list-vertical-like-o" />,
|
|
<IconText icon={MessageOutlined} text="2" key="list-vertical-message" />,
|
|
]
|
|
: undefined
|
|
}
|
|
extra={
|
|
!loading && (
|
|
<img
|
|
width={272}
|
|
alt="logo"
|
|
src="https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLcXyDKnZfES.png"
|
|
/>
|
|
)
|
|
}
|
|
>
|
|
<Skeleton loading={loading} active avatar>
|
|
<List.Item.Meta
|
|
avatar={<Avatar src={item.avatar} />}
|
|
title={<a href={item.href}>{item.title}</a>}
|
|
description={item.description}
|
|
/>
|
|
{item.content}
|
|
</Skeleton>
|
|
</List.Item>
|
|
)}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|