forked from infiniflow/ragflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add PricingCard component infiniflow#3221
- Loading branch information
Showing
7 changed files
with
224 additions
and
3 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
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 |
---|---|---|
@@ -1,3 +1,121 @@ | ||
import { Button } from '@/components/ui/button'; | ||
import { Card, CardContent } from '@/components/ui/card'; | ||
import { Segmented, SegmentedValue } from '@/components/ui/segmented '; | ||
import { CircleCheckBig, LogOut } from 'lucide-react'; | ||
import { useMemo, useState } from 'react'; | ||
import { PricingCard } from './pricing-card'; | ||
|
||
const pricingData = [ | ||
{ | ||
title: 'Free', | ||
price: '$0', | ||
description: 'Meh, just looking', | ||
features: [ | ||
{ name: 'Project', value: '1 project' }, | ||
{ name: 'Storage', value: '1 Gb' }, | ||
{ name: 'Team', value: '2 members' }, | ||
{ name: 'Features', value: 'Basic features' }, | ||
], | ||
buttonText: 'Current plan', | ||
buttonVariant: 'outline' as const, | ||
}, | ||
{ | ||
title: 'Pro', | ||
price: '$16.00', | ||
description: 'For professional use.', | ||
features: [ | ||
{ name: 'Project', value: 'Unlimited projects' }, | ||
{ name: 'Storage', value: '100 Gb' }, | ||
{ name: 'Team', value: 'Unlimited members' }, | ||
{ name: 'Features', value: 'Basic features All advanced features' }, | ||
], | ||
buttonText: 'Upgrade', | ||
buttonVariant: 'default' as const, | ||
isPro: true, | ||
}, | ||
{ | ||
title: 'Enterprise', | ||
price: 'Customed', | ||
description: | ||
'Get full capabilities and support for large-scale mission-critical systems.', | ||
features: [ | ||
{ name: 'Project', value: 'Unlimited projects' }, | ||
{ name: 'Storage', value: '100 Gb' }, | ||
{ name: 'Team', value: 'Unlimited members' }, | ||
{ name: 'Features', value: 'Basic features All advanced features' }, | ||
], | ||
buttonText: 'Contact us', | ||
buttonVariant: 'secondary' as const, | ||
isEnterprise: true, | ||
}, | ||
]; | ||
|
||
export default function Plan() { | ||
return <div>plan</div>; | ||
const [val, setVal] = useState('monthly'); | ||
const options = useMemo(() => { | ||
return [ | ||
{ | ||
label: 'Monthly', | ||
value: 'monthly', | ||
}, | ||
{ | ||
label: 'Yearly', | ||
value: 'yearly', | ||
}, | ||
]; | ||
}, []); | ||
|
||
const handleChange = (path: SegmentedValue) => { | ||
setVal(path as string); | ||
}; | ||
|
||
const list = [ | ||
'Full access to pro features', | ||
'Exclusive analyze models', | ||
'Create more teams', | ||
'Invite more collaborators', | ||
]; | ||
|
||
return ( | ||
<section className="p-8"> | ||
<h1 className="text-3xl font-bold mb-6">Plan & balance</h1> | ||
<Card className="border-0 p-6 mb-6 bg-colors-background-inverse-weak divide-y divide-colors-outline-neutral-strong"> | ||
<div className="pb-2 flex justify-between text-xl"> | ||
<span className="font-bold ">Balance</span> | ||
<span className="font-medium">$ 100.00</span> | ||
</div> | ||
<div className="flex items-center justify-between pt-3"> | ||
<span>The value equals to 1,000 tokens or 10.00 GBs of storage</span> | ||
<Button variant={'tertiary'} size={'sm'}> | ||
<LogOut /> | ||
Recharge | ||
</Button> | ||
</div> | ||
</Card> | ||
<Card className="pt-6 bg-colors-background-inverse-weak"> | ||
<CardContent className="space-y-4"> | ||
<div className="font-bold text-xl">Upgrade to access</div> | ||
<section className="grid grid-cols-2 gap-3"> | ||
{list.map((x, idx) => ( | ||
<div key={idx} className="flex items-center gap-2"> | ||
<CircleCheckBig className="size-4" /> | ||
<span>{x}</span> | ||
</div> | ||
))} | ||
</section> | ||
<Segmented | ||
options={options} | ||
value={val} | ||
onChange={handleChange} | ||
className="bg-colors-background-inverse-standard inline-flex" | ||
></Segmented> | ||
<div className="grid gap-8 md:grid-cols-2 lg:grid-cols-3"> | ||
{pricingData.map((plan, index) => ( | ||
<PricingCard key={index} {...plan} /> | ||
))} | ||
</div> | ||
</CardContent> | ||
</Card> | ||
</section> | ||
); | ||
} |
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,90 @@ | ||
import { Badge } from '@/components/ui/badge'; | ||
import { Button } from '@/components/ui/button'; | ||
import { Card, CardContent, CardHeader } from '@/components/ui/card'; | ||
import { cn } from '@/lib/utils'; | ||
import { Mail, Zap } from 'lucide-react'; | ||
|
||
interface PricingFeature { | ||
name: string; | ||
value: string; | ||
tooltip?: string; | ||
} | ||
|
||
interface PricingCardProps { | ||
title: string; | ||
price: string; | ||
description: string; | ||
features: PricingFeature[]; | ||
buttonText: string; | ||
buttonVariant?: 'default' | 'outline' | 'secondary'; | ||
badge?: string; | ||
isPro?: boolean; | ||
isEnterprise?: boolean; | ||
} | ||
|
||
export function PricingCard({ | ||
title, | ||
price, | ||
description, | ||
features, | ||
buttonText, | ||
isPro, | ||
isEnterprise, | ||
}: PricingCardProps) { | ||
const isFree = title === 'Free'; | ||
|
||
return ( | ||
<Card className="flex flex-col bg-colors-background-neutral-weak divide-y divide-colors-outline-neutral-strong p-4"> | ||
<CardHeader className=" justify-between p-0 pb-3 h-52"> | ||
<section> | ||
<div className="flex items-center justify-between mb-2"> | ||
<Badge | ||
variant={isFree ? 'secondary' : 'tertiary'} | ||
className="text-xs" | ||
> | ||
{isPro && <Zap className="mr-2 h-4 w-4" />} | ||
{isEnterprise && <Mail className="mr-2 h-4 w-4" />} | ||
{title} | ||
</Badge> | ||
</div> | ||
<p className="text-sm text-colors-text-neutral-standard"> | ||
{description} | ||
</p> | ||
</section> | ||
<section> | ||
<div className="flex items-baseline text-3xl font-bold pb-3"> | ||
{price} | ||
{price !== 'Customed' && ( | ||
<span className="text-sm font-normal">/mo</span> | ||
)} | ||
</div> | ||
<Button | ||
variant={isFree ? 'secondary' : 'tertiary'} | ||
className={cn('w-full', { | ||
'bg-colors-text-core-standard': !isFree, | ||
})} | ||
size={'sm'} | ||
> | ||
{isPro && <Zap className="mr-2 h-4 w-4" />} | ||
{isEnterprise && <Mail />} | ||
{buttonText} | ||
</Button> | ||
</section> | ||
</CardHeader> | ||
<CardContent className=" p-0 pt-3"> | ||
<ul className="space-y-2"> | ||
{features.map((feature, index) => ( | ||
<li key={index} className=""> | ||
<div className="text-colors-text-core-standard"> | ||
{feature.name} | ||
</div> | ||
<span className="text-sm"> | ||
<span className="font-medium">{feature.value}</span> | ||
</span> | ||
</li> | ||
))} | ||
</ul> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
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