mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-10-22 18:26:39 +02:00
101 lines
3.1 KiB
TypeScript
101 lines
3.1 KiB
TypeScript
/**
|
|
* A collection of popular layouts and patterns made with CSS (https://csslayout.io)
|
|
* (c) 2019 - 2020 Nguyen Huu Phuoc <https://twitter.com/nghuuphuoc>
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { Helmet } from 'react-helmet';
|
|
|
|
import RelatedPatterns from '../../components/RelatedPatterns';
|
|
import Pattern from '../../constants/Pattern';
|
|
import DetailsLayout from '../../layouts/DetailsLayout';
|
|
import BrowserFrame from '../../placeholders/BrowserFrame';
|
|
|
|
const Avatar: React.FC<{}> = ({ children }) => {
|
|
return (
|
|
<div
|
|
style={{
|
|
alignItems: 'center',
|
|
backgroundColor: '#BBB',
|
|
borderRadius: '9999px',
|
|
boxShadow: '0 0 0 4px #FFF',
|
|
color: '#FFF',
|
|
display: 'flex',
|
|
height: '48px',
|
|
justifyContent: 'center',
|
|
width: '48px',
|
|
}}
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const Details: React.FC<{}> = () => {
|
|
return (
|
|
<DetailsLayout pattern={Pattern.AvatarList}>
|
|
<Helmet>
|
|
<meta name="description" content="Create an avatar list with CSS flexbox" />
|
|
<meta name="keywords" content="css avatar, css flexbox" />
|
|
</Helmet>
|
|
<div className='p-8 pb-20'>
|
|
<BrowserFrame
|
|
content={(
|
|
<div
|
|
style={{
|
|
alignItems: 'center',
|
|
display: 'flex',
|
|
height: '100%',
|
|
justifyContent: 'center',
|
|
padding: '8px',
|
|
}}
|
|
>
|
|
<div style={{ marginLeft: '-4px' }}><Avatar /></div>
|
|
<div style={{ marginLeft: '-4px' }}><Avatar /></div>
|
|
<div style={{ marginLeft: '-4px' }}><Avatar /></div>
|
|
<div style={{ marginLeft: '-4px' }}><Avatar /></div>
|
|
<div style={{ marginLeft: '-4px' }}><Avatar>+5</Avatar></div>
|
|
</div>
|
|
)}
|
|
source={`
|
|
<div style="
|
|
display: flex;
|
|
">
|
|
<!-- Avatar item -->
|
|
<div style="
|
|
/* Nagative margin make avatar overlap to previous one */
|
|
margin-left: -4px;
|
|
">
|
|
<div style="
|
|
/* Add a white curve between avatars */
|
|
box-shadow: 0 0 0 4px #FFF;
|
|
|
|
/* Center the content */
|
|
align-items: center;
|
|
display: flex;
|
|
justify-content: center;
|
|
|
|
/* Rounded border */
|
|
border-radius: 9999px;
|
|
">
|
|
<!-- Image -->
|
|
...
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Repeat other avatars -->
|
|
...
|
|
</div>
|
|
`}
|
|
/>
|
|
</div>
|
|
|
|
<RelatedPatterns
|
|
patterns={[Pattern.Avatar, Pattern.Centering, Pattern.InitialAvatar, Pattern.PresenceIndicator]}
|
|
/>
|
|
</DetailsLayout>
|
|
);
|
|
};
|
|
|
|
export default Details;
|