@@ -2,8 +2,8 @@ import type { ReferenceDocContentItem } from "@/src/content/types";
22import { useMemo , useRef , useState } from "preact/hooks" ;
33import { type JSX } from "preact" ;
44import { Icon } from "../Icon" ;
5- import flask from "@src/content/ui/images/icons/flask.svg?raw" ;
6- import warning from "@src/content/ui/images/icons/warning.svg?raw" ;
5+ import flask from "@src/content/ui/images/icons/flask.svg?raw" ;
6+ import warning from "@src/content/ui/images/icons/warning.svg?raw" ;
77
88type ReferenceDirectoryEntry = ReferenceDocContentItem & {
99 data : {
@@ -41,14 +41,14 @@ type ReferenceDirectoryWithFilterProps = {
4141const getOneLineDescription = ( description : string ) : string => {
4242 // Matches first paragraph tag, remove HTML tags, then trim to first fullstop
4343 const firstParagraphRegex = / ^ < p > ( .* ?) < \/ p > / ;
44- let [ oneLineDescription ] = description . replace ( / \n / g , " " ) . trim ( )
45- . match ( firstParagraphRegex ) ?? [ ] ;
44+ let [ oneLineDescription ] =
45+ description . replace ( / \n / g , " " ) . trim ( ) . match ( firstParagraphRegex ) ?? [ ] ;
4646
4747 if ( ! oneLineDescription && description ) {
4848 oneLineDescription = description ;
4949 }
5050
51- if ( oneLineDescription ) {
51+ if ( oneLineDescription ) {
5252 oneLineDescription = oneLineDescription
5353 . replace ( / ^ < p > | < \/ p > $ / g, "" )
5454 . replace ( / < \/ ? c o d e > / g, "" )
@@ -80,11 +80,13 @@ export const ReferenceDirectoryWithFilter = ({
8080 ) ;
8181 if (
8282 subcat . entry &&
83- subcat . entry . data . title . toLowerCase ( ) . includes ( searchKeyword . toLowerCase ( ) )
83+ subcat . entry . data . title
84+ . toLowerCase ( )
85+ . includes ( searchKeyword . toLowerCase ( ) )
8486 ) {
8587 filteredEntries . push ( subcat . entry ) ;
8688 }
87-
89+
8890 if ( filteredEntries . length > 0 ) {
8991 subAcc . push ( { ...subcat , entries : filteredEntries } ) ;
9092 }
@@ -111,18 +113,16 @@ export const ReferenceDirectoryWithFilter = ({
111113 aria-label = { entry . data . title }
112114 aria-describedby = { `${ entry . data . title } -description` }
113115 >
114- < span
115- class = "text-body-mono group-hover:underline"
116- >
116+ < span class = "text-body-mono group-hover:underline" >
117117 { entry . data . beta && (
118118 < div
119- className = "inline-block mr-2 w-[16px] h-[16px] mb-[-2px ]"
119+ className = "mb-[-2px] mr-2 inline-block h-[16px] w-[16px ]"
120120 dangerouslySetInnerHTML = { { __html : flask } }
121121 />
122122 ) }
123123 { entry . data . deprecated && (
124124 < div
125- className = "inline-block mr-2 w-[16px] h-[16px] mb-[-2px ]"
125+ className = "mb-[-2px] mr-2 inline-block h-[16px] w-[16px ]"
126126 dangerouslySetInnerHTML = { { __html : warning } }
127127 />
128128 ) }
@@ -143,7 +143,7 @@ export const ReferenceDirectoryWithFilter = ({
143143 category : { name : string } ,
144144 ) => {
145145 return ! ( ! subcat . name || ! category . name ) ;
146- }
146+ } ;
147147
148148 const getSubcatHeading = (
149149 subcat : { name : string ; entry ?: any } ,
@@ -207,7 +207,7 @@ export const ReferenceDirectoryWithFilter = ({
207207 return (
208208 < div >
209209 < div class = "h-0 overflow-visible" >
210- < div class = "content-grid-simple absolute -top-[75px] - left-0 -right-0 h-[75px] border-b border-sidebar-type-color bg-accent-color px-5 pb-lg md:px-lg " >
210+ < div class = "content-grid-simple absolute -left-0 -right-0 -top-[60px] h-[75px] border-b border-sidebar-type-color bg-accent-color px-5 pb-lg md:px-lg " >
211211 < div class = "text-body col-span-2 flex w-full max-w-[750px] border-b border-accent-type-color text-accent-type-color" >
212212 < input
213213 type = "text"
@@ -221,10 +221,14 @@ export const ReferenceDirectoryWithFilter = ({
221221 } }
222222 />
223223 { searchKeyword . length > 0 && (
224- < button type = "reset" class = "" onClick = { clearInput } aria-label = "Clear search input" >
225- < Icon kind = "close" className = "h-4 w-4" />
226- </ button >
227-
224+ < button
225+ type = "reset"
226+ class = ""
227+ onClick = { clearInput }
228+ aria-label = "Clear search input"
229+ >
230+ < Icon kind = "close" className = "h-4 w-4" />
231+ </ button >
228232 ) }
229233 </ div >
230234 </ div >
0 commit comments