Skip to content

Commit

Permalink
Accessing patient data in server component
Browse files Browse the repository at this point in the history
and passing to its child
  • Loading branch information
ad956 committed Jun 8, 2024
1 parent 25b48bc commit 82beb9a
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions app/(pages)/patient/components/ProfileSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { getPatientData } from "@lib/patient";
"use client";

import { Patient } from "@/types";
import { Input, Button, Card, Avatar } from "@nextui-org/react";
import React from "react";
import React, { useState } from "react";
import { AiTwotoneEye, AiOutlineEyeInvisible } from "react-icons/ai";

export default async function ProfileSettings({
patient,
}: {
patient: Patient;
}) {
const [isVisible, setIsVisible] = useState(false);

export default async function ProfileSettings() {
const patient: Patient = await getPatientData();
const toggleVisibility = () => setIsVisible(!isVisible);

return (
<Card
Expand Down Expand Up @@ -59,11 +67,24 @@ export default async function ProfileSettings() {
className="max-w-xs"
/>
<Input
type="password"
type={isVisible ? "text" : "password"}
variant="underlined"
label="Password"
value={"your_password"}
className="max-w-xs"
endContent={
<button
className="focus:outline-none"
type="button"
onClick={toggleVisibility}
>
{isVisible ? (
<AiOutlineEyeInvisible className="text-2xl text-default-400 pointer-events-none" />
) : (
<AiTwotoneEye className="text-2xl text-default-400 pointer-events-none" />
)}
</button>
}
/>
<Input
type="text"
Expand Down

0 comments on commit 82beb9a

Please sign in to comment.