walolorj commited on
Commit
8dbb3cf
·
verified ·
1 Parent(s): 5b47b4a

make it a social media app

Browse files
Files changed (4) hide show
  1. components/stories.js +102 -0
  2. index.html +112 -69
  3. script.js +112 -62
  4. style.css +18 -6
components/stories.js ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomStories extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .stories-container {
7
+ display: flex;
8
+ gap: 0.75rem;
9
+ padding: 1rem;
10
+ overflow-x: auto;
11
+ scrollbar-width: none;
12
+ }
13
+ .stories-container::-webkit-scrollbar {
14
+ display: none;
15
+ }
16
+ .story {
17
+ display: flex;
18
+ flex-direction: column;
19
+ align-items: center;
20
+ flex-shrink: 0;
21
+ }
22
+ .story-avatar {
23
+ width: 3.5rem;
24
+ height: 3.5rem;
25
+ border-radius: 9999px;
26
+ padding: 0.125rem;
27
+ background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
28
+ }
29
+ .story-avatar-inner {
30
+ width: 100%;
31
+ height: 100%;
32
+ border-radius: 9999px;
33
+ border: 2px solid white;
34
+ overflow: hidden;
35
+ }
36
+ .story-avatar-inner img {
37
+ width: 100%;
38
+ height: 100%;
39
+ object-fit: cover;
40
+ }
41
+ .story-username {
42
+ margin-top: 0.25rem;
43
+ font-size: 0.75rem;
44
+ text-align: center;
45
+ }
46
+ .add-story {
47
+ position: relative;
48
+ width: 3.5rem;
49
+ height: 3.5rem;
50
+ border-radius: 9999px;
51
+ background: #f1f5f9;
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ }
56
+ .add-story-icon {
57
+ position: absolute;
58
+ bottom: 0;
59
+ right: 0;
60
+ width: 1.25rem;
61
+ height: 1.25rem;
62
+ background: #3b82f6;
63
+ border-radius: 9999px;
64
+ display: flex;
65
+ align-items: center;
66
+ justify-content: center;
67
+ color: white;
68
+ }
69
+ </style>
70
+ <div class="stories-container">
71
+ <div class="story">
72
+ <div class="add-story">
73
+ <img src="http://static.photos/people/200x200/1" width="100%" height="100%" style="border-radius: 9999px;">
74
+ <div class="add-story-icon">
75
+ <i data-feather="plus" width="12" height="12"></i>
76
+ </div>
77
+ </div>
78
+ <span class="story-username">Your Story</span>
79
+ </div>
80
+ ${[1,2,3,4,5].map(i => `
81
+ <div class="story">
82
+ <div class="story-avatar">
83
+ <div class="story-avatar-inner">
84
+ <img src="http://static.photos/people/200x200/${i+10}">
85
+ </div>
86
+ </div>
87
+ <span class="story-username">user${i}</span>
88
+ </div>
89
+ `).join('')}
90
+ </div>
91
+ `;
92
+
93
+ // Initialize Feather icons
94
+ setTimeout(() => {
95
+ if (typeof feather !== 'undefined') {
96
+ feather.replace({ shadowRoot: this.shadowRoot });
97
+ }
98
+ }, 100);
99
+ }
100
+ }
101
+
102
+ customElements.define('custom-stories', CustomStories);
index.html CHANGED
@@ -11,8 +11,8 @@
11
  </head>
12
  <body class="bg-gray-50 text-gray-900">
13
  <custom-navbar></custom-navbar>
14
-
15
- <main class="container mx-auto px-4 py-8">
16
  <div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
17
  <!-- Left Sidebar -->
18
  <div class="lg:col-span-1">
@@ -60,97 +60,140 @@
60
  </div>
61
 
62
  <!-- Feed -->
63
- <div class="lg:col-span-2">
64
- <div class="bg-white rounded-xl shadow mb-6">
65
- <div class="p-4 border-b">
66
- <h2 class="font-bold text-xl">Your Feed</h2>
67
- </div>
68
-
69
- <!-- Post creation form -->
70
- <div class="p-4 border-b">
71
- <form id="post-form" class="space-y-4">
72
- <textarea id="post-content" rows="3" class="w-full px-4 py-2 border rounded-lg focus:ring-blue-500 focus:border-blue-500" placeholder="What's on your mind?"></textarea>
73
- <div class="flex items-center justify-between">
74
- <div>
75
- <input type="file" id="post-image" accept="image/*" class="hidden">
76
- <button type="button" onclick="document.getElementById('post-image').click()" class="text-gray-500 hover:text-blue-500">
77
- <i data-feather="image"></i>
78
- </button>
79
  </div>
80
- <button type="submit" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition">Post</button>
81
  </div>
82
- </form>
83
- </div>
84
- <div id="feed-container">
85
- <!-- Posts will be dynamically loaded here -->
 
86
  </div>
87
- <div class="p-4 text-center">
88
- <button id="load-more" class="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 transition">
89
- Load More
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  </button>
91
  </div>
92
- </div>
93
  </div>
94
-
95
  <!-- Right Sidebar -->
96
- <div class="lg:col-span-1">
97
- <div class="bg-white rounded-xl shadow p-6 mb-6">
98
- <h3 class="font-bold text-lg mb-4">Suggested For You</h3>
 
 
 
99
  <div class="space-y-4">
100
- <div class="flex items-center">
101
- <img src="http://static.photos/people/200x200/2" alt="User" class="w-10 h-10 rounded-full">
102
- <div class="ml-3">
103
- <p class="font-medium">Jamie Smith</p>
104
- <p class="text-sm text-gray-500">Popular Creator</p>
105
- </div>
106
- <button class="ml-auto text-blue-500 hover:text-blue-700">
107
- <i data-feather="user-plus"></i>
108
- </button>
109
- </div>
110
- <div class="flex items-center">
111
- <img src="http://static.photos/people/200x200/3" alt="User" class="w-10 h-10 rounded-full">
112
- <div class="ml-3">
113
- <p class="font-medium">Tech Insights</p>
114
- <p class="text-sm text-gray-500">Technology</p>
115
  </div>
116
- <button class="ml-auto text-blue-500 hover:text-blue-700">
117
- <i data-feather="user-plus"></i>
118
- </button>
 
 
 
 
 
 
119
  </div>
 
120
  </div>
121
  </div>
122
 
123
  <div class="bg-white rounded-xl shadow p-6">
124
- <h3 class="font-bold text-lg mb-4">Analytics</h3>
125
  <div class="space-y-4">
126
- <div>
127
- <div class="flex justify-between mb-1">
128
- <span class="text-sm font-medium">Profile Views</span>
129
- <span class="text-sm font-medium">78%</span>
130
- </div>
131
- <div class="w-full bg-gray-200 rounded-full h-2">
132
- <div class="bg-blue-600 h-2 rounded-full" style="width: 78%"></div>
133
- </div>
134
  </div>
135
- <div>
136
- <div class="flex justify-between mb-1">
137
- <span class="text-sm font-medium">Post Engagement</span>
138
- <span class="text-sm font-medium">64%</span>
139
- </div>
140
- <div class="w-full bg-gray-200 rounded-full h-2">
141
- <div class="bg-green-600 h-2 rounded-full" style="width: 64%"></div>
 
 
 
 
 
 
 
142
  </div>
143
- </div>
144
  </div>
145
  </div>
146
  </div>
147
- </div>
148
  </main>
149
 
150
  <custom-footer></custom-footer>
151
-
152
  <script src="components/navbar.js"></script>
153
- <script src="components/footer.js"></script>
 
154
  <script src="script.js"></script>
155
  <script>
156
  feather.replace();
 
11
  </head>
12
  <body class="bg-gray-50 text-gray-900">
13
  <custom-navbar></custom-navbar>
14
+ <custom-stories></custom-stories>
15
+ <main class="container mx-auto px-4 py-8">
16
  <div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
17
  <!-- Left Sidebar -->
18
  <div class="lg:col-span-1">
 
60
  </div>
61
 
62
  <!-- Feed -->
63
+ <div class="lg:col-span-2">
64
+ <div class="bg-white rounded-xl shadow mb-6">
65
+ <div class="p-4 border-b">
66
+ <h2 class="font-bold text-xl">Your Feed</h2>
67
+ </div>
68
+
69
+ <!-- Stories -->
70
+ <div class="p-4 border-b">
71
+ <div class="flex space-x-4 overflow-x-auto pb-2">
72
+ <div class="flex flex-col items-center space-y-1 flex-shrink-0">
73
+ <div class="relative">
74
+ <div class="w-16 h-16 rounded-full bg-gradient-to-tr from-yellow-400 to-pink-500 p-0.5">
75
+ <div class="bg-white rounded-full p-0.5">
76
+ <img src="http://static.photos/people/200x200/1" class="w-full h-full rounded-full object-cover">
 
 
77
  </div>
 
78
  </div>
79
+ <div class="absolute bottom-0 right-0 bg-blue-500 rounded-full w-5 h-5 flex items-center justify-center border-2 border-white">
80
+ <i data-feather="plus" class="w-3 h-3 text-white"></i>
81
+ </div>
82
+ </div>
83
+ <span class="text-xs">Your Story</span>
84
  </div>
85
+ ${[1,2,3,4,5].map(i => `
86
+ <div class="flex flex-col items-center space-y-1 flex-shrink-0">
87
+ <div class="w-16 h-16 rounded-full bg-gradient-to-tr from-purple-500 to-pink-500 p-0.5">
88
+ <img src="http://static.photos/people/200x200/${i+10}" class="w-full h-full rounded-full object-cover">
89
+ </div>
90
+ <span class="text-xs">user${i}</span>
91
+ </div>
92
+ `).join('')}
93
+ </div>
94
+ </div>
95
+
96
+ <!-- Post creation form -->
97
+ <div class="p-4 border-b">
98
+ <div class="flex items-center mb-4">
99
+ <img src="http://static.photos/people/200x200/1" class="w-10 h-10 rounded-full">
100
+ <input type="text" id="post-content" class="ml-2 flex-1 px-4 py-2 bg-gray-100 rounded-full focus:outline-none" placeholder="What's on your mind?">
101
+ </div>
102
+ <div class="flex justify-between border-t pt-3">
103
+ <button type="button" onclick="document.getElementById('post-image').click()" class="flex items-center text-gray-500 hover:text-blue-500 px-3 py-1 rounded-lg hover:bg-gray-100">
104
+ <i data-feather="image" class="w-5 h-5 mr-1"></i>
105
+ <span>Photo</span>
106
+ <input type="file" id="post-image" accept="image/*" class="hidden">
107
+ </button>
108
+ <button type="button" class="flex items-center text-gray-500 hover:text-blue-500 px-3 py-1 rounded-lg hover:bg-gray-100">
109
+ <i data-feather="video" class="w-5 h-5 mr-1"></i>
110
+ <span>Video</span>
111
+ </button>
112
+ <button type="button" class="flex items-center text-gray-500 hover:text-blue-500 px-3 py-1 rounded-lg hover:bg-gray-100">
113
+ <i data-feather="map-pin" class="w-5 h-5 mr-1"></i>
114
+ <span>Location</span>
115
+ </button>
116
+ <button type="submit" form="post-form" class="px-4 py-1 bg-blue-500 text-white rounded-full hover:bg-blue-600 transition">Post</button>
117
+ </div>
118
+ <form id="post-form" class="hidden"></form>
119
+ </div>
120
+ <div id="feed-container" class="divide-y">
121
+ <!-- Posts will be dynamically loaded here -->
122
+ </div>
123
+ <div class="p-4 flex justify-center">
124
+ <button id="load-more" class="flex items-center px-4 py-2 bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200 transition">
125
+ <i data-feather="refresh-cw" class="w-4 h-4 mr-2"></i>
126
+ <span>Load More</span>
127
  </button>
128
  </div>
129
+ </div>
130
  </div>
 
131
  <!-- Right Sidebar -->
132
+ <div class="lg:col-span-1 space-y-6">
133
+ <div class="bg-white rounded-xl shadow p-6">
134
+ <div class="flex justify-between items-center mb-4">
135
+ <h3 class="font-bold text-lg">Suggested For You</h3>
136
+ <a href="#" class="text-sm text-blue-500">See All</a>
137
+ </div>
138
  <div class="space-y-4">
139
+ ${[1,2,3].map(i => `
140
+ <div class="flex items-center">
141
+ <img src="http://static.photos/people/200x200/${i+20}" alt="User" class="w-10 h-10 rounded-full">
142
+ <div class="ml-3 flex-1">
143
+ <p class="font-medium">User ${i}</p>
144
+ <p class="text-sm text-gray-500">Followed by ${i*2} friends</p>
145
+ </div>
146
+ <button class="text-xs font-medium text-blue-500 hover:text-blue-700">
147
+ Follow
148
+ </button>
 
 
 
 
 
