cal.pub0.org/pages/sandbox/RadioArea.tsx

105 lines
3.9 KiB
TypeScript
Raw Permalink Normal View History

Feature/round robin (#613) * Heavy WIP * More WIP * Playing with backwards compat * Moar wip * wip * Email changes for group feature * Committing in redundant migrations for reference * Combine all WIP migrations into a single feature migration * Make backup of current version of radio area pending refactor * Improved accessibility through keyboard * Cleanup in seperate commit so I can cherrypick later * Added RadioArea component * wip * Ignore .yarn file * Kinda stable * Getting closer... * Hide header when there are only personal events * Added uid to event create, updated EventTypeDescription * Delete redundant migration * Committing new team related migrations * Optimising & implemented backwards compatibility * Removed now redundant pages * Undid prototyping to calendarClient I did not end up using * Properly typed Select & fixed lint throughout * How'd that get here, removed. * TODO: investigate why userData is not compatible with passed type * This likely matches the event type that is created for a user * Few bugfixes * Adding datepicker optimisations * Fixed new event type spacing, initial profile should always be there * Gave NEXT_PUBLIC_BASE_URL a try but I think it's not the right solution * Updated EventTypeDescription to account for long titles, added logo to team page. * Added logo to team query * Added cancel Cypress test because an upcoming merge contains changes * Fix for when the event type description is long * Turned Theme into the useTheme hook, and made it fully compatible with teams pages * Built AvatarGroup ui component + moved Avatar to ui * Give the avatar some space fom the description * Fixed timeZone selector * Disabled tooltip +1-... Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
2021-09-14 08:45:28 +00:00
import Head from "next/head";
import React, { useState } from "react";
import * as RadioArea from "@components/ui/form/radio-area";
Feature/round robin (#613) * Heavy WIP * More WIP * Playing with backwards compat * Moar wip * wip * Email changes for group feature * Committing in redundant migrations for reference * Combine all WIP migrations into a single feature migration * Make backup of current version of radio area pending refactor * Improved accessibility through keyboard * Cleanup in seperate commit so I can cherrypick later * Added RadioArea component * wip * Ignore .yarn file * Kinda stable * Getting closer... * Hide header when there are only personal events * Added uid to event create, updated EventTypeDescription * Delete redundant migration * Committing new team related migrations * Optimising & implemented backwards compatibility * Removed now redundant pages * Undid prototyping to calendarClient I did not end up using * Properly typed Select & fixed lint throughout * How'd that get here, removed. * TODO: investigate why userData is not compatible with passed type * This likely matches the event type that is created for a user * Few bugfixes * Adding datepicker optimisations * Fixed new event type spacing, initial profile should always be there * Gave NEXT_PUBLIC_BASE_URL a try but I think it's not the right solution * Updated EventTypeDescription to account for long titles, added logo to team page. * Added logo to team query * Added cancel Cypress test because an upcoming merge contains changes * Fix for when the event type description is long * Turned Theme into the useTheme hook, and made it fully compatible with teams pages * Built AvatarGroup ui component + moved Avatar to ui * Give the avatar some space fom the description * Fixed timeZone selector * Disabled tooltip +1-... Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
2021-09-14 08:45:28 +00:00
const selectOptions = [
{
value: "rabbit",
label: "Rabbit",
description: "Fast and hard.",
},
{
value: "turtle",
label: "Turtle",
description: "Slow and steady.",
},
];
export default function RadioAreaPage() {
const [formData, setFormData] = useState({});
const onSubmit = (e) => {
e.preventDefault();
};
return (
<>
<Head>
<meta name="googlebot" content="noindex" />
</Head>
<div className="w-full p-4">
<h1 className="text-4xl mb-4">RadioArea component</h1>
<form onSubmit={onSubmit} className="space-y-4 mb-2">
<RadioArea.Group
onChange={(radioGroup_1: string) => setFormData({ ...formData, radioGroup_1 })}
className="flex space-x-4 max-w-screen-md"
name="radioGroup_1">
<RadioArea.Item value="radioGroup_1_radio_1" className="flex-grow bg-white">
<strong className="mb-1">radioGroup_1_radio_1</strong>
<p>Description #1</p>
</RadioArea.Item>
<RadioArea.Item value="radioGroup_1_radio_2" className="flex-grow bg-white">
<strong className="mb-1">radioGroup_1_radio_2</strong>
<p>Description #2</p>
</RadioArea.Item>
<RadioArea.Item value="radioGroup_1_radio_3" className="flex-grow bg-white">
<strong className="mb-1">radioGroup_1_radio_3</strong>
<p>Description #3</p>
</RadioArea.Item>
</RadioArea.Group>
<RadioArea.Group
onChange={(radioGroup_2: string) => setFormData({ ...formData, radioGroup_2 })}
className="flex space-x-4 max-w-screen-md"
name="radioGroup_2">
<RadioArea.Item value="radioGroup_2_radio_1" className="flex-grow bg-white">
<strong className="mb-1">radioGroup_1_radio_1</strong>
<p>Description #1</p>
</RadioArea.Item>
<RadioArea.Item value="radioGroup_2_radio_2" className="flex-grow bg-white" defaultChecked={true}>
<strong className="mb-1">radioGroup_1_radio_2</strong>
<p>Description #2</p>
</RadioArea.Item>
<RadioArea.Item value="radioGroup_2_radio_3" className="flex-grow bg-white">
<strong className="mb-1">radioGroup_1_radio_3</strong>
<p>Description #3</p>
</RadioArea.Item>
</RadioArea.Group>
<div>
<p className="text-lg">Disabled RadioAreaSelect</p>
<RadioArea.Select options={[]} className="max-w-screen-md" />
</div>
<div>
<p className="text-lg">RadioArea disabled with custom placeholder</p>
<RadioArea.Select
className="max-w-screen-md"
options={[]}
placeholder="Does the rabbit or the turtle win the race?"></RadioArea.Select>
</div>
<div>
<p className="text-lg">RadioArea with options</p>
<RadioArea.Select
className="max-w-screen-md"
name="turtleOrRabbitWinsTheRace"
onChange={(turtleOrRabbitWinsTheRace: string) =>
setFormData({ ...formData, turtleOrRabbitWinsTheRace })
}
options={selectOptions}
placeholder="Does the rabbit or the turtle win the race?"></RadioArea.Select>
</div>
<div>
<p className="text-lg">RadioArea with default selected (disabled for clarity)</p>
<RadioArea.Select
disabled={true}
className="max-w-screen-md"
value="turtle"
options={selectOptions}></RadioArea.Select>
</div>
</form>
<pre>{JSON.stringify(formData)}</pre>
</div>
</>
);
}