Skip to content

Commit

Permalink
Use textarea from shadcn
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee committed Oct 13, 2024
1 parent f671675 commit 4e8c71c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
26 changes: 26 additions & 0 deletions frontend/@/components/ui/textarea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from "react"

import { cn } from "@/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-[60px] w-full rounded-xl border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
"text-base",
"bg-flathub-gainsborow dark:bg-stone-900",
className,
)}
ref={ref}
{...props}
/>
)
},
)
Textarea.displayName = "Textarea"

export { Textarea }
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useMutation } from "@tanstack/react-query"
import { toast } from "react-toastify"
import { AxiosError } from "axios"
import { createTokensVendingappAppIdTokensPost } from "src/codegen"
import { Textarea } from "@/components/ui/textarea"

interface Props {
app: Pick<Appstream, "id">
Expand Down Expand Up @@ -65,11 +66,7 @@ const TokenCreateDialog: FunctionComponent<Props> = ({
>
<div className="space-y-3">
<div>{t("token-creation-placeholder")}</div>
<textarea
value={text}
onChange={textUpdate}
className="h-40 rounded-xl p-3 w-full"
/>
<Textarea value={text} onChange={textUpdate} className="h-40" />
</div>
</Modal>
</>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/application/DangerZoneControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { getUploadTokensUploadTokensAppIdGet } from "src/codegen"
import { Input } from "@/components/ui/input"
import { Appstream } from "src/types/Appstream"
import { Textarea } from "@/components/ui/textarea"

const SwitchToDirectUpload = ({ app }: { app: Pick<Appstream, "id"> }) => {
const { t } = useTranslation()
Expand Down Expand Up @@ -97,10 +98,10 @@ const ArchiveApp = ({ app }: { app: { id: string } }) => {
<div className="space-y-3">
<div>
{t("enter-end-of-life-message")}
<textarea
<Textarea
value={endoflife}
onChange={(e) => setEndoflife(e.target.value)}
className="h-20 rounded-xl p-3 w-full"
className="h-20"
/>
</div>
<div>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/moderation/ReviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
ModerationRequestResponse,
Permission,
} from "src/codegen"
import { Textarea } from "@/components/ui/textarea"

interface Props {
title: string
Expand Down Expand Up @@ -169,8 +170,8 @@ const ReviewCard: FunctionComponent<Props> = ({ title, request, children }) => {
disabled: modalState === "reject" && !comment,
}}
>
<textarea
className="h-40 w-full rounded-xl border border-flathub-sonic-silver p-3 dark:border-flathub-spanish-gray"
<Textarea
className="h-40"
value={comment}
placeholder={
modalState === "reject" ? "Comment" : "Comment (optional)"
Expand Down

0 comments on commit 4e8c71c

Please sign in to comment.