From 82beb9ab5e0e953a04332f9b78a9cc11dcf8d4d6 Mon Sep 17 00:00:00 2001 From: Anand Suthar Date: Sat, 8 Jun 2024 23:15:41 +0530 Subject: [PATCH] Accessing patient data in server component and passing to its child --- .../components/ProfileSettings/index.tsx | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/app/(pages)/patient/components/ProfileSettings/index.tsx b/app/(pages)/patient/components/ProfileSettings/index.tsx index 8994826..399fc11 100644 --- a/app/(pages)/patient/components/ProfileSettings/index.tsx +++ b/app/(pages)/patient/components/ProfileSettings/index.tsx @@ -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 ( + {isVisible ? ( + + ) : ( + + )} + + } />