11import type { PhoneType } from "../types"
2+ import type { ChatTheme } from "../theme"
23
34type ChatHeaderProps = {
45 contactName : string
56 contactStatus : string
6- darkMode : boolean
7+ theme : ChatTheme
78 phoneType : PhoneType
89}
910
@@ -39,41 +40,50 @@ function Avatar({ size = 36 }: { size?: number }) {
3940function AndroidHeader ( {
4041 contactName,
4142 contactStatus,
42- darkMode ,
43+ theme ,
4344} : Omit < ChatHeaderProps , "phoneType" > ) {
44- const bgColor = darkMode ? "#202c33" : "#008069"
45+ const bgColor = theme . header . background
46+ const textColor = theme . header . text
47+ const subtitleColor = theme . header . subtitle
48+ const iconColor = theme . header . accent
4549
4650 return (
4751 < div
4852 className = "flex items-center gap-2 px-2 py-1.5"
4953 style = { { backgroundColor : bgColor , minHeight : "52px" } }
5054 >
5155 { /* Back arrow */ }
52- < svg viewBox = "0 0 24 24" width = "24" height = "24" fill = "white" >
56+ < svg viewBox = "0 0 24 24" width = "24" height = "24" fill = { iconColor } >
5357 < path d = "M12 4l1.4 1.4L7.8 11H20v2H7.8l5.6 5.6L12 20l-8-8z" />
5458 </ svg >
5559
5660 < Avatar size = { 38 } />
5761
5862 < div className = "flex-1 min-w-0" >
59- < p className = "text-white text-[16px] font-normal leading-tight truncate" >
63+ < p
64+ className = "text-[16px] font-normal leading-tight truncate"
65+ style = { { color : textColor } }
66+ >
6067 { contactName }
6168 </ p >
6269 { contactStatus && (
63- < p className = "text-[12px] leading-tight truncate text-white/70" >
70+ < p
71+ className = "text-[12px] leading-tight truncate"
72+ style = { { color : subtitleColor } }
73+ >
6474 { contactStatus }
6575 </ p >
6676 ) }
6777 </ div >
6878
6979 < div className = "flex items-center gap-4 mr-1" >
70- < svg viewBox = "0 0 24 24" width = "22" height = "22" fill = "white" >
80+ < svg viewBox = "0 0 24 24" width = "22" height = "22" fill = { iconColor } >
7181 < path d = "M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z" />
7282 </ svg >
73- < svg viewBox = "0 0 24 24" width = "22" height = "22" fill = "white" >
83+ < svg viewBox = "0 0 24 24" width = "22" height = "22" fill = { iconColor } >
7484 < path d = "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" />
7585 </ svg >
76- < svg viewBox = "0 0 24 24" width = "22" height = "22" fill = "white" >
86+ < svg viewBox = "0 0 24 24" width = "22" height = "22" fill = { iconColor } >
7787 < path d = "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />
7888 </ svg >
7989 </ div >
@@ -84,13 +94,13 @@ function AndroidHeader({
8494function IPhoneHeader ( {
8595 contactName,
8696 contactStatus,
87- darkMode ,
97+ theme ,
8898} : Omit < ChatHeaderProps , "phoneType" > ) {
89- const bgColor = darkMode ? "#1a1a1e" : "#f6f6f6"
90- const textColor = darkMode ? "#ffffff" : "#000000"
91- const accentColor = darkMode ? "#0a84ff" : "#007aff"
92- const subtitleColor = darkMode ? "#8e8e93" : "#8e8e93"
93- const borderColor = darkMode ? "#38383a" : "#d1d1d6"
99+ const bgColor = theme . header . background
100+ const textColor = theme . header . text
101+ const accentColor = theme . header . accent
102+ const subtitleColor = theme . header . subtitle
103+ const borderColor = theme . header . border
94104
95105 return (
96106 < div
@@ -151,10 +161,10 @@ function IPhoneHeader({
151161export function ChatHeader ( {
152162 contactName,
153163 contactStatus,
154- darkMode ,
164+ theme ,
155165 phoneType,
156166} : ChatHeaderProps ) {
157- const props = { contactName, contactStatus, darkMode }
167+ const props = { contactName, contactStatus, theme }
158168 if ( phoneType === "iphone" ) {
159169 return < IPhoneHeader { ...props } />
160170 }
0 commit comments