149
  </div>
150
+ `).join('')}
151
+ </div>
152
+ </div>
153
+
154
+ <div class="bg-white rounded-xl shadow p-6">
155
+ <h3 class="font-bold text-lg mb-4">Birthdays</h3>
156
+ <div class="flex items-center">
157
+ <div class="w-10 h-10 bg-blue-100 rounded-full flex items-center justify-center text-blue-500">
158
+ <i data-feather="gift"></i>
159
  </div>
160
+ <p class="ml-3 text-sm"><span class="font-medium">John Doe</span> and <span class="font-medium">2 others</span> have birthdays today</p>
161
  </div>
162
  </div>
163
 
164
  <div class="bg-white rounded-xl shadow p-6">
165
+ <h3 class="font-bold text-lg mb-4">Sponsored</h3>
166
  <div class="space-y-4">
167
+ <div class="relative">
168
+ <img src="http://static.photos/advertising/640x360/1" class="w-full rounded-lg">
169
+ <div class="absolute top-2 right-2 bg-black bg-opacity-50 text-white text-xs px-2 py-1 rounded">Sponsored</div>
 
 
 
 
 
170
  </div>
171
+ <p class="text-sm">Try our new product and get 50% off your first purchase!</p>
172
+ </div>
173
+ </div>
174
+
175
+ <div class="bg-white rounded-xl shadow p-6">
176
+ <h3 class="font-bold text-lg mb-4">Online Friends</h3>
177
+ <div class="space-y-3">
178
+ ${[1,2,3,4].map(i => `
179
+ <div class="flex items-center">
180
+ <div class="relative">
181
+ <img src="http://static.photos/people/200x200/${i+30}" class="w-10 h-10 rounded-full">
182
+ <div class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></div>
183
+ </div>
184
+ <span class="ml-3">Friend ${i}</span>
185
  </div>
