-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
196 additions
and
8 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
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,88 @@ | ||
import {Pricing} from "../../types"; | ||
import {Card as AntdCard, CardProps, Col, List, Row, RowProps, Segmented, Space, theme, Typography} from "antd"; | ||
import {CheckCircleOutlined} from "@ant-design/icons"; | ||
import {Card} from "../index.ts"; | ||
import {useState} from "react"; | ||
|
||
const ROW_PROPS: RowProps = { | ||
gutter: [ | ||
{xs: 8, sm: 16, md: 24, lg: 32}, | ||
{xs: 8, sm: 16, md: 24, lg: 32} | ||
] | ||
} | ||
|
||
const textStyles = (preferred?: boolean, primary?: string): React.CSSProperties => { | ||
return { | ||
color: preferred ? "white" : (primary ? primary : "initial"), | ||
textTransform: "capitalize", | ||
textAlign: "center" | ||
} | ||
} | ||
|
||
type Props = { | ||
data: Pricing[] | ||
} & CardProps | ||
|
||
const PricingTable = ({data, ...others}: Props) => { | ||
const {token: {colorPrimary, colorFillSecondary}} = theme.useToken() | ||
const [value, setValue] = useState<"monthly" | "annually" | string | number>('monthly'); | ||
|
||
return ( | ||
<Card | ||
title="Pricing" | ||
actions={[ | ||
<Typography.Text italic>Note: All plans come with a 30-day money-back guarantee.</Typography.Text> | ||
]} | ||
{...others} | ||
> | ||
<div style={{textAlign: "center", marginBottom: "1rem", textTransform: "capitalize"}}> | ||
<Segmented size="large" options={['monthly', 'annually']} value={value} onChange={setValue}/> | ||
</div> | ||
<Row {...ROW_PROPS}> | ||
{data.map((d, i) => ( | ||
<Col sm={24} lg={8} key={`${d.color}-${i}`}> | ||
<AntdCard | ||
style={{ | ||
background: d.preferred ? colorPrimary : colorFillSecondary, | ||
border: `1px solid ${d.preferred ? colorPrimary : colorFillSecondary}` | ||
}} | ||
> | ||
<Typography.Text | ||
strong | ||
style={{...textStyles(d.preferred, colorPrimary), fontSize: 16}} | ||
> | ||
{d.plan} | ||
</Typography.Text> | ||
<Typography.Title | ||
style={{...textStyles(d.preferred)}} | ||
> | ||
$ {value === "monthly" ? d.monthly : d.annually}/ | ||
<small | ||
style={{fontSize: 16, fontWeight: 400, textTransform: "lowercase"}} | ||
> | ||
per{' '}{value === "monthly" ? "month" : "year"} | ||
</small> | ||
</Typography.Title> | ||
<List | ||
header={<Typography.Text style={textStyles(d.preferred)}>Features</Typography.Text>} | ||
dataSource={d.features} | ||
renderItem={(item) => ( | ||
<List.Item> | ||
<Space> | ||
<CheckCircleOutlined style={textStyles(d.preferred)}/> | ||
<Typography.Text | ||
style={textStyles(d.preferred)}>{item} | ||
</Typography.Text> | ||
</Space> | ||
</List.Item> | ||
)} | ||
/> | ||
</AntdCard> | ||
</Col> | ||
))} | ||
</Row> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default PricingTable; |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[ | ||
{ | ||
"plan": "free", | ||
"monthly": 0, | ||
"annually": 0, | ||
"savings_caption": "Save 0%", | ||
"features": [ | ||
"Basic Dashboard Templates", | ||
"Limited Widgets and Customization Options", | ||
"Email Support" | ||
], | ||
"color": "purple" | ||
}, | ||
{ | ||
"plan": "pro", | ||
"monthly": 9.99, | ||
"annually": 99.99, | ||
"savings_caption": "Save 17%", | ||
"features": [ | ||
"Advanced Dashboard Templates", | ||
"Rich Widgets and Customization Options", | ||
"Priority Email Support", | ||
"Data Export and Import", | ||
"Access to Premium Templates Library" | ||
], | ||
"color": "maroon", | ||
"preferred": true | ||
}, | ||
{ | ||
"plan": "enterprise", | ||
"monthly": 29.99, | ||
"annually": 299.99, | ||
"savings_caption": "Save 17%", | ||
"features": [ | ||
"Enterprise-grade Dashboard Templates", | ||
"Unlimited Widgets and Customization Options", | ||
"24/7 Priority Support", | ||
"Dedicated Account Manager", | ||
"Advanced Data Security and Compliance", | ||
"API Access and Integration Support" | ||
], | ||
"color": "cyan" | ||
} | ||
] |
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,12 @@ | ||
import {PricingTable} from "../../components"; | ||
import PricingData from "../../mocks/Pricing.json" | ||
|
||
const CorporatePricingPage = () => { | ||
return ( | ||
<div> | ||
<PricingTable data={PricingData}/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CorporatePricingPage; |
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
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
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,9 @@ | ||
export type Pricing = { | ||
plan: string | ||
monthly: number | ||
annually: number | ||
savings_caption: string | ||
features: string[] | ||
color: string | ||
preferred?: boolean | ||
} |