chore: removed icons CDN and other tweaks

This commit is contained in:
2024-10-10 14:46:43 +02:00
parent 0d2dd05f50
commit 890fbc14c3
7 changed files with 39 additions and 8 deletions
+3 -2
View File
@@ -1,5 +1,6 @@
import { createContext, type ComponentChildren, type JSX } from 'preact'
import { type ComponentChildren } from 'preact'
import { useState, useRef, useEffect } from 'preact/hooks'
import { clsx } from './lib/util'
export const ComboBox = ({
value,
@@ -39,7 +40,7 @@ export const ComboBox = ({
</div>
{open && (
<div
class={cloak ? 'dropdown invisible' : 'dropdown'}
class={clsx('dropdown', cloak && 'invisible')}
ref={el => el && setItemWidth(el.offsetWidth)}
>
{Object.keys(children).map(key => (
+1 -1
View File
@@ -122,7 +122,7 @@ export const UtentiPage = () => {
</div>
<div class="search-results">
{$searchResults.value ? (
<ShowMore items={$searchResults} pageSize={10}>
<ShowMore items={$searchResults} pageSize={100}>
{poissonUser => (
<div class="search-result">
<div class="icon">
+20
View File
@@ -32,3 +32,23 @@ export const trottleDebounce = <T extends any[], R>(
return lastResult
}
}
type ClassValue = string | ClassValue[] | Record<string, boolean> | false | undefined
export function clsx(...args: ClassValue[]): string {
return args
.flatMap(arg => {
if (typeof arg === 'string') {
return arg
} else if (Array.isArray(arg)) {
return clsx(...arg)
} else if (typeof arg === 'boolean') {
return []
} else if (typeof arg === 'object') {
return Object.entries(arg).flatMap(([key, value]) => (value ? key : []))
} else {
return []
}
})
.join(' ')
}