Skip to content

Commit

Permalink
style: format code with Prettier
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 686ac14 according to the output
from Prettier.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored and raspberri05 committed Dec 13, 2024
1 parent 686ac14 commit 2dfd4ac
Show file tree
Hide file tree
Showing 4 changed files with 224 additions and 217 deletions.
5 changes: 1 addition & 4 deletions app/contact/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ export const metadata: Metadata = {
};

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>{children}</div>

);
return <div>{children}</div>;
}
4 changes: 2 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ModeToggle from "@/components/mode-toggle";
import Nav from "@/components/nav";
import Footer from "@/components/footer";
import Script from "next/script";
import { Toaster } from "@/components/ui/toaster"
import { Toaster } from "@/components/ui/toaster";
export const metadata: Metadata = {
title: {
template: "%s | Persona.fm",
Expand Down Expand Up @@ -64,7 +64,7 @@ export default function RootLayout({
>
{children}
</div>
<Toaster/>
<Toaster />
<Footer />
<ModeToggle />
</ThemeProvider>
Expand Down
128 changes: 70 additions & 58 deletions components/contact.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,76 @@
"use client"
"use client";

import { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
import { useToast } from "@/hooks/use-toast"
import { useState, useRef } from "react"
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
import { useToast } from "@/hooks/use-toast";
import { useState, useRef } from "react";

export default function ContactForm() {
const [isLoading, setIsLoading] = useState(false)
const { toast } = useToast()
const formRef = useRef<HTMLFormElement>(null) // Add form reference
async function onSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
setIsLoading(true)
const [isLoading, setIsLoading] = useState(false);
const { toast } = useToast();
const formRef = useRef<HTMLFormElement>(null); // Add form reference
async function onSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
setIsLoading(true);

// Simulate form submission
await new Promise((resolve) => setTimeout(resolve, 1000))

setIsLoading(false)
toast({
title: "Message sent",
description: "We'll get back to you within 3 business days.",
})


formRef.current?.reset()
}
// Simulate form submission
await new Promise((resolve) => setTimeout(resolve, 1000));

return (
<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>Contact Us</CardTitle>
<CardDescription>
Report a bug, request a feature, or submit feedback
</CardDescription>
</CardHeader>
<CardContent>
<form ref={formRef} onSubmit={onSubmit} className="space-y-4">

<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input id="email" type="email" placeholder="Enter your email" required />
</div>
<div className="space-y-2">
<Label htmlFor="message">Message</Label>
<Textarea
id="message"
placeholder="Type your message here"
className="min-h-[100px]"
required
/>
</div>
<Button type="submit" className="w-full" disabled={isLoading}>
{isLoading ? "Sending..." : "Send message"}
</Button>
</form>
</CardContent>
</Card>
)
}
setIsLoading(false);
toast({
title: "Message sent",
description: "We'll get back to you within 3 business days.",
});

formRef.current?.reset();
}

return (
<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>Contact Us</CardTitle>
<CardDescription>
Report a bug, request a feature, or submit feedback
</CardDescription>
</CardHeader>
<CardContent>
<form ref={formRef} onSubmit={onSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="email">Email</Label>
<Input
id="email"
type="email"
placeholder="Enter your email"
required
/>
</div>
<div className="space-y-2">
<Label htmlFor="message">Message</Label>
<Textarea
id="message"
placeholder="Type your message here"
className="min-h-[100px]"
required
/>
</div>
<Button
type="submit"
className="w-full"
disabled={isLoading}
>
{isLoading ? "Sending..." : "Send message"}
</Button>
</form>
</CardContent>
</Card>
);
}
Loading

0 comments on commit 2dfd4ac

Please sign in to comment.