Spaces:
Running
Running
add a multiple selection option (mission or actualité) in the newscomposer
Browse files- components/news-composer.js +97 -8
components/news-composer.js
CHANGED
|
@@ -8,7 +8,6 @@ class NewsComposer extends HTMLElement {
|
|
| 8 |
this.render();
|
| 9 |
this.setupEventListeners();
|
| 10 |
}
|
| 11 |
-
|
| 12 |
render() {
|
| 13 |
this.shadowRoot.innerHTML = `
|
| 14 |
<style>
|
|
@@ -82,7 +81,8 @@ class NewsComposer extends HTMLElement {
|
|
| 82 |
}
|
| 83 |
|
| 84 |
.input-with-icon input,
|
| 85 |
-
.input-with-icon textarea
|
|
|
|
| 86 |
width: 100%;
|
| 87 |
padding: 0.75rem 0.75rem 0.75rem 3rem;
|
| 88 |
border: 1px solid #e5e7eb;
|
|
@@ -93,7 +93,8 @@ class NewsComposer extends HTMLElement {
|
|
| 93 |
}
|
| 94 |
|
| 95 |
.input-with-icon input:focus,
|
| 96 |
-
.input-with-icon textarea:focus
|
|
|
|
| 97 |
outline: none;
|
| 98 |
border-color: #f97316;
|
| 99 |
box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
|
|
@@ -104,6 +105,50 @@ class NewsComposer extends HTMLElement {
|
|
| 104 |
color: #9ca3af;
|
| 105 |
}
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
.image-upload {
|
| 108 |
border: 2px dashed #e5e7eb;
|
| 109 |
border-radius: 0.75rem;
|
|
@@ -178,11 +223,19 @@ class NewsComposer extends HTMLElement {
|
|
| 178 |
transition: all 0.2s ease;
|
| 179 |
}
|
| 180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
.publish-btn:hover:not(:disabled) {
|
| 182 |
background: #ea580c;
|
| 183 |
transform: translateY(-1px);
|
| 184 |
}
|
| 185 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
.publish-btn:disabled {
|
| 187 |
background: #d1d5db;
|
| 188 |
cursor: not-allowed;
|
|
@@ -215,21 +268,58 @@ class NewsComposer extends HTMLElement {
|
|
| 215 |
<div class="avatar">
|
| 216 |
<i data-feather="user"></i>
|
| 217 |
</div>
|
| 218 |
-
<span style="color: #6b7280; font-size: 0.875rem;">Nouvelle
|
| 219 |
</div>
|
| 220 |
|
| 221 |
<div class="composer-content hidden">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 222 |
<div class="form-group">
|
| 223 |
<div class="input-with-icon">
|
| 224 |
<i data-feather="type"></i>
|
| 225 |
-
<input type="text" id="title" placeholder="Titre de
|
| 226 |
</div>
|
| 227 |
</div>
|
| 228 |
|
| 229 |
<div class="form-group">
|
| 230 |
<div class="input-with-icon">
|
| 231 |
<i data-feather="message-square"></i>
|
| 232 |
-
<textarea id="message" rows="4" placeholder="Partagez votre
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
</div>
|
| 234 |
</div>
|
| 235 |
|
|
@@ -259,8 +349,7 @@ class NewsComposer extends HTMLElement {
|
|
| 259 |
</div>
|
| 260 |
`;
|
| 261 |
}
|
| 262 |
-
|
| 263 |
-
setupEventListeners() {
|
| 264 |
const composer = this.shadowRoot.querySelector('.composer');
|
| 265 |
const header = this.shadowRoot.querySelector('.composer-header');
|
| 266 |
const content = this.shadowRoot.querySelector('.composer-content');
|
|
|
|
| 8 |
this.render();
|
| 9 |
this.setupEventListeners();
|
| 10 |
}
|
|
|
|
| 11 |
render() {
|
| 12 |
this.shadowRoot.innerHTML = `
|
| 13 |
<style>
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
.input-with-icon input,
|
| 84 |
+
.input-with-icon textarea,
|
| 85 |
+
.input-with-icon select {
|
| 86 |
width: 100%;
|
| 87 |
padding: 0.75rem 0.75rem 0.75rem 3rem;
|
| 88 |
border: 1px solid #e5e7eb;
|
|
|
|
| 93 |
}
|
| 94 |
|
| 95 |
.input-with-icon input:focus,
|
| 96 |
+
.input-with-icon textarea:focus,
|
| 97 |
+
.input-with-icon select:focus {
|
| 98 |
outline: none;
|
| 99 |
border-color: #f97316;
|
| 100 |
box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
|
|
|
|
| 105 |
color: #9ca3af;
|
| 106 |
}
|
| 107 |
|
| 108 |
+
.post-type-selector {
|
| 109 |
+
display: flex;
|
| 110 |
+
gap: 0.5rem;
|
| 111 |
+
margin-bottom: 1rem;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.post-type-btn {
|
| 115 |
+
flex: 1;
|
| 116 |
+
padding: 0.5rem 1rem;
|
| 117 |
+
border: 2px solid #e5e7eb;
|
| 118 |
+
border-radius: 0.5rem;
|
| 119 |
+
background: white;
|
| 120 |
+
cursor: pointer;
|
| 121 |
+
transition: all 0.2s ease;
|
| 122 |
+
text-align: center;
|
| 123 |
+
font-size: 0.875rem;
|
| 124 |
+
font-weight: 500;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.post-type-btn.active {
|
| 128 |
+
border-color: #f97316;
|
| 129 |
+
background: #fff7ed;
|
| 130 |
+
color: #f97316;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
.post-type-btn.mission.active {
|
| 134 |
+
border-color: #14b8a6;
|
| 135 |
+
background: #f0fdfa;
|
| 136 |
+
color: #14b8a6;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.mission-fields {
|
| 140 |
+
display: none;
|
| 141 |
+
background: #f0fdfa;
|
| 142 |
+
border-radius: 0.75rem;
|
| 143 |
+
padding: 1rem;
|
| 144 |
+
margin-bottom: 1rem;
|
| 145 |
+
border: 1px solid #d1fae5;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
.mission-fields.active {
|
| 149 |
+
display: block;
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
.image-upload {
|
| 153 |
border: 2px dashed #e5e7eb;
|
| 154 |
border-radius: 0.75rem;
|
|
|
|
| 223 |
transition: all 0.2s ease;
|
| 224 |
}
|
| 225 |
|
| 226 |
+
.publish-btn.mission {
|
| 227 |
+
background: #14b8a6;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
.publish-btn:hover:not(:disabled) {
|
| 231 |
background: #ea580c;
|
| 232 |
transform: translateY(-1px);
|
| 233 |
}
|
| 234 |
|
| 235 |
+
.publish-btn.mission:hover:not(:disabled) {
|
| 236 |
+
background: #0d9488;
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
.publish-btn:disabled {
|
| 240 |
background: #d1d5db;
|
| 241 |
cursor: not-allowed;
|
|
|
|
| 268 |
<div class="avatar">
|
| 269 |
<i data-feather="user"></i>
|
| 270 |
</div>
|
| 271 |
+
<span style="color: #6b7280; font-size: 0.875rem;">Nouvelle publication...</span>
|
| 272 |
</div>
|
| 273 |
|
| 274 |
<div class="composer-content hidden">
|
| 275 |
+
<div class="post-type-selector">
|
| 276 |
+
<button class="post-type-btn active" data-type="actualite">
|
| 277 |
+
<i data-feather="edit-3" class="h-4 w-4 mr-1"></i>
|
| 278 |
+
Actualité
|
| 279 |
+
</button>
|
| 280 |
+
<button class="post-type-btn" data-type="mission">
|
| 281 |
+
<i data-feather="briefcase" class="h-4 w-4 mr-1"></i>
|
| 282 |
+
Mission
|
| 283 |
+
</button>
|
| 284 |
+
</div>
|
| 285 |
+
|
| 286 |
<div class="form-group">
|
| 287 |
<div class="input-with-icon">
|
| 288 |
<i data-feather="type"></i>
|
| 289 |
+
<input type="text" id="title" placeholder="Titre de la publication">
|
| 290 |
</div>
|
| 291 |
</div>
|
| 292 |
|
| 293 |
<div class="form-group">
|
| 294 |
<div class="input-with-icon">
|
| 295 |
<i data-feather="message-square"></i>
|
| 296 |
+
<textarea id="message" rows="4" placeholder="Partagez votre publication..."></textarea>
|
| 297 |
+
</div>
|
| 298 |
+
</div>
|
| 299 |
+
|
| 300 |
+
<div class="mission-fields" id="missionFields">
|
| 301 |
+
<div class="grid grid-cols-2 gap-4 mb-3">
|
| 302 |
+
<div>
|
| 303 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Budget</label>
|
| 304 |
+
<div class="relative">
|
| 305 |
+
<i data-feather="dollar-sign" class="absolute left-3 top-2.5 h-4 w-4 text-gray-400"></i>
|
| 306 |
+
<input type="number" id="budget" placeholder="0.00" class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg w-full">
|
| 307 |
+
</div>
|
| 308 |
+
</div>
|
| 309 |
+
<div>
|
| 310 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Date limite</label>
|
| 311 |
+
<div class="relative">
|
| 312 |
+
<i data-feather="calendar" class="absolute left-3 top-2.5 h-4 w-4 text-gray-400"></i>
|
| 313 |
+
<input type="date" id="deadline" class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg w-full">
|
| 314 |
+
</div>
|
| 315 |
+
</div>
|
| 316 |
+
</div>
|
| 317 |
+
<div>
|
| 318 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Localisation</label>
|
| 319 |
+
<div class="relative">
|
| 320 |
+
<i data-feather="map-pin" class="absolute left-3 top-2.5 h-4 w-4 text-gray-400"></i>
|
| 321 |
+
<input type="text" id="location" placeholder="Où se trouve la mission ?" class="pl-10 pr-4 py-2 border border-gray-300 rounded-lg w-full">
|
| 322 |
+
</div>
|
| 323 |
</div>
|
| 324 |
</div>
|
| 325 |
|
|
|
|
| 349 |
</div>
|
| 350 |
`;
|
| 351 |
}
|
| 352 |
+
setupEventListeners() {
|
|
|
|
| 353 |
const composer = this.shadowRoot.querySelector('.composer');
|
| 354 |
const header = this.shadowRoot.querySelector('.composer-header');
|
| 355 |
const content = this.shadowRoot.querySelector('.composer-content');
|