2024-06-02 11:47:22 +03:00
|
|
|
'use client';
|
|
|
|
import { motion } from 'framer-motion';
|
|
|
|
import { useState } from 'react';
|
|
|
|
import LinkButton from './link-button';
|
2024-06-03 21:46:58 +03:00
|
|
|
import { Radio, RadioGroup } from '@headlessui/react';
|
|
|
|
import { CheckCircleIcon } from '@heroicons/react/24/outline';
|
|
|
|
|
2024-06-01 21:36:06 +03:00
|
|
|
const TopicCard = ({ title, children, link }: { title: string, children: any, link: string }) => {
|
2024-06-03 21:46:58 +03:00
|
|
|
const types = [
|
|
|
|
{ name: 'Classic', desc: 'Answer with \'I knew that\', and \'I didn\'t know\'.', disabled: false },
|
|
|
|
{ name: 'Type', desc: 'Answer with typing in a prompt.', disabled: true },
|
|
|
|
{ name: 'Quiz', desc: 'Answer with 4 buttons, only one is correct.', disabled: true},
|
|
|
|
{ name: 'Mixed', desc: 'From all of the above.', disabled: true}
|
|
|
|
]
|
2024-06-02 11:47:22 +03:00
|
|
|
const [clicked, setClicked] = useState( false );
|
|
|
|
const [hovered, setHovered] = useState( false );
|
|
|
|
return (
|
2024-06-03 21:46:58 +03:00
|
|
|
<motion.div className="mx-auto mt-8 max-w-2xl rounded-3xl sm:mt-20 lg:mx-0 lg:flex lg:max-w-none relative isolate overflow-hidden bg-gray-900 px-6 pt-16 shadow-2xl sm:rounded-3xl sm:px-16 md:pt-24 lg:flex lg:gap-x-20 lg:px-24 lg:pt-0" style={{marginTop: '5px', paddingTop: '34px', paddingBottom: '0px'}}
|
2024-06-02 11:47:22 +03:00
|
|
|
animate={{x: hovered? 10 : 0, opacity: clicked ? 0.5 : 1 }} onMouseEnter={()=>setHovered(true)} onMouseLeave={()=>setHovered(false)}>
|
2024-06-01 15:47:53 +03:00
|
|
|
<svg
|
|
|
|
viewBox="0 0 1024 1024"
|
|
|
|
className="absolute left-1/2 top-1/2 -z-10 h-[64rem] w-[64rem] -translate-y-1/2 [mask-image:radial-gradient(closest-side,white,transparent)] sm:left-full sm:-ml-80 lg:left-1/2 lg:ml-0 lg:-translate-x-1/2 lg:translate-y-0"
|
|
|
|
aria-hidden="true"
|
|
|
|
>
|
|
|
|
<circle cx={512} cy={512} r={512} fill="url(#759c1415-0410-454c-8f7c-9a820de03641)" fillOpacity="0.7" />
|
|
|
|
<defs>
|
|
|
|
<radialGradient id="759c1415-0410-454c-8f7c-9a820de03641">
|
|
|
|
<stop stopColor="#7775D6" />
|
|
|
|
<stop offset={1} stopColor="#E935C1" />
|
|
|
|
</radialGradient>
|
|
|
|
</defs>
|
|
|
|
</svg>
|
|
|
|
<div className="p-8 sm:p-10 lg:flex-auto ">
|
|
|
|
<h3 className="text-2xl font-bold tracking-tight text-gray-200">{title}</h3>
|
2024-06-03 21:46:58 +03:00
|
|
|
<p className="mt-2 text-base leading-6 text-gray-200">
|
2024-06-01 15:47:53 +03:00
|
|
|
{children}
|
|
|
|
</p>
|
|
|
|
</div>
|
2024-06-02 09:47:54 +03:00
|
|
|
<div
|
2024-06-03 21:46:58 +03:00
|
|
|
className="-mt-5 p-2 lg:mt-0 lg:max-w-md lg:flex-shrink-0 lg:flex lg:flex-col lg:justify-center"
|
2024-06-02 09:47:54 +03:00
|
|
|
style={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}
|
|
|
|
>
|
2024-06-03 21:46:58 +03:00
|
|
|
<RadioGroup aria-label="Type" className="space-y-1">
|
|
|
|
{types.map((plan) => (
|
|
|
|
<Radio
|
|
|
|
key={plan.name}
|
|
|
|
value={plan}
|
|
|
|
disabled={plan.disabled}
|
|
|
|
className="group relative flex cursor-pointer rounded-lg bg-white/5 py-4 px-5 text-white shadow-md transition focus:outline-none data-[focus]:outline-1 data-[focus]:outline-white data-[checked]:bg-white/10"
|
|
|
|
>
|
|
|
|
<div className="flex w-full items-center justify-between">
|
|
|
|
<div className="text-sm/6 pr-5">
|
|
|
|
<p className="font-semibold text-white">{plan.name}</p>
|
|
|
|
<div className="flex gap-2 text-white/50">
|
|
|
|
<div>{plan.desc}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<CheckCircleIcon className="size-5 opacity-0 transition group-data-[checked]:opacity-100" />
|
|
|
|
</div>
|
|
|
|
</Radio>
|
|
|
|
))}
|
|
|
|
</RadioGroup>
|
2024-06-02 11:47:22 +03:00
|
|
|
{/* <a
|
2024-06-01 15:47:53 +03:00
|
|
|
href={link}
|
2024-06-02 10:28:44 +03:00
|
|
|
className="rounded-md text-sm font-semibold border text-gray-200 shadow-sm hover:text-gray-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
|
2024-06-02 09:47:54 +03:00
|
|
|
style={{ paddingLeft: '50px', paddingRight: '50px', paddingTop: '20px', paddingBottom: '20px'}}
|
2024-06-01 15:47:53 +03:00
|
|
|
>
|
2024-06-02 09:56:00 +03:00
|
|
|
|
2024-06-01 15:47:53 +03:00
|
|
|
Begin
|
2024-06-02 11:47:22 +03:00
|
|
|
</a> */}
|
|
|
|
<LinkButton text="Begin" href={link} onPress={()=>setClicked(true)}/>
|
2024-06-01 15:47:53 +03:00
|
|
|
</div>
|
2024-06-02 11:47:22 +03:00
|
|
|
</motion.div>
|
2024-06-01 15:47:53 +03:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-06-01 16:57:47 +03:00
|
|
|
export default TopicCard;
|