186
+ `).join('')}
187
  </div>
188
  </div>
189
  </div>
190
+ </div>
191
  </main>
192
 
193
  <custom-footer></custom-footer>
 
194
  <script src="components/navbar.js"></script>
195
+ <script src="components/stories.js"></script>
196
+ <script src="components/footer.js"></script>
197
  <script src="script.js"></script>
198
  <script>
199
  feather.replace();
script.js CHANGED
@@ -17,30 +17,53 @@ function initAuthForms() {
17
  loginForm.classList.add('hidden');
18
  registerForm.classList.remove('hidden');
19
  }
20
-
21
  function showCommentModal(post) {
22
  const modal = document.createElement('div');
23
  modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
24
  modal.innerHTML = `
25
- <div class="bg-white rounded-xl p-6 max-w-md w-full max-h-[80vh] overflow-y-auto">
26
- <div class="flex justify-between items-center mb-4">
27
- <h3 class="text-xl font-bold">Comments</h3>
28
  <button class="text-gray-500 hover:text-gray-700" id="close-comment-modal">
29
  <i data-feather="x"></i>
30
  </button>
31
  </div>
32
- <div class="space-y-4 mb-4" id="comments-container">
33
- ${post.comments > 0 ? '' : '<p class="text-gray-500 text-center py-4">No comments yet</p>'}
 
 
 
 
 
 
 
 
 
 
34
  </div>
