diff --git a/examples/to-do-example/package.json b/examples/to-do-example/package.json index 1c3a22c5a..9fa8b0363 100644 --- a/examples/to-do-example/package.json +++ b/examples/to-do-example/package.json @@ -12,6 +12,7 @@ "@heroicons/react": "^2.0.13", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-slot": "^1.0.2", + "@trigger.dev/companyicons": "^1.5.8", "@types/node": "20.3.1", "@types/react": "^18.0.21", "@types/react-dom": "^18.0.6", diff --git a/examples/to-do-example/src/app/components/Cards.tsx b/examples/to-do-example/src/app/components/Cards.tsx index 8a8a51622..abc9e0a41 100644 --- a/examples/to-do-example/src/app/components/Cards.tsx +++ b/examples/to-do-example/src/app/components/Cards.tsx @@ -1,3 +1,5 @@ +"use client"; + import { Accordion, AccordionItem, @@ -6,11 +8,13 @@ import { } from "./ui/accordion"; import { Paragraph } from "./Paragraph"; import { Header4 } from "./Header"; +import { CheckCircleIcon, EnvelopeIcon } from "@heroicons/react/24/solid"; import { - BellAlertIcon, - EnvelopeIcon, - MapIcon, -} from "@heroicons/react/24/solid"; + SlackIcon, + GitHubLightIcon, + LinearLightIcon, +} from "@trigger.dev/companyicons"; +import { Content } from "next/font/google"; const accordianContentVariants = { summaryEmailCard: { @@ -19,23 +23,27 @@ const accordianContentVariants = { inactiveBodyText: "Enter your email and pick any time of the week to get a summary sent straight to your inbox.", activeHeaderText: "Weekly summary email", - activeBodyText: "Scheduled for", + activeBodyReactContent: ( + + Scheduled for + + ), }, dailySlackSummary: { - icon: , + icon: , inactiveHeaderText: "Post a daily summary to Slack", inactiveBodyText: "Connect to Slack and send a daily summary to any public channel.", activeHeaderText: "Daily Slack summary", - activeBodyText: "Scheduled for", + activeBodyReactContent: "Scheduled for", }, githubIssuesSync: { - icon: , + icon: , inactiveHeaderText: "Sync GitHub issues", inactiveBodyText: "Connect to Github, select a repo and sync open GitHub issues to this list.", activeHeaderText: "GitHub issues are synced", - activeBodyText: "Synced using the GitHub webhook", + activeBodyReactContent: "Synced using the GitHub webhook", }, }; @@ -44,50 +52,45 @@ type AccordianTriggerProps = { accordianContentVariant: keyof typeof accordianContentVariants; id?: string; active: boolean; + scheduledTime: string; }; export function AccordianTriggerContent({ active, accordianContentVariant, + scheduledTime, }: AccordianTriggerProps) { + const contentVariants = accordianContentVariants[accordianContentVariant]; return (
-
- {accordianContentVariants[accordianContentVariant].icon} -
+
{contentVariants.icon}
{" "} - {active ? ( - <> - { - accordianContentVariants[accordianContentVariant] - .activeHeaderText - } - - ) : ( - <> - { - accordianContentVariants[accordianContentVariant] - .inactiveHeaderText - } - - )} + {active + ? contentVariants.activeHeaderText + : contentVariants.inactiveHeaderText}
- - {active ? ( - <> - {accordianContentVariants[accordianContentVariant].activeBodyText} - - ) : ( - <> - {accordianContentVariants[accordianContentVariant].inactiveBodyText} - - )} - + {active ? ( + <> +
+ + contentVariants.activeBodyReactContent + + {scheduledTime} + +
+ + ) : ( + contentVariants.inactiveBodyText + )}
); } @@ -97,12 +100,14 @@ type CardProps = { children: React.ReactNode; active: boolean; accordianContentVariant: keyof typeof accordianContentVariants; + scheduledTime: string; }; export function TriggerCard({ accordianContentVariant, active, children, + scheduledTime, }: CardProps) { return ( @@ -111,6 +116,7 @@ export function TriggerCard({ {children} @@ -119,22 +125,78 @@ export function TriggerCard({ ); } +const SyncCardVariants = { + linearSyncVariant: { + icon: , + inactiveHeaderText: "Setup a weekly summary email", + activeHeaderText: "Weekly summary email", + activeBodyReactContent: ( + + Scheduled for + + ), + inProgressReactContent:
Syncing...
, + }, +}; + +type SyncCardProps = { + className?: string; + syncCardVariant: keyof typeof SyncCardVariants; + active: boolean; + scheduledTime: string; +}; + export function TriggerSyncCard({ - accordianContentVariant, active, - children, -}: CardProps) { + syncCardVariant, + scheduledTime, +}: SyncCardProps) { + const syncVariant = SyncCardVariants[syncCardVariant]; return ( - - - - - - {children} - - + <> +
+
+
+
+
{syncVariant.icon}
+ + {active + ? syncVariant.activeHeaderText + : syncVariant.inactiveHeaderText} + +
+
+ {" "} + {active ? ( + + ) : ( + + )} +
+
+
+ {active ? ( + <> +
+ + syncVariant.activeBodyReactContent + + {scheduledTime} + +
+ + ) : ( + <>{} + )} +
+ ); } diff --git a/examples/to-do-example/src/app/components/ui/accordion.tsx b/examples/to-do-example/src/app/components/ui/accordion.tsx index 6dc6e656e..7984062f8 100644 --- a/examples/to-do-example/src/app/components/ui/accordion.tsx +++ b/examples/to-do-example/src/app/components/ui/accordion.tsx @@ -1,5 +1,3 @@ -"use client"; - import * as React from "react"; import * as AccordionPrimitive from "@radix-ui/react-accordion"; import { cn } from "@/utils/cn"; @@ -13,7 +11,10 @@ const AccordionItem = React.forwardRef< >(({ className, ...props }, ref) => ( )); diff --git a/examples/to-do-example/src/app/page.tsx b/examples/to-do-example/src/app/page.tsx index 60ebe6112..a988bbaaf 100644 --- a/examples/to-do-example/src/app/page.tsx +++ b/examples/to-do-example/src/app/page.tsx @@ -1,4 +1,4 @@ -import { TriggerCard } from "./components/Cards"; +import { TriggerCard, TriggerSyncCard } from "./components/Cards"; import { Header1, Header2 } from "./components/Header"; import { Paragraph } from "./components/Paragraph"; import { PrimaryGradientText } from "./components/TextStyling"; @@ -82,17 +82,31 @@ export default function Home() {
Stuff goes here - + Stuff goes here - + Stuff goes here + );