@@ -54,6 +54,14 @@ function buildClassTokens(classValues, engineClassesUsed) {
5454 const classEntries = asArray ( classValues ) . length > 0 ? asArray ( classValues ) : asArray ( engineClassesUsed ) ;
5555 const deduped = [ ...new Set ( classEntries . map ( ( entry ) => normalize ( entry ) ) . filter ( Boolean ) ) ] ;
5656 return deduped
57+ . filter ( ( entry ) => {
58+ const phase20SampleMatch = entry . match ( / ^ s a m p l e s \/ p h a s e - 2 0 \/ ( \d { 4 } ) $ / i) ;
59+ if ( ! phase20SampleMatch ) {
60+ return true ;
61+ }
62+ const sampleNumber = Number ( phase20SampleMatch [ 1 ] ) ;
63+ return ! Number . isInteger ( sampleNumber ) || sampleNumber < 2001 || sampleNumber > 2051 ;
64+ } )
5765 . map ( ( entry ) => {
5866 const name = entry . split ( "/" ) . at ( - 1 ) || entry ;
5967 return { value : entry , label : name } ;
@@ -240,16 +248,30 @@ function renderPinnedList(container, rows) {
240248function renderPhaseSections ( container , phaseGroups ) {
241249 container . innerHTML = "" ;
242250 for ( const phaseGroup of phaseGroups ) {
243- const section = document . createElement ( "section " ) ;
244- section . className = "content-section " ;
251+ const section = document . createElement ( "details " ) ;
252+ section . className = "is-collapsible samples-phase-accordion " ;
245253 section . dataset . phase = phaseGroup . phase ;
246- section . innerHTML = `<h2>${ escapeHtml ( phaseGroup . title ) } </h2><p>${ escapeHtml ( phaseGroup . description ) } </p>` ;
254+ section . open = true ;
255+
256+ const summary = document . createElement ( "summary" ) ;
257+ summary . className = "is-collapsible__summary" ;
258+ summary . innerHTML = `
259+ <span class="samples-phase-accordion__title">${ escapeHtml ( phaseGroup . title ) } </span>
260+ <span class="samples-phase-accordion__count">${ phaseGroup . samples . length } sample${ phaseGroup . samples . length === 1 ? "" : "s" } </span>
261+ ` ;
262+
263+ const content = document . createElement ( "div" ) ;
264+ content . className = "is-collapsible__content samples-phase-accordion__content" ;
265+ content . innerHTML = `<p>${ escapeHtml ( phaseGroup . description ) } </p>` ;
266+
247267 const grid = document . createElement ( "div" ) ;
248268 grid . className = "card-grid" ;
249269 for ( const sample of phaseGroup . samples ) {
250270 grid . appendChild ( buildSampleCard ( sample ) ) ;
251271 }
252- section . appendChild ( grid ) ;
272+ content . appendChild ( grid ) ;
273+ section . appendChild ( summary ) ;
274+ section . appendChild ( content ) ;
253275 container . appendChild ( section ) ;
254276 }
255277}
0 commit comments