35
- <div class="flex items-center">
36
- <input type="text" placeholder="Add a comment..." class="flex-1 px-4 py-2 border rounded-l-lg focus:ring-blue-500 focus:border-blue-500" id="comment-input">
37
- <button class="bg-blue-600 text-white px-4 py-2 rounded-r-lg hover:bg-blue-700 transition" id="post-comment">
38
- <i data-feather="send"></i>
39
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  </div>
41
  </div>
42
  `;
43
- document.body.appendChild(modal);
44
  feather.replace();
45
 
46
  document.getElementById('close-comment-modal').addEventListener('click', () => {
@@ -57,35 +80,60 @@ function showCommentModal(post) {
57
  }
58
  });
59
  }
60
-
61
  function showShareOptions(post) {
62
  const modal = document.createElement('div');
63
  modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
64
  modal.innerHTML = `
65
- <div class="bg-white rounded-xl p-6 max-w-md w-full">
66
- <div class="flex justify-between items-center mb-4">
67
- <h3 class="text-xl font-bold">Share Post</h3>
68
- <button class="text-gray-500 hover:text-gray-700" id="close-share-modal">
69
- <i data-feather="x"></i>
70
- </button>
71
  </div>
72
- <div class="space-y-4">
73
- <button class="w-full flex items-center justify-center gap-2 px-4 py-2 border rounded-lg hover:bg-gray-50">
74
- <i data-feather="copy"></i>
75
- <span>Copy Link</span>
 
 
 
 
 
