Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced all TextAreaForm component with Textarea shadcn ui component #10277

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,7 @@
"no_beds_available": "No beds available",
"no_changes": "No changes",
"no_changes_made": "No changes made",
"no_comments_available": "No comments available",
"no_consultation_filed": "No consultation filed",
"no_consultation_history": "No consultation history available",
"no_consultation_updates": "No consultation updates",
Expand Down
56 changes: 0 additions & 56 deletions src/components/Form/FormFields/TextAreaFormField.tsx

This file was deleted.

14 changes: 7 additions & 7 deletions src/components/Resource/ResourceCommentSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { toast } from "sonner";
import PaginatedList from "@/CAREUI/misc/PaginatedList";

import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";

import { Avatar } from "@/components/Common/Avatar";
import CircularProgress from "@/components/Common/CircularProgress";
import TextAreaFormField from "@/components/Form/FormFields/TextAreaFormField";

import routes from "@/Utils/request/api";
import request from "@/Utils/request/request";
Expand Down Expand Up @@ -42,28 +42,28 @@ const CommentSection = (props: { id: string }) => {
>
{(_, query) => (
<div className="flex w-full flex-col">
<TextAreaFormField
<Textarea
name="comment"
placeholder="Type your comment"
placeholder={t("type_your_comment")}
value={commentBox}
onChange={(e) => setCommentBox(e.value)}
onChange={(e) => setCommentBox(e.target.value)}
/>

<div className="flex w-full justify-end">
<div className="flex w-full justify-end mt-2">
<Button
variant="primary"
onClick={async () => {
await onSubmitComment();
query.refetch();
}}
>
Post Your Comment
{t("post_your_comment")}
</Button>
</div>
<div className="w-full">
<div>
<PaginatedList.WhenEmpty className="flex w-full justify-center border-b border-secondary-200 bg-white p-5 text-center text-2xl font-bold text-secondary-500">
<span>No comments available</span>
<span>{t("no_comments_available")}</span>
</PaginatedList.WhenEmpty>
<PaginatedList.WhenLoading>
<CircularProgress className="h-12 w-12" />
Expand Down
19 changes: 14 additions & 5 deletions src/components/Resource/ResourceDetailsUpdate.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Textarea } from "@headlessui/react";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ig this was accidental, import form ui instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

import { t } from "i18next";
import { navigate, useQueryParams } from "raviger";
import { useReducer, useState } from "react";
Expand All @@ -6,6 +7,7 @@ import { toast } from "sonner";
import Card from "@/CAREUI/display/Card";

import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";

import CircularProgress from "@/components/Common/CircularProgress";
import { FacilitySelect } from "@/components/Common/FacilitySelect";
Expand All @@ -15,7 +17,6 @@ import UserAutocomplete from "@/components/Common/UserAutocompleteFormField";
import { FieldLabel } from "@/components/Form/FormFields/FormField";
import RadioFormField from "@/components/Form/FormFields/RadioFormField";
import { SelectFormField } from "@/components/Form/FormFields/SelectFormField";
import TextAreaFormField from "@/components/Form/FormFields/TextAreaFormField";
import TextFormField from "@/components/Form/FormFields/TextFormField";
import { FieldChangeEvent } from "@/components/Form/FormFields/Utils";
import { UserModel } from "@/components/Users/models";
Expand Down Expand Up @@ -254,15 +255,23 @@ export const ResourceDetailsUpdate = (props: resourceProps) => {
</div>

<div className="md:col-span-2">
<TextAreaFormField
<Label className="text-gray-700 mb-3 mt-1">
{t("request_reason")}
</Label>
<Textarea
rows={5}
name="reason"
placeholder="Type your description here"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing i18n

value={state.form.reason}
onChange={handleChange}
label="Reason of Request*"
error={state.errors.reason}
onChange={(e) =>
handleChange({ name: e.target.name, value: e.target.value })
}
/>
{state.errors.reason && (
<p className="text-red-500 text-sm mt-2">
{state.errors.emergency}
</p>
)}
</div>

<div>
Expand Down
Loading