@@ -10,10 +10,8 @@ import { Steps } from "~/components";
1010import { format } from " date-fns" ;
1111import { getChangelogs } from " ~/util/changelog" ;
1212import { productsByGroup } from " ~/util/products" ;
13- import { entryToString } from " ~/util/container" ;
14- import { process } from " ~/util/rehype" ;
1513
16- import rehypeShiftHeadings from " ~/plugins/rehype/shift-headings.ts " ;
14+ import { render } from " astro:content " ;
1715
1816const notes = await getChangelogs ({
1917 filter : (entry ) => ! entry .data .hidden ,
@@ -45,24 +43,22 @@ const props = {
4543 .map ((group ) => group [0 ])
4644 .sort ();
4745
48- const html = await entryToString (entry , Astro .locals );
49- const processed = await process (html , [[rehypeShiftHeadings ]]);
46+ const { Content } = await render (entry );
5047
5148 return (
5249 <div
53- class = " mt-0! sm:flex"
50+ class : list = { [ " mt-0! sm:flex" , { " hidden! " : idx >= 10 }] }
5451 data-products = { JSON .stringify (
5552 productIds .concat (
5653 productGroups .map ((group ) =>
5754 group .replaceAll (" " , " -" ).toLowerCase (),
5855 ),
5956 ),
6057 )}
61- style = { ` display: ${idx >= 10 ? " none" : " " } ` }
6258 >
6359 <time
6460 datetime = { entry .data .date .toISOString ()}
65- class = " whitespace-nowrap text-xs font-bold leading-6 sm:pr-4 sm:text-right"
61+ class = " text-xs leading-6 font-bold whitespace-nowrap sm:pr-4 sm:text-right"
6662 >
6763 { date }
6864 </time >
@@ -80,7 +76,7 @@ const props = {
8076 </h3 >
8177 <ProductPills products = { entry .data .products } />
8278 </div >
83- <p set : html = { processed } />
79+ <Content />
8480 </li >
8581 </ol >
8682 </Steps >
@@ -91,7 +87,7 @@ const props = {
9187 <div class =" flex items-center justify-center" >
9288 <button
9389 id =" changelogs-next-button"
94- class =" h-12 cursor-pointer rounded-sm bg-cl1-brand-orange px-6 font-medium text-cl1-black "
90+ class =" bg-cl1-brand-orange text-cl1-black h-12 cursor-pointer rounded-sm px-6 font-medium"
9591 >
9692 Load more items
9793 </button >
@@ -134,11 +130,12 @@ const props = {
134130 ...document.querySelectorAll<HTMLElement>("[data-products]"),
135131 ]
136132 .filter(
137- (e) => e.style.display === "none" && filterByProduct(e, filter!.value),
133+ (e) =>
134+ e.classList.contains("hidden!") && filterByProduct(e, filter!.value),
138135 )
139136 .slice(0, 10);
140137
141- hidden.forEach((e) => (e.style.display = " "));
138+ hidden.forEach((e) => e.classList.remove("hidden! "));
142139
143140 hideButton();
144141 });
@@ -160,9 +157,9 @@ const props = {
160157 const show = filtered.includes(entry);
161158
162159 if (show) {
163- entry.style.display = "" ;
160+ entry.classList.remove("hidden!") ;
164161 } else {
165- entry.style.display = "none" ;
162+ entry.classList.add("hidden!") ;
166163 }
167164 }
168165
@@ -188,13 +185,13 @@ const props = {
188185
189186 const filtered = entries.filter((p) => filterByProduct(p, filter!.value));
190187
191- const visible = filtered.filter((p) => p.style.display !== "none" );
188+ const visible = filtered.filter((p) => !p.classList.contains("hidden!") );
192189 const hidden = filtered.length - visible.length;
193190
194191 if (hidden > 0) {
195- button!.style.display = "" ;
192+ button!.classList.remove("hidden!") ;
196193 } else {
197- button!.style.display = "none" ;
194+ button!.classList.add("hidden!") ;
198195 }
199196 }
200197</script >
0 commit comments