76
  </button>
77
- <button class="w-full flex items-center justify-center gap-2 px-4 py-2 border rounded-lg hover:bg-gray-50">
78
- <i data-feather="twitter"></i>
79
- <span>Share on Twitter</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  </button>
81
- <button class="w-full flex items-center justify-center gap-2 px-4 py-2 border rounded-lg hover:bg-gray-50">
82
- <i data-feather="facebook"></i>
83
- <span>Share on Facebook</span>
 
 
 
 
 
 
 
 
 
 
84
  </button>
85
  </div>
86
  </div>
87
  `;
88
- document.body.appendChild(modal);
89
  feather.replace();
90
 
91
  document.getElementById('close-share-modal').addEventListener('click', () => {
@@ -423,45 +471,47 @@ function prependPost(post) {
423
  currentPosts.unshift(post);
424
  feather.replace();
425
  }
426
-
427
  function createPostElement(post) {
428
  const postElement = document.createElement('div');
429
- postElement.className = 'post-card bg-white border-b last:border-b-0 fade-in';
430
  postElement.innerHTML = `
431
- <div class="p-6">
432
- <div class="flex items-start">
433
- <img src="${post.user.avatar}" alt="${post.user.name}" class="w-12 h-12 rounded-full user-avatar">
434
- <div class="ml-4 flex-1">
435
- <div class="flex items-center">
436
- <h3 class="font-bold">${post.user.name}</h3>
437
- <span class="ml-2 text-gray-500 text-sm">${post.user.username}</span>
438
- <span class="mx-2 text-gray-300">•</span>
439
- <span class="text-gray-500 text-sm">${post.timestamp}</span>
440
- </div>
441
- <p class="mt-2 post-content">${post.content}</p>
442
- ${post.image ? `<img src="${post.image}" alt="Post image" class="mt-4 rounded-xl w-full">` : ''}
443
- <div class="mt-4 flex space-x-6">
444
- <button class="interaction-btn ${post.isLiked ? 'active' : ''}" data-action="like" data-id="${post.id}">
445
- <i data-feather="heart" class="w-4 h-4"></i>
446
- <span>${post.likes}</span>
447
- </button>
448
- <button class="interaction-btn" data-action="comment" data-id="${post.id}">
449
- <i data-feather="message-circle" class="w-4 h-4"></i>
450
- <span>${post.comments}</span>
451
- </button>
452
- <button class="interaction-btn" data-action="share" data-id="${post.id}">
453
- <i data-feather="share-2" class="w-4 h-4"></i>
454
- <span>${post.shares}</span>
455
- </button>
456
- <button class="interaction-btn ml-auto ${post.isSaved ? 'active' : ''}" data-action="save" data-id="${post.id}">
457
- <i data-feather="bookmark" class="w-4 h-4"></i>
458
- </button>
459
- </div>
 
 
 
460
  </div>
461
  </div>
462
  </div>
463
  `;
464
- return postElement;
465
  }
466
 
467
  function handleInteraction(e) {
 
17
  loginForm.classList.add('hidden');
18
  registerForm.classList.remove('hidden');
19
  }
 
20
  function showCommentModal(post) {
21
  const modal = document.createElement('div');
22
  modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
23
  modal.innerHTML = `
24
+ <div class="bg-white rounded-lg w-full max-w-lg max-h-[90vh] flex flex-col">
25
+ <div class="p-4 border-b flex items-center justify-between">
26
+ <h3 class="text-lg font-semibold">Comments</h3>
27
  <button class="text-gray-500 hover:text-gray-700" id="close-comment-modal">
28
  <i data-feather="x"></i>
29
  </button>
30
  </div>
