@pubuduth-aplicy/chat-ui 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubuduth-aplicy/chat-ui",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -1,4 +1,5 @@
1
1
  import { Sidebar } from './sidebar/Sidebar'
2
+ import '../index.css'
2
3
  // import MessageContainer from './components/messages/MessageContainer'
3
4
  // import useConversation from '../../zustand/useConversation';
4
5
 
@@ -8,8 +9,8 @@ export const Chat = () => {
8
9
  // const { selectedConversation, setSelectedConversation } = useConversation();
9
10
  return (
10
11
  <>
11
- <div className='container mx-auto mb-5'>
12
- <div className='grid grid-cols-1 md:grid-cols-9 sm:h-[450px] md:h-[550px] rounded-lg overflow-hidden bg-gray-400 bg-clip-padding backdrop-filter backdrop-blur-lg bg-opacity-0'>
12
+ <div className='container'>
13
+ <div className='grid bg-gray-400 bg-clip-padding backdrop-filter backdrop-blur-lg bg-opacity-0'>
13
14
  <div/>
14
15
  {/* {selectedConversation? (
15
16
  <><div className={`xs:hidden md:grid md:col-span-3 border max-h-screen overflow-y-auto`}><Sidebar /></div>
@@ -2,6 +2,7 @@
2
2
  // import useConversation from "../../zustand/useConversation";
3
3
 
4
4
  import useChatUIStore from "../../stores/Zustant";
5
+ import '../../index.css'
5
6
 
6
7
  interface ConversationProps {
7
8
  conversation: {
@@ -21,24 +22,23 @@ const Conversation = ({ conversation, lastIdx }: ConversationProps) => {
21
22
  return (
22
23
  <>
23
24
  <div
24
- className={` h-[72px] p-2 py-3 hover:bg-sky-500 rounded justify-start items-center cursor-pointer gap-4 inline-flex
25
- `}
25
+ className={`conversation-item`}
26
26
  onClick={() => setSelectedConversation(conversation)}
27
27
  >
28
28
  <img
29
- className="w-12 h-12 relative rounded-[100px]"
29
+ className="conversation-image"
30
30
  src={conversation.profilePic}
31
31
  />
32
- <div className="grow shrink basis-0 flex-col justify-start items-start gap-1 inline-flex">
32
+ <div className="conversation-content">
33
33
  <div className="self-stretch justify-start items-center inline-flex">
34
- <div className="grow shrink basis-0 text-slate-900 text-base font-semibold font-['Inter'] leading-tight">
34
+ <div className="conversation-username">
35
35
  {conversation.username}
36
36
  </div>
37
37
  </div>
38
38
  </div>
39
39
  </div>
40
40
 
41
- {!lastIdx && <div className="divider my-0 py-0 h-1" />}
41
+ {!lastIdx && <div className="divider" />}
42
42
  </>
43
43
  );
44
44
  };
@@ -3,7 +3,7 @@
3
3
  import { useGetConversations } from "../../hooks/queries/useChatApi";
4
4
  import { useChatContext } from "../../providers/ChatProvider";
5
5
  import Conversation from "./Conversation";
6
-
6
+ import '../../index.css'
7
7
  const Conversations = () => {
8
8
  const { userId } = useChatContext();
9
9
  const { data: conversations } = useGetConversations(userId);
@@ -11,7 +11,7 @@ const Conversations = () => {
11
11
  console.log("userId",userId);
12
12
  // const { loading, conversations } = useGetConversations();
13
13
  return (
14
- <div className="py-2 flex flex-col overflow-auto">
14
+ <div className="conversations">
15
15
  {conversations?.map((conversation: any, idx: any) => (
16
16
  <Conversation
17
17
  key={conversation._id}
@@ -4,6 +4,7 @@ import searchicon from '../../assets/icons8-search.svg'
4
4
  import useChatUIStore from '../../stores/Zustant';
5
5
  import { useGetConversations } from '../../hooks/queries/useChatApi';
6
6
  import { useChatContext } from '../../providers/ChatProvider';
7
+ import '../../index.css'
7
8
  // import { MagnifyingGlass } from "@phosphor-icons/react"
8
9
  // import useGetConversations from "../../hooks/useGetConversations";
9
10
  // import useConversation from '../../zustand/useConversation'
@@ -36,10 +37,10 @@ const {userId} =useChatContext()
36
37
  <>
37
38
 
38
39
  <form onSubmit={handleSubmit}>
39
- <div className="self-stretch h-14 px-4 py-2 justify-start items-center gap-4 inline-flex">
40
- <div className="grow shrink basis-0 h-10 px-4 py-2 bg-neutral-100 rounded-[22px] justify-start items-center gap-4 flex">
41
- <img src={searchicon} className="w-6 h-6 pl-[2.50px] pr-[3px] pt-[2.50px] pb-[3px] justify-center items-center flex" />
42
- <input className="w-full h-5 text-slate-500 bg-neutral-100 outline-none text-base font-normal font-['Inter'] leading-tight"
40
+ <div className="searchContainer">
41
+ <div className="search">
42
+ <img src={searchicon} className="searchimg" />
43
+ <input className="searchinput"
43
44
  placeholder='Search…'
44
45
  value={search}
45
46
  onChange={(e) => setSearch(e.target.value)}
@@ -1,11 +1,12 @@
1
1
  import Conversations from "./Conversations";
2
2
  import SearchInput from "./SearchInput";
3
+ import '../../index.css'
3
4
 
4
5
  export const Sidebar = () => {
5
6
  return (
6
- <div className='flex-col border-r p-4 flex '>
7
+ <div className='sidebar'>
7
8
  <SearchInput />
8
- <div className='divider px-3'></div>
9
+ <div className='divider sidebarcon'></div>
9
10
  <Conversations />
10
11
 
11
12
  </div>
package/src/index.css ADDED
@@ -0,0 +1,153 @@
1
+ .sidebar {
2
+ display: flex;
3
+ flex-direction: column;
4
+ padding: 16px;
5
+ border-right: 1px;
6
+ }
7
+
8
+ .sidebarcon {
9
+ padding: 0 12px 0 12px;
10
+ }
11
+
12
+ .searchContainer {
13
+ display: inline-flex;
14
+ justify-content: start;
15
+ align-items: center;
16
+ gap: 16px;
17
+ padding: 8px 16px 8px 16px;
18
+ height: 56px;
19
+ align-self: stretch;
20
+ }
21
+
22
+ .search {
23
+ border-radius: 22px;
24
+ display: flex;
25
+ justify-content: start;
26
+ align-items: center;
27
+ gap: 16px;
28
+ background-color: #f5f5f5;
29
+ padding: 8px 16px 8px 16px;
30
+ flex-grow: 1;
31
+ flex-shrink: 1;
32
+ height: 40px;
33
+ }
34
+
35
+ .searchimg {
36
+ padding-left: 2.5px;
37
+ padding-right: 3px;
38
+ padding-top: 2.5px;
39
+ padding-bottom: 3px;
40
+ height: 24px;
41
+ width: 24px;
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ }
46
+
47
+ .searchinput {
48
+ width: 100%;
49
+ height: 20px;
50
+ background-color: #f5f5f5;
51
+ outline: none;
52
+ color: #64748b;
53
+ font-size: 16px;
54
+ font-weight: 400;
55
+ line-height: 1.25;
56
+ }
57
+
58
+ .conversation-item {
59
+ height: 72px;
60
+ padding: 0.5rem 0.75rem;
61
+ border-radius: 0.375rem;
62
+ /* equivalent to rounded */
63
+ display: inline-flex;
64
+ align-items: center;
65
+ justify-content: flex-start;
66
+ cursor: pointer;
67
+ gap: 1rem;
68
+ }
69
+
70
+ .conversation-item:hover {
71
+ background-color: #38bdf8;
72
+ /* equivalent to hover:bg-sky-500 */
73
+ }
74
+
75
+ /* CSS for the image */
76
+ .conversation-image {
77
+ width: 3rem;
78
+ height: 3rem;
79
+ border-radius: 50%;
80
+ position: relative;
81
+ }
82
+
83
+ /* CSS for the inner div */
84
+ .conversation-content {
85
+ display: inline-flex;
86
+ flex-direction: column;
87
+ justify-content: flex-start;
88
+ align-items: flex-start;
89
+ gap: 0.25rem;
90
+ flex-grow: 1;
91
+ flex-shrink: 0;
92
+ flex-basis: 0;
93
+ }
94
+
95
+ /* CSS for the username */
96
+ .conversation-username {
97
+ display: inline-flex;
98
+ align-items: center;
99
+ justify-content: flex-start;
100
+ flex-grow: 1;
101
+ font-family: 'Inter', sans-serif;
102
+ font-size: 1rem;
103
+ font-weight: 600;
104
+ color: #1e293b;
105
+ line-height: 1.25rem;
106
+ }
107
+
108
+ /* Divider */
109
+ .divider {
110
+ height: 0.25rem;
111
+ /* equivalent to h-1 */
112
+ margin: 0;
113
+ padding: 0;
114
+ }
115
+
116
+ .conversations{
117
+ display: flex;
118
+ flex-direction: column;
119
+ overflow: auto;
120
+ padding: 8px 0 8px 0;
121
+ }
122
+
123
+ .container {
124
+ max-width: 100%;
125
+ margin-left: auto;
126
+ margin-right: auto;
127
+ margin-bottom: 1.25rem; /* mb-5 */
128
+ }
129
+
130
+ /* Grid Layout */
131
+ .grid {
132
+ display: grid;
133
+ grid-template-columns: repeat(1, 1fr); /* grid-cols-1 */
134
+ }
135
+
136
+ @media (min-width: 768px) {
137
+ .md\:grid-cols-9 {
138
+ grid-template-columns: repeat(9, 1fr); /* md:grid-cols-9 */
139
+ }
140
+ }
141
+
142
+ @media (min-width: 640px) {
143
+ .sm\:h-\[450px\] {
144
+ height: 450px; /* sm:h-[450px] */
145
+ }
146
+ }
147
+
148
+ @media (min-width: 768px) {
149
+ .md\:h-\[550px\] {
150
+ height: 550px; /* md:h-[550px] */
151
+ }
152
+ }
153
+