{props.user.name}
{props.eventType.title}
-+
{props.eventType.length} minutes
-{props.eventType.description}
+ + { isTimeOptionsOpen && +{props.eventType.description}
diff --git a/pages/[user]/[type].tsx b/pages/[user]/[type].tsx index 55e3ebff..d11933c1 100644 --- a/pages/[user]/[type].tsx +++ b/pages/[user]/[type].tsx @@ -4,6 +4,8 @@ import Link from 'next/link'; import prisma from '../../lib/prisma'; import { useRouter } from 'next/router'; const dayjs = require('dayjs'); +import { Switch } from '@headlessui/react'; +import { GlobeIcon, ChevronDownIcon } from '@heroicons/react/solid'; const isSameOrBefore = require('dayjs/plugin/isSameOrBefore'); const isBetween = require('dayjs/plugin/isBetween'); const utc = require('dayjs/plugin/utc'); @@ -13,19 +15,27 @@ dayjs.extend(isBetween); dayjs.extend(utc); dayjs.extend(timezone); -import getSlots from '../../lib/slots' +import getSlots from '../../lib/slots'; + +function classNames(...classes) { + return classes.filter(Boolean).join(' ') +} export default function Type(props) { // Initialise state const [selectedDate, setSelectedDate] = useState(''); const [selectedMonth, setSelectedMonth] = useState(dayjs().month()); const [loading, setLoading] = useState(false); + const [isTimeOptionsOpen, setIsTimeOptionsOpen] = useState(false); + const [is24h, setIs24h] = useState(false); const [busy, setBusy] = useState([]); // Get router variables const router = useRouter(); const { user } = router.query; + const toggleTimeOptions = () => { setIsTimeOptionsOpen(!isTimeOptionsOpen); } + // Handle month changes const incrementMonth = () => { setSelectedMonth(selectedMonth + 1); @@ -108,7 +118,7 @@ export default function Type(props) { const availableTimes = times.map((time) =>
+
{props.eventType.length} minutes
-{props.eventType.description}
+ + { isTimeOptionsOpen && +{props.eventType.description}