31
+ <div class="p-4 border-b">
32
+ <div class="flex items-start">
33
+ <img src="${post.user.avatar}" class="w-8 h-8 rounded-full">
34
+ <div class="ml-3">
35
+ <div class="flex items-center">
36
+ <span class="font-medium">${post.user.name}</span>
37
+ <span class="mx-1 text-gray-500">•</span>
38
+ <span class="text-gray-500 text-sm">${post.timestamp}</span>
39
+ </div>
40
+ <p class="mt-1">${post.content}</p>
41
+ </div>
42
+ </div>
43
  </div>
44
+ <div class="flex-1 overflow-y-auto p-4 space-y-4" id="comments-container">
45
+ ${post.comments > 0 ? '' : `
46
+ <div class="text-center py-8">
47
+ <i data-feather="message-circle" class="w-12 h-12 mx-auto text-gray-300"></i>
48
+ <p class="mt-2 text-gray-500">No comments yet</p>
49
+ <p class="text-sm text-gray-400">Be the first to share your thoughts!</p>
50
+ </div>
51
+ `}
52
+ </div>
53
+ <div class="p-4 border-t">
54
+ <div class="flex items-center">
55
+ <img src="http://static.photos/people/200x200/1" class="w-8 h-8 rounded-full">
56
+ <div class="ml-2 flex-1 flex items-center bg-gray-100 rounded-full">
57
+ <input type="text" placeholder="Add a comment..." class="flex-1 bg-transparent px-4 py-2 focus:outline-none" id="comment-input">
58
+ <button class="text-blue-500 px-3" id="post-comment">
59
+ <i data-feather="send" class="w-5 h-5"></i>
60
+ </button>
61
+ </div>
62
+ </div>
63
  </div>
64
  </div>
65
  `;
66
+ document.body.appendChild(modal);
67
  feather.replace();
68
 
69
  document.getElementById('close-comment-modal').addEventListener('click', () => {
 
80
  }
81
  });
82
  }
 
83
  function showShareOptions(post) {
84
  const modal = document.createElement('div');
85
  modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
86
  modal.innerHTML = `
87
+ <div class="bg-white rounded-lg w-full max-w-sm">
88
+ <div class="p-4 border-b">
89
+ <h3 class="text-lg font-semibold">Share Post</h3>
 
 
 
90
  </div>
91
+ <div class="p-4 space-y-2">
92
+ <button class="w-full flex items-center px-4 py-3 rounded-lg hover:bg-gray-100">
93
+ <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-500">
94
+ <i data-feather="user-plus" class="w-5 h-5"></i>
95
+ </div>
96
+ <div class="ml-4 text-left">
97
+ <p class="font-medium">Send in a message</p>
98
+ <p class="text-sm text-gray-500">Share privately with friends</p>
99
+ </div>
100
  </button>
101
+ <button class="w-full flex items-center px-4 py-3 rounded-lg hover:bg-gray-100">
102
+ <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center text-green-500">
103
+ <i data-feather="twitter" class="w-5 h-5"></i>
104
+ </div>
105
+ <div class="ml-4 text-left">
106
+ <p class="font-medium">Share on Twitter</p>
107
+ <p class="text-sm text-gray-500">Post to Twitter</p>
108
+ </div>
109
+ </button>
110
+ <button class="w-full flex items-center px-4 py-3 rounded-lg hover:bg-gray-100">
111
+ <div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-500">
112
+ <i data-feather="facebook" class="w-5 h-5"></i>
113
+ </div>
114
+ <div class="ml-4 text-left">
115
+ <p class="font-medium">Share on Facebook</p>
116
+ <p class="text-sm text-gray-500">Post to Facebook</p>
117
+ </div>
118
  </button>
119
+ <button class="w-full flex items-center px-4 py-3 rounded-lg hover:bg-gray-100">
120
+ <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center text-purple-500">
121
+ <i data-feather="link" class="w-5 h-5"></i>
122
+ </div>
123
+ <div class="ml-4 text-left">
124
+ <p class="font-medium">Copy link</p>
125
+ <p class="text-sm text-gray-500">Copy post link</p>
126
+ </div>
127
+ </button>
128
+ </div>
129
+ <div class="p-4 border-t">
130
+ <button id="close-share-modal" class="w-full py-2 text-gray-700 rounded-lg hover:bg-gray-100">
131
+ Cancel
132
  </button>
133
  </div>
134
  </div>
