File size: 3,095 Bytes
c5cf697
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import ComsatsLogo from '../ComsatsLogo'

function UserCircleIcon({ className = '' }) {
  return (
    <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" aria-hidden>
      <path
        strokeLinecap="round"
        strokeLinejoin="round"
        d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"
      />
    </svg>
  )
}

function LogoutIcon({ className = '' }) {
  return (
    <svg className={className} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.75" aria-hidden>
      <path
        strokeLinecap="round"
        strokeLinejoin="round"
        d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15m3 0l3-3m0 0l-3-3m3 3H9"
      />
    </svg>
  )
}

export default function CollapsedSidebarRail({ onOpenSidebar, onEditProfile, onLogout }) {
  const railBtn =
    'flex w-full flex-col items-center gap-1 rounded-xl px-1 py-2 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-comsats-blue focus-visible:ring-offset-1'

  return (
    <aside
      className="hidden min-h-0 w-[84px] shrink-0 flex-col items-stretch border-r border-slate-200/70 bg-chat-sidebar px-1.5 py-3 shadow-[inset_-1px_0_0_rgba(0,0,0,0.04)] md:flex"
      aria-label="Collapsed sidebar"
    >
      <div className="flex flex-col items-center gap-2">
        <button
          type="button"
          onClick={onOpenSidebar}
          aria-label="Open sidebar"
          title="Open chats"
          className="rounded-xl bg-white p-1 shadow-md shadow-slate-900/8 ring-1 ring-slate-200/85 transition-all hover:ring-comsats-purple/35"
        >
          <ComsatsLogo className="h-9 w-9" />
        </button>
        <span className="max-w-full px-0.5 text-center text-[8px] font-semibold uppercase leading-tight tracking-wide text-slate-500">
          Chats
        </span>
        <div className="h-px w-10 max-w-full shrink-0 bg-slate-200/90" aria-hidden />
      </div>

      <div className="min-h-0 flex-1" aria-hidden />

      <div className="flex flex-col items-stretch gap-2 pb-1">
        <button
          type="button"
          onClick={onEditProfile}
          aria-label="Edit profile"
          title="Edit profile"
          className={`${railBtn} text-slate-700 hover:bg-white/90 hover:text-comsats-purple`}
        >
          <UserCircleIcon className="h-5 w-5 shrink-0 text-slate-600" />
          <span className="max-w-[4.75rem] text-center text-[8px] font-semibold leading-snug">
            Edit profile
          </span>
        </button>

        <button
          type="button"
          onClick={onLogout}
          aria-label="Log out"
          title="Log out"
          className={`${railBtn} text-red-700 hover:bg-red-50`}
        >
          <LogoutIcon className="h-5 w-5 shrink-0" />
          <span className="text-[9px] font-semibold leading-tight">Log out</span>
        </button>
      </div>
    </aside>
  )
}