diff --git a/src/components/views/ReferralsView.tsx b/src/components/views/ReferralsView.tsx index 38199a0..c50d343 100644 --- a/src/components/views/ReferralsView.tsx +++ b/src/components/views/ReferralsView.tsx @@ -1,4 +1,4 @@ -import { useState, useRef } from 'react' +import { useState } from 'react' import { Send, Mail, Phone, MapPin, ExternalLink, Loader2, CheckCircle } from 'lucide-react' import { patient } from '@/data/patient' @@ -19,6 +19,11 @@ interface FormErrors { referrerEmail?: string } +const prefersReducedMotion = + typeof window !== 'undefined' + ? window.matchMedia('(prefers-reduced-motion: reduce)').matches + : false + function generateRefNumber(): string { const now = new Date() const year = now.getFullYear() @@ -48,9 +53,9 @@ function PriorityOption({ } const labelColors: Record = { - urgent: 'text-red-700', + urgent: 'text-red-600', routine: 'text-pmr-nhsblue', - 'two-week-wait': 'text-amber-700', + 'two-week-wait': 'text-amber-600', } return ( @@ -70,9 +75,9 @@ function PriorityOption({ > {selected && } - {label} + {label} {tooltip} @@ -109,7 +114,7 @@ function ContactMethodOption({ > {selected && } - {label} + {label} ) } @@ -129,12 +134,12 @@ function FormField({ }) { return (
-
) } @@ -173,29 +178,29 @@ function DirectContactTable() { ] return ( -
-
-

+
+
+

Direct Contact

-
+
{contactMethods.map((method) => ( -
+
- {method.label} + {method.label} {method.href ? ( {method.value} ) : ( - {method.value} + {method.value} )}
{method.href && ( @@ -203,7 +208,7 @@ function DirectContactTable() { href={method.href} target={method.external ? '_blank' : undefined} rel={method.external ? 'noopener noreferrer' : undefined} - className="font-inter text-xs text-pmr-nhsblue hover:underline flex items-center gap-1" + className="font-ui text-xs text-pmr-nhsblue hover:underline flex items-center gap-1 focus-visible:ring-2 focus-visible:ring-pmr-nhsblue/40 focus-visible:outline-none rounded" > {method.action} {method.external && } @@ -217,10 +222,6 @@ function DirectContactTable() { } export function ReferralsView() { - const prefersReducedMotion = useRef( - window.matchMedia('(prefers-reduced-motion: reduce)').matches - ).current - const [formData, setFormData] = useState({ priority: 'routine', referrerName: '', @@ -281,9 +282,9 @@ export function ReferralsView() { if (isSuccess) { return (
-
-
-

+
+
+

New Referral

@@ -295,16 +296,16 @@ export function ReferralsView() { >
-

+

Referral sent successfully

-

Reference: {refNumber}

-

+

Reference: {refNumber}

+

Expected response time: 24-48 hours

@@ -317,33 +318,33 @@ export function ReferralsView() { return (
-
-
-

+
+
+

New Referral

-

+

Contact Andy using a clinical referral form format.

- + Referring to - {patient.name} + {patient.name}
- + NHS Number - {patient.nhsNumber} + {patient.nhsNumber}
- + Priority
@@ -383,7 +384,7 @@ export function ReferralsView() { id="referrerName" value={formData.referrerName} onChange={(e) => setFormData({ ...formData, referrerName: e.target.value })} - className="w-full border border-gray-300 rounded px-3 py-2 text-sm font-inter text-gray-900 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/20 focus:outline-none transition-colors" + className="w-full border border-[#D1D5DB] rounded px-3 py-2 text-sm font-ui text-gray-900 placeholder-gray-400 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/15 focus:outline-none transition-all duration-200" placeholder="Your name" /> @@ -398,7 +399,7 @@ export function ReferralsView() { id="referrerEmail" value={formData.referrerEmail} onChange={(e) => setFormData({ ...formData, referrerEmail: e.target.value })} - className="w-full border border-gray-300 rounded px-3 py-2 text-sm font-inter text-gray-900 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/20 focus:outline-none transition-colors" + className="w-full border border-[#D1D5DB] rounded px-3 py-2 text-sm font-ui text-gray-900 placeholder-gray-400 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/15 focus:outline-none transition-all duration-200" placeholder="your.email@example.com" /> @@ -410,7 +411,7 @@ export function ReferralsView() { id="referrerOrg" value={formData.referrerOrg} onChange={(e) => setFormData({ ...formData, referrerOrg: e.target.value })} - className="w-full border border-gray-300 rounded px-3 py-2 text-sm font-inter text-gray-900 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/20 focus:outline-none transition-colors" + className="w-full border border-[#D1D5DB] rounded px-3 py-2 text-sm font-ui text-gray-900 placeholder-gray-400 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/15 focus:outline-none transition-all duration-200" placeholder="Organisation name (optional)" /> @@ -421,13 +422,13 @@ export function ReferralsView() { value={formData.reason} onChange={(e) => setFormData({ ...formData, reason: e.target.value })} rows={4} - className="w-full border border-gray-300 rounded px-3 py-2 text-sm font-inter text-gray-900 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/20 focus:outline-none transition-colors resize-y" + className="w-full border border-[#D1D5DB] rounded px-3 py-2 text-sm font-ui text-gray-900 placeholder-gray-400 focus:border-pmr-nhsblue focus:ring-2 focus:ring-pmr-nhsblue/15 focus:outline-none transition-all duration-200 resize-y" placeholder="Describe the opportunity or reason for contact..." />
- + Contact Method
@@ -452,18 +453,18 @@ export function ReferralsView() {
-
+