1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-19 20:31:32 +02:00

Add statistic pattern

This commit is contained in:
Phuoc Nguyen
2019-12-30 22:54:33 +07:00
parent 300a11c816
commit 854ef77194
5 changed files with 130 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
/**
* 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 Frame from '../../placeholders/Frame';
const Cover: React.FC<{}> = () => {
return (
<Frame>
<div
style={{
alignItems: 'center',
display: 'flex',
flexDirection: 'column',
height: '100%',
justifyContent: 'center',
padding: '8px',
}}
>
<div
style={{
alignItems: 'center',
display: 'inline-flex',
flexDirection: 'column',
justifyContent: 'center',
}}
>
<div style={{ color: 'rgba(0, 0, 0, 0.7)', fontSize: '2.5rem', fontWeight: 500 }}>
1k+
</div>
<div style={{ color: 'rgba(0, 0, 0, 0.4)', fontSize: '.75rem', textTransform: 'uppercase' }}>
stars
</div>
</div>
</div>
</Frame>
);
};
export default Cover;

View File

@@ -0,0 +1,84 @@
/**
* 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 random from '../../helpers/random';
import DetailsLayout from '../../layouts/DetailsLayout';
import BrowserFrame from '../../placeholders/BrowserFrame';
const Details: React.FC<{}> = () => {
return (
<DetailsLayout title="Statistic">
<Helmet>
<meta name="description" content="Create a statistic component with CSS flexbox" />
<meta name="keywords" content="css flexbox, css statistic" />
</Helmet>
<div style={{ padding: '64px 32px' }}>
<BrowserFrame
content={(
<div
style={{
alignItems: 'center',
display: 'flex',
flexDirection: 'column',
height: '100%',
justifyContent: 'center',
padding: '8px',
}}
>
<div
style={{
alignItems: 'center',
display: 'inline-flex',
flexDirection: 'column',
}}
>
<div style={{ fontSize: '4rem', fontWeight: 500 }}>
{random(1000, 9999).toLocaleString()}
</div>
<div style={{ fontSize: '1rem', fontWeight: 700, textTransform: 'uppercase' }}>
stars
</div>
</div>
</div>
)}
source={`
<div style="
/* Center the content */
align-items: center;
display: inline-flex;
flex-direction: column;
">
<!-- Value -->
<div style="
/* Big font size */
font-size: 4rem;
font-weight: 500;
">
...
</div>
<!-- Label -->
<div style="
/* Smaller font size */
font-size: 1rem;
font-weight: 700;
/* Uppercase the label */
text-transform: uppercase;
">
...
</div>
</div>
`}
/>
</div>
</DetailsLayout>
);
};
export default Details;