-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from Tencent/fix/avatar/demo
feat(avatar): update demo
- Loading branch information
Showing
7 changed files
with
178 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { Avatar } from 'tdesign-mobile-react'; | ||
import { UserAddIcon } from 'tdesign-icons-react'; | ||
|
||
const imageList = [ | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_1.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_2.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_3.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_4.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_5.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_1.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_2.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_3.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_4.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_5.png', | ||
]; | ||
|
||
export default function AvatarTypeDemo() { | ||
return ( | ||
<> | ||
<div className="avatar-group-demo"> | ||
<Avatar.Group | ||
cascading="left-up" | ||
max={5} | ||
size="small" | ||
collapseAvatar={<UserAddIcon style={{ fontSize: '16px' }} />} | ||
> | ||
{imageList.map((url, idx) => ( | ||
<Avatar key={idx} shape="circle" image={url} /> | ||
))} | ||
</Avatar.Group> | ||
</div> | ||
<div className="avatar-group-demo"> | ||
<Avatar.Group | ||
cascading="left-up" | ||
max={5} | ||
size="40px" | ||
collapseAvatar={<UserAddIcon style={{ fontSize: '20px' }} />} | ||
> | ||
{imageList.map((url, idx) => ( | ||
<Avatar key={idx} shape="circle" image={url} /> | ||
))} | ||
</Avatar.Group> | ||
</div> | ||
<div className="avatar-group-demo"> | ||
<Avatar.Group cascading="left-up" max={5} collapseAvatar={<UserAddIcon style={{ fontSize: '24px' }} />}> | ||
{imageList.map((url, idx) => ( | ||
<Avatar key={idx} shape="circle" image={url} /> | ||
))} | ||
</Avatar.Group> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import { Avatar } from 'tdesign-mobile-react'; | ||
|
||
const imageList = [ | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_1.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_2.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_3.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_4.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_5.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_1.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_2.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_3.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_4.png', | ||
'https://tdesign.gtimg.com/mobile/demos/avatar_5.png', | ||
]; | ||
|
||
export default function AvatarTypeDemo() { | ||
return ( | ||
<> | ||
<div className="avatar-group-demo"> | ||
<Avatar.Group cascading="right-up" max={5} size="small"> | ||
{imageList.map((url, idx) => ( | ||
<Avatar key={idx} shape="circle" image={url} /> | ||
))} | ||
</Avatar.Group> | ||
</div> | ||
<div className="avatar-group-demo"> | ||
<Avatar.Group cascading="right-up" max={5} size="medium"> | ||
{imageList.map((url, idx) => ( | ||
<Avatar key={idx} shape="circle" image={url} /> | ||
))} | ||
</Avatar.Group> | ||
</div> | ||
<div className="avatar-group-demo"> | ||
<Avatar.Group cascading="right-up" max={5} size="large"> | ||
{imageList.map((url, idx) => ( | ||
<Avatar key={idx} shape="circle" image={url} /> | ||
))} | ||
</Avatar.Group> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import React from 'react'; | ||
import { UserIcon } from 'tdesign-icons-react'; | ||
import { Avatar } from 'tdesign-mobile-react'; | ||
|
||
export default function AvatarShapeDemo() { | ||
const demoPicture = 'https://tdesign.gtimg.com/mobile/demos/avatar_1.png'; | ||
|
||
export default function AvatarTypeDemo() { | ||
return ( | ||
<div className="tdesign-demo-block"> | ||
<Avatar shape="circle"></Avatar> | ||
<Avatar shape="round"></Avatar> | ||
</div> | ||
<> | ||
<Avatar icon={<UserIcon />} /> | ||
|
||
<Avatar alt="示例图片" hideOnLoadFailed={false} image={demoPicture}></Avatar> | ||
|
||
<Avatar icon={<img src={demoPicture} alt="示例图片" />} /> | ||
<Avatar image={demoPicture} shape="round" /> | ||
<Avatar className="custom">A</Avatar> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.