mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-08-06 06:07:33 +02:00
feat: Pricing table
This commit is contained in:
12
contents/_includes/patterns/pricing-table.njk
Normal file
12
contents/_includes/patterns/pricing-table.njk
Normal file
@@ -0,0 +1,12 @@
|
||||
<div class="pricing-table">
|
||||
<div class="pricing-table__column">
|
||||
{% circle "md" %}
|
||||
{% lines "hor", 3 %}
|
||||
{% rectangle "hor", "sm", 100 %}
|
||||
</div>
|
||||
<div class="pricing-table__column">
|
||||
{% circle "md" %}
|
||||
{% lines "hor", 6 %}
|
||||
{% rectangle "hor", "sm", 100 %}
|
||||
</div>
|
||||
</div>
|
@@ -205,6 +205,12 @@ eleventyExcludeFromCollections: true
|
||||
<div class="pattern__title">Price tag</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pattern__item">
|
||||
<a class="pattern__link" href="/pricing-table/">
|
||||
<div class="pattern__cover">{% include "patterns/pricing-table.njk" %}</div>
|
||||
<div class="pattern__title">Pricing table</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="pattern__item">
|
||||
<a class="pattern__link" href="/triangle-buttons/">
|
||||
<div class="pattern__cover">{% include "patterns/triangle-buttons.njk" %}</div>
|
||||
|
63
contents/pricing-table.md
Normal file
63
contents/pricing-table.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
layout: layouts/post.njk
|
||||
title: Pricing table
|
||||
description: Create a pricing table with CSS flexbox
|
||||
keywords: css flexbox, css pricing table
|
||||
---
|
||||
|
||||
## HTML
|
||||
|
||||
```html
|
||||
<div class="pricing-table">
|
||||
<!-- Pricing column -->
|
||||
<div class="pricing-table__column">
|
||||
<!-- Title -->
|
||||
...
|
||||
|
||||
<!-- Price -->
|
||||
...
|
||||
|
||||
<!-- Description -->
|
||||
...
|
||||
|
||||
<!-- Button -->
|
||||
...
|
||||
</div>
|
||||
|
||||
<!-- Repeated pricing columns -->
|
||||
...
|
||||
</div>
|
||||
```
|
||||
|
||||
## CSS
|
||||
|
||||
```css
|
||||
.pricing-table {
|
||||
/* Content is centered horizontally */
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pricing-table__column {
|
||||
/* Content is centered vertically */
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
/* Make all columns have the same width */
|
||||
flex: 1;
|
||||
|
||||
/* OPTIONAL: Space between columns */
|
||||
margin: 0 0.5rem;
|
||||
|
||||
/* OPTIONAL: Border */
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
```
|
||||
|
||||
{% demo %}
|
||||
{% include "patterns/pricing-table.njk" %}
|
||||
{% enddemo %}
|
@@ -1,186 +0,0 @@
|
||||
import * as React from 'react';
|
||||
import Head from 'next/head';
|
||||
import Link from 'next/link';
|
||||
import { Spacer } from '@1milligram/design';
|
||||
|
||||
import { RelatedPatterns } from '../../components/RelatedPatterns';
|
||||
import { Pattern } from '../../constants/Pattern';
|
||||
import { PatternLayout } from '../../layouts/PatternLayout';
|
||||
import Block from '../../placeholders/Block';
|
||||
import BrowserFrame from '../../placeholders/BrowserFrame';
|
||||
import Circle from '../../placeholders/Circle';
|
||||
import Rectangle from '../../placeholders/Rectangle';
|
||||
|
||||
const Details: React.FC<{}> = () => {
|
||||
return (
|
||||
<PatternLayout pattern={Pattern.PricingTable}>
|
||||
<Head>
|
||||
<meta name="description" content="Create a pricing table with CSS flexbox" />
|
||||
<meta name="og:description" content="Create a pricing table with CSS flexbox" />
|
||||
<meta name="twitter:description" content="Create a pricing table with CSS flexbox" />
|
||||
<meta name="keywords" content="css flexbox, css pricing table" />
|
||||
</Head>
|
||||
<div style={{ lineHeight: 1.5, marginBottom: '16px' }}>
|
||||
You can{' '}
|
||||
<Link href="/ribbon">
|
||||
<a>add</a>
|
||||
</Link>{' '}
|
||||
<Link href="/corner-ribbon">
|
||||
<a>a ribbon</a>
|
||||
</Link>{' '}
|
||||
to indicate the most popular option.
|
||||
</div>
|
||||
<BrowserFrame
|
||||
html={`
|
||||
<div class="container">
|
||||
<!-- Pricing column -->
|
||||
<div class="container__column">
|
||||
<!-- Title -->
|
||||
...
|
||||
|
||||
<!-- Price -->
|
||||
...
|
||||
|
||||
<!-- Description -->
|
||||
...
|
||||
|
||||
<!-- Button -->
|
||||
...
|
||||
</div>
|
||||
|
||||
<!-- Repeated pricing columns -->
|
||||
...
|
||||
</div>
|
||||
`}
|
||||
css={`
|
||||
.container {
|
||||
/* Content is centered horizontally */
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container__column {
|
||||
/* Content is centered vertically */
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
/* Make all columns have the same width */
|
||||
flex: 1;
|
||||
|
||||
/* OPTIONAL: Space between columns */
|
||||
margin: 0 8px;
|
||||
|
||||
/* OPTIONAL: Border */
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
border-radius: 4px;
|
||||
}
|
||||
`}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
height: '100%',
|
||||
justifyContent: 'center',
|
||||
padding: '16px',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
width: '60%',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
margin: '0 8px',
|
||||
padding: '16px',
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: '16px', width: '60%' }}>
|
||||
<Rectangle />
|
||||
</div>
|
||||
<div style={{ marginBottom: '16px' }}>
|
||||
<Circle size={64} />
|
||||
</div>
|
||||
<div style={{ marginBottom: '16px', width: '100%' }}>
|
||||
<Block numberOfBlocks={10} />
|
||||
</div>
|
||||
<div style={{ width: '40%' }}>
|
||||
<Rectangle height={32} />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
margin: '0 8px',
|
||||
padding: '16px',
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: '16px', width: '60%' }}>
|
||||
<Rectangle />
|
||||
</div>
|
||||
<div style={{ marginBottom: '16px' }}>
|
||||
<Circle size={64} />
|
||||
</div>
|
||||
<div style={{ marginBottom: '16px', width: '100%' }}>
|
||||
<Block numberOfBlocks={20} />
|
||||
</div>
|
||||
<div style={{ width: '40%' }}>
|
||||
<Rectangle height={32} />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
margin: '0 8px',
|
||||
padding: '16px',
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: '16px', width: '60%' }}>
|
||||
<Rectangle />
|
||||
</div>
|
||||
<div style={{ marginBottom: '16px' }}>
|
||||
<Circle size={64} />
|
||||
</div>
|
||||
<div style={{ marginBottom: '16px', width: '100%' }}>
|
||||
<Block numberOfBlocks={10} />
|
||||
</div>
|
||||
<div style={{ width: '40%' }}>
|
||||
<Rectangle height={32} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</BrowserFrame>
|
||||
<Spacer size="extraLarge" />
|
||||
<RelatedPatterns patterns={[Pattern.FeatureComparison]} />
|
||||
</PatternLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default Details;
|
@@ -1,114 +0,0 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import Circle from '../../placeholders/Circle';
|
||||
import Frame from '../../placeholders/Frame';
|
||||
import Line from '../../placeholders/Line';
|
||||
import Rectangle from '../../placeholders/Rectangle';
|
||||
|
||||
const Cover: React.FC<{}> = () => {
|
||||
return (
|
||||
<Frame>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
height: '100%',
|
||||
justifyContent: 'center',
|
||||
padding: '8px',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
marginRight: '4px',
|
||||
padding: '4px',
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: '4px' }}>
|
||||
<Circle />
|
||||
</div>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
<div style={{ width: '80%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
</div>
|
||||
<Rectangle />
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
marginRight: '4px',
|
||||
padding: '4px',
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: '4px' }}>
|
||||
<Circle />
|
||||
</div>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
<div style={{ marginBottom: '4px', width: '60%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
<div style={{ marginBottom: '4px', width: '80%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
<div style={{ width: '80%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
</div>
|
||||
<Rectangle />
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
border: '1px solid rgba(0, 0, 0, 0.3)',
|
||||
borderRadius: '4px',
|
||||
display: 'flex',
|
||||
flex: 1,
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
padding: '4px',
|
||||
}}
|
||||
>
|
||||
<div style={{ marginBottom: '4px' }}>
|
||||
<Circle />
|
||||
</div>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<div style={{ marginBottom: '4px', width: '100%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
<div style={{ width: '80%' }}>
|
||||
<Line />
|
||||
</div>
|
||||
</div>
|
||||
<Rectangle />
|
||||
</div>
|
||||
</div>
|
||||
</Frame>
|
||||
);
|
||||
};
|
||||
|
||||
export default Cover;
|
@@ -43,6 +43,7 @@
|
||||
@import './patterns/media-object';
|
||||
@import './patterns/overlay-play-button';
|
||||
@import './patterns/price-tag';
|
||||
@import './patterns/pricing-table';
|
||||
@import './patterns/triangle-buttons';
|
||||
@import './patterns/video-background';
|
||||
@import './patterns/voting';
|
||||
|
11
styles/patterns/_pricing-table.scss
Normal file
11
styles/patterns/_pricing-table.scss
Normal file
@@ -0,0 +1,11 @@
|
||||
.pricing-table {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.pricing-table__column {
|
||||
border: 1px solid rgba(0, 0, 0, 0.3);
|
||||
border-radius: 0.25rem;
|
||||
margin: 0 0.25rem;
|
||||
padding: 0.25rem;
|
||||
}
|
Reference in New Issue
Block a user