plan card tweaks
This commit is contained in:
1 parent
c088956d6f
commit
5c889f3a63
2 files changed
+56
-17
No files matched your search
@@ -1,5 +1,7 @@
|
|||||||
import Stack from "@mui/material/Stack";
|
import Stack from "@mui/material/Stack";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Chip from "@mui/material/Chip";
|
||||||
|
import { Button } from "@/components/inputs";
|
||||||
import { BaseBox } from "@/components/design-elements";
|
import { BaseBox } from "@/components/design-elements";
|
||||||
import {
|
import {
|
||||||
PersonStanding,
|
PersonStanding,
|
||||||
@@ -18,10 +20,12 @@ export const PlanCard = ({
|
|||||||
plan,
|
plan,
|
||||||
currentPlan,
|
currentPlan,
|
||||||
onClick,
|
onClick,
|
||||||
|
loading,
|
||||||
}: {
|
}: {
|
||||||
plan: Entitlements;
|
plan: Entitlements;
|
||||||
currentPlan: PlanKey | null;
|
currentPlan: PlanKey | null;
|
||||||
onClick?: (planKey: PlanKey) => void;
|
onClick?: (planKey: PlanKey) => void;
|
||||||
|
loading?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const selected = plan.plan === currentPlan;
|
const selected = plan.plan === currentPlan;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
@@ -89,17 +93,29 @@ export const PlanCard = ({
|
|||||||
return (
|
return (
|
||||||
<BaseBox
|
<BaseBox
|
||||||
padding={6}
|
padding={6}
|
||||||
sx={
|
sx={{
|
||||||
selected
|
display: "flex",
|
||||||
? {
|
flexDirection: "column",
|
||||||
border: 2,
|
height: "100%",
|
||||||
borderColor: theme.palette.accent.main,
|
border: selected ? 2 : 1,
|
||||||
}
|
borderColor: selected ? theme.palette.accent.main : "divider",
|
||||||
: { cursor: "pointer" }
|
transition:
|
||||||
}
|
"transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease",
|
||||||
|
...(selected
|
||||||
|
? {}
|
||||||
|
: {
|
||||||
|
cursor: "pointer",
|
||||||
|
"&:hover": {
|
||||||
|
transform: "scale(0.995)",
|
||||||
|
boxShadow: 2,
|
||||||
|
borderColor: theme.palette.action.active,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
position: "relative",
|
||||||
|
}}
|
||||||
onClick={selected ? undefined : () => onClick?.(plan.plan)}
|
onClick={selected ? undefined : () => onClick?.(plan.plan)}
|
||||||
>
|
>
|
||||||
<Stack spacing={3}>
|
<Stack spacing={3} sx={{ flexGrow: 1 }}>
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
@@ -108,7 +124,12 @@ export const PlanCard = ({
|
|||||||
<Typography variant="h6" textTransform="capitalize">
|
<Typography variant="h6" textTransform="capitalize">
|
||||||
{plan.plan}
|
{plan.plan}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Icon size={18} />
|
<Stack direction="row" alignItems="center" spacing={1}>
|
||||||
|
{plan.plan === "pro" && (
|
||||||
|
<Chip size="small" label="Most popular" sx={{ bgcolor: theme.palette.accent.main, color: theme.palette.getContrastText(theme.palette.accent.main) }} />
|
||||||
|
)}
|
||||||
|
<Icon size={18} />
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Divider />
|
<Divider />
|
||||||
<Typography variant="h4" fontWeight={700}>
|
<Typography variant="h4" fontWeight={700}>
|
||||||
@@ -116,12 +137,7 @@ export const PlanCard = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Stack spacing={2}>
|
<Stack spacing={2}>
|
||||||
{featureItems.map((item) => (
|
{featureItems.map((item) => (
|
||||||
<Stack
|
<Stack key={item.label} direction="row" alignItems="center" gap={2}>
|
||||||
key={item.label}
|
|
||||||
direction="row"
|
|
||||||
alignItems="center"
|
|
||||||
gap={2}
|
|
||||||
>
|
|
||||||
<Check size={16} color={checkColor} />
|
<Check size={16} color={checkColor} />
|
||||||
{item.tooltip ? (
|
{item.tooltip ? (
|
||||||
<Tooltip title={item.tooltip} arrow placement="right">
|
<Tooltip title={item.tooltip} arrow placement="right">
|
||||||
@@ -138,6 +154,24 @@ export const PlanCard = ({
|
|||||||
))}
|
))}
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
<Stack direction="row" justifyContent="flex-end" pt={2}>
|
||||||
|
{selected ? null : (
|
||||||
|
// <Button variant="contained" color="accent" loading={loading}>
|
||||||
|
// Manage
|
||||||
|
// </Button>
|
||||||
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
variant="contained"
|
||||||
|
color="accent"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
onClick?.(plan.plan);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Choose plan
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
</BaseBox>
|
</BaseBox>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -67,13 +67,18 @@ const BillingPage = () => {
|
|||||||
title="Choose a plan!"
|
title="Choose a plan!"
|
||||||
description="Choose a plan that fits your needs and start enjoying our services."
|
description="Choose a plan that fits your needs and start enjoying our services."
|
||||||
/>
|
/>
|
||||||
<Grid container spacing={{ xs: 2, sm: 3, md: 4 }} columns={{ xs: 1, sm: 2, md: 4 }}>
|
<Grid
|
||||||
|
container
|
||||||
|
spacing={{ xs: 2, sm: 3, md: 4 }}
|
||||||
|
columns={{ xs: 1, sm: 2, md: 4 }}
|
||||||
|
>
|
||||||
{plans.map((plan) => (
|
{plans.map((plan) => (
|
||||||
<Grid key={plan.plan} size={1}>
|
<Grid key={plan.plan} size={1}>
|
||||||
<PlanCard
|
<PlanCard
|
||||||
plan={plan}
|
plan={plan}
|
||||||
currentPlan={selectedPlan}
|
currentPlan={selectedPlan}
|
||||||
onClick={handlePlanClick}
|
onClick={handlePlanClick}
|
||||||
|
loading={isPosting}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in new issue
Block a user