File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -260,12 +260,30 @@ function handleSearch(e) {
260260
261261 const titleEl = document . getElementById ( 'titleText' ) ;
262262 if ( titleEl ) {
263- titleEl . innerHTML = `Résultats pour "${ q } " <span class="text-gray-500 text-sm ml-2">(${ res . length } )</span>` ;
263+ titleEl . textContent = `Résultats pour "${ q } " ` ;
264+ let countSpan = titleEl . querySelector ( '.text-gray-500.text-sm.ml-2' ) ;
265+ if ( ! countSpan ) {
266+ countSpan = document . createElement ( 'span' ) ;
267+ countSpan . className = 'text-gray-500 text-sm ml-2' ;
268+ titleEl . appendChild ( countSpan ) ;
269+ }
270+ countSpan . textContent = `(${ res . length } )` ;
264271 } else {
265272 const sectionTitle = document . getElementById ( 'sectionTitle' ) ;
266273 if ( sectionTitle ) {
267- sectionTitle . innerHTML = `<span class="w-1 h-8 bg-red-600 rounded-full shadow-[0_0_15px_#dc2626]"></span>
268- <span id="titleText" class="tracking-tight">Résultats pour "${ q } " (${ res . length } )</span>` ;
274+ while ( sectionTitle . firstChild ) {
275+ sectionTitle . removeChild ( sectionTitle . firstChild ) ;
276+ }
277+
278+ const accentSpan = document . createElement ( 'span' ) ;
279+ accentSpan . className = 'w-1 h-8 bg-red-600 rounded-full shadow-[0_0_15px_#dc2626]' ;
280+ sectionTitle . appendChild ( accentSpan ) ;
281+
282+ const titleTextSpan = document . createElement ( 'span' ) ;
283+ titleTextSpan . id = 'titleText' ;
284+ titleTextSpan . className = 'tracking-tight' ;
285+ titleTextSpan . textContent = `Résultats pour "${ q } " (${ res . length } )` ;
286+ sectionTitle . appendChild ( titleTextSpan ) ;
269287 }
270288 }
271289 renderGrid ( res ) ;
You can’t perform that action at this time.
0 commit comments