135
  `;
136
+ document.body.appendChild(modal);
137
  feather.replace();
138
 
139
  document.getElementById('close-share-modal').addEventListener('click', () => {
 
471
  currentPosts.unshift(post);
472
  feather.replace();
473
  }
 
474
  function createPostElement(post) {
475
  const postElement = document.createElement('div');
476
+ postElement.className = 'post-card fade-in p-4';
477
  postElement.innerHTML = `
478
+ <div class="flex items-start">
479
+ <img src="${post.user.avatar}" alt="${post.user.name}" class="w-10 h-10 rounded-full user-avatar">
480
+ <div class="ml-3 flex-1">
481
+ <div class="flex items-center">
482
+ <h3 class="font-bold">${post.user.name}</h3>
483
+ <span class="mx-2 text-gray-300"></span>
484
+ <span class="text-gray-500 text-sm">${post.timestamp}</span>
485
+ <button class="ml-auto text-gray-400 hover:text-gray-600">
486
+ <i data-feather="more-horizontal"></i>
487
+ </button>
488
+ </div>
489
+ <p class="mt-2 post-content">${post.content}</p>
490
+ ${post.image ? `
491
+ <div class="mt-3 rounded-xl overflow-hidden border">
492
+ <img src="${post.image}" alt="Post image" class="w-full">
493
+ </div>
494
+ ` : ''}
495
+ <div class="flex justify-between mt-3 pt-3 border-t">
496
+ <button class="interaction-btn ${post.isLiked ? 'active' : ''}" data-action="like" data-id="${post.id}">
497
+ <i data-feather="heart" class="w-5 h-5"></i>
498
+ <span>${post.likes}</span>
499
+ </button>
500
+ <button class="interaction-btn" data-action="comment" data-id="${post.id}">
501
+ <i data-feather="message-circle" class="w-5 h-5"></i>
502
+ <span>${post.comments}</span>
503
+ </button>
504
+ <button class="interaction-btn" data-action="share" data-id="${post.id}">
505
+ <i data-feather="share-2" class="w-5 h-5"></i>
506
+ </button>
507
+ <button class="interaction-btn ml-auto ${post.isSaved ? 'active' : ''}" data-action="save" data-id="${post.id}">
508
+ <i data-feather="bookmark" class="w-5 h-5"></i>
509
+ </button>
510
  </div>
511
  </div>
512
  </div>
513
  `;
514
+ return postElement;
515
  }
516
 
517
  function handleInteraction(e) {
style.css CHANGED
@@ -18,16 +18,18 @@ body {
18
  background-color: #f1f5f9;
19
  color: #1e293b;
20
  }
21
-
22
  .post-card {
23
  transition: all 0.3s ease;
 
24
  }
25
 
26
- .post-card:hover {
27
- transform: translateY(-2px);
28
- box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
29
  }
30
 
 
 
 
31
  .interaction-btn {
32
  display: flex;
33
  align-items: center;
@@ -36,15 +38,25 @@ body {
36
  border-radius: 20px;
37
  cursor: pointer;
38
  transition: all 0.2s ease;
 
39
  }
40
 
41
  .interaction-btn:hover {
42
  background-color: #e2e8f0;
 
43
  }
44
 
45
  .interaction-btn.active {
46
- color: var(--primary);
47
- background-color: #dbeafe;
 
 
 
 
 
 
 
 
48
  }
49
  .post-content {
50
  line-height: 1.6;
 
18
  background-color: #f1f5f9;
19
  color: #1e293b;
20
  }
 
21
  .post-card {
22
  transition: all 0.3s ease;
23
+ border-bottom: 1px solid #e2e8f0;
24
  }
25
 
26
+ .post-card:last-child {
27
+ border-bottom: none;
 
28
  }
29
 
30
+ .post-card:hover {
31
+ background-color: #f8fafc;
32
+ }
33
  .interaction-btn {
34
  display: flex;
35
  align-items: center;
 
38
  border-radius: 20px;
39
  cursor: pointer;
40
  transition: all 0.2s ease;
41
+ color: #64748b;
42
  }
43
 
44
  .interaction-btn:hover {
45
  background-color: #e2e8f0;
46
+ color: #3b82f6;
47
  }
48
 
49
  .interaction-btn.active {
50
+ color: #ef4444;
51
+ }
52
+
53
+ .interaction-btn.active:hover {
54
+ background-color: #fee2e2;
55
+ }
56
+
57
+ /* Stories */
58
+ .story-ring {
59
+ background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
60
  }
61
  .post-content {
62
  line-height: 1.6;