-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stephen Cefali
committed
Jan 11, 2024
1 parent
6414320
commit 6fe9cb6
Showing
9 changed files
with
330 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from "react" | ||
|
||
import { cn } from "app/@/lib/utils" | ||
|
||
export interface TextareaProps | ||
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {} | ||
|
||
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>( | ||
({ className, ...props }, ref) => { | ||
return ( | ||
<textarea | ||
className={cn( | ||
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 mt-4 max-w-md", | ||
className | ||
)} | ||
ref={ref} | ||
{...props} | ||
/> | ||
) | ||
} | ||
) | ||
Textarea.displayName = "Textarea" | ||
|
||
export { Textarea } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Form, useLoaderData } from '@remix-run/react' | ||
import { GrAnnounce } from 'react-icons/gr' | ||
import * as Sentry from '@sentry/browser' | ||
import { createPortal } from 'react-dom' | ||
|
||
import { Button } from '~/@/components/ui/button' | ||
import { Input } from '~/@/components/ui/input' | ||
import { Textarea } from '~/@/components/ui/textarea' | ||
import { useState } from 'react' | ||
|
||
export default function FeedbackButton() { | ||
const { user } = useLoaderData() | ||
const [showModal, setShowModal] = useState(false) | ||
return ( | ||
<> | ||
{showModal && | ||
createPortal( | ||
<div | ||
className="fixed left-1/2 top-1/2 rounded-sm bg-accent p-8 " | ||
style={{ transform: 'translate(-50%, -50%)', width: '320px' }} | ||
> | ||
<Form | ||
className="m-auto flex flex-col" | ||
onSubmit={event => { | ||
event.preventDefault() | ||
console.log(event.target) | ||
const eventId = Sentry.captureMessage('User Feedback') | ||
const userFeedback = { | ||
event_id: eventId, | ||
...event.target, | ||
} | ||
Sentry.captureUserFeedback(userFeedback) | ||
setShowModal(false) | ||
}} | ||
> | ||
<Input type="text" placeholder="Name" value={user.name} /> | ||
<Input type="email" placeholder="Email" value={user.email} /> | ||
<Textarea placeholder="Enter your feedback" /> | ||
<Button className="mt-4 max-w-md w-max" type="submit"> | ||
Submit | ||
</Button> | ||
</Form> | ||
</div>, | ||
document.body, | ||
)} | ||
<Button | ||
className="gap-2" | ||
type="button" | ||
onClick={() => setShowModal(!showModal)} | ||
> | ||
<GrAnnounce /> | ||
Feedback | ||
</Button> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.