Added type selection to icon and emoji search

This commit is contained in:
squidfunk 2024-05-03 18:50:37 +02:00
parent b0c5fe6aef
commit aef6175f04
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
12 changed files with 112 additions and 40 deletions

View File

@ -21,6 +21,14 @@ can be added] and used in `mkdocs.yml`, documents and templates.
data-mdx-component="iconsearch-query" data-mdx-component="iconsearch-query"
/> />
<div class="mdx-iconsearch-result" data-mdx-component="iconsearch-result"> <div class="mdx-iconsearch-result" data-mdx-component="iconsearch-result">
<select
class="mdx-iconsearch-result__select"
data-mdx-component="iconsearch-select"
>
<option value="all" selected>All</option>
<option value="icons">Icons</option>
<option value="emojis">Emojis</option>
</select>
<div class="mdx-iconsearch-result__meta"></div> <div class="mdx-iconsearch-result__meta"></div>
<ol class="mdx-iconsearch-result__list"></ol> <ol class="mdx-iconsearch-result__list"></ol>
</div> </div>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"sources":["src/overrides/assets/stylesheets/custom/_typeset.scss","../../../../src/overrides/assets/stylesheets/custom.scss","src/templates/assets/stylesheets/utilities/_break.scss","src/overrides/assets/stylesheets/custom/layout/_banner.scss","src/overrides/assets/stylesheets/custom/layout/_hero.scss","src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss","src/overrides/assets/stylesheets/custom/layout/_sponsorship.scss"],"names":[],"mappings":"AA2BA,iBACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CD0CE,qBACE,aCxCJ,CD6CE,sBACE,aC3CJ,CD+CE,uBACE,UC7CJ,CDgDI,8BAGE,QAAA,CACA,sBAAA,CAHA,iBAAA,CACA,UC5CN,CDkDI,8BAOE,WAAA,CAFA,WAAA,CAFA,MAAA,CAGA,eAAA,CALA,iBAAA,CACA,KAAA,CAEA,UC7CN,CDqDE,uBACE,2BCnDJ,CDuDE,0BACE,aCrDJ,CD2DE,uBACE,e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AAA,CAHA,iBAAA,CAEA,WAAA,CADA,SJyON,CIlOI,mDAKE,aJmON,CIxOI,mDAKE,cJmON,CIxOI,yCAME,eAAA,CAJA,QAAA,CADA,SJuON,CI9NI,mDAKE,aJ+NN,CIpOI,mDAKE,cJ+NN,CIpOI,yCAME,+DAAA,CAJA,QAAA,CADA,mBJmON,CI3NM,oDACE,kBJ6NR,CIzNM,2CACE,kBJ2NR,CIvNM,6CAEE,YAAA,CADA,WJ0NR,CItNQ,0FACE,gBJwNV,CKzTI,2BACE,YAAA,CACA,iBL4TN,CKxTI,6BACE,cL0TN,CKtTI,sCACE,YAAA,CACA,cAAA,CACA,sBLwTN,CKrTM,wCACE,aAAA,CACA,aLuTR,CK9SI,mCACE,YLgTN,CK7SM,yCAEE,UAAA,CACA,UAAA,CAFA,aLiTR,CK1SI,6CAEE,ULmTN,CKrTI,6CAEE,WLmTN,CKrTI,mCAOE,kBAAA,CANA,aAAA,CAGA,aAAA,CACA,YAAA,CACA,eAAA,CAKA,kBAAA,CAHA,sCACE,CANF,YLkTN,CKvSM,kFACE,oBLySR,CKtSQ,0FACE,mBLwSV,CKnSM,4CAME,+CAAA,CAFA,yCAAA,CAHA,eAAA,CACA,eAAA,CACA,kBAAA,CAEA,iBLsSR,CKjSM,uCACE,aAAA,CAGA,mCAAA,CADA,WAAA,CAEA,uBAAA,CAHA,ULsSR,CK7RE,oCACE,eL+RJ,CK3RE,sEAEE,eL6RJ","file":"custom.css"} {"version":3,"sources":["src/overrides/assets/stylesheets/custom/_typeset.scss","../../../../src/overrides/assets/stylesheets/custom.scss","src/templates/assets/stylesheets/utilities/_break.scss","src/overrides/assets/stylesheets/custom/layout/_banner.scss","src/overrides/assets/stylesheets/custom/layout/_hero.scss","src/overrides/assets/stylesheets/custom/layout/_iconsearch.scss","src/overrides/assets/stylesheets/custom/layout/_sponsorship.scss"],"names":[],"mappings":"AA2BA,iBACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CD0CE,qBACE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A,yCAAA,CAHA,eAAA,CACA,eAAA,CACA,kBAAA,CAEA,iBL+TR,CK1TM,uCACE,aAAA,CAGA,mCAAA,CADA,WAAA,CAEA,uBAAA,CAHA,UL+TR,CKtTE,oCACE,eLwTJ,CKpTE,sEAEE,eLsTJ","file":"custom.css"}

View File

@ -3,7 +3,7 @@
-#} -#}
{% extends "base.html" %} {% extends "base.html" %}
{% block extrahead %} {% block extrahead %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/custom.00c04c01.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/custom.efcf58ca.min.css' | url }}">
{% endblock %} {% endblock %}
{% block announce %} {% block announce %}
For updates follow <strong>@squidfunk</strong> on For updates follow <strong>@squidfunk</strong> on
@ -23,5 +23,5 @@
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script src="{{ 'assets/javascripts/custom.e2e97759.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/custom.63a6dff3.min.js' | url }}"></script>
{% endblock %} {% endblock %}

View File

@ -33,6 +33,7 @@ export type ComponentType =
| "iconsearch" /* Icon search */ | "iconsearch" /* Icon search */
| "iconsearch-query" /* Icon search input */ | "iconsearch-query" /* Icon search input */
| "iconsearch-result" /* Icon search results */ | "iconsearch-result" /* Icon search results */
| "iconsearch-select" /* Icon search select */
| "sponsorship" /* Sponsorship */ | "sponsorship" /* Sponsorship */
| "sponsorship-count" /* Sponsorship count */ | "sponsorship-count" /* Sponsorship count */
| "sponsorship-total" /* Sponsorship total */ | "sponsorship-total" /* Sponsorship total */
@ -62,6 +63,7 @@ interface ComponentTypeMap {
"iconsearch": HTMLElement /* Icon search */ "iconsearch": HTMLElement /* Icon search */
"iconsearch-query": HTMLInputElement /* Icon search input */ "iconsearch-query": HTMLInputElement /* Icon search input */
"iconsearch-result": HTMLElement /* Icon search results */ "iconsearch-result": HTMLElement /* Icon search results */
"iconsearch-select": HTMLSelectElement
"sponsorship": HTMLElement /* Sponsorship */ "sponsorship": HTMLElement /* Sponsorship */
"sponsorship-count": HTMLElement /* Sponsorship count */ "sponsorship-count": HTMLElement /* Sponsorship count */
"sponsorship-total": HTMLElement /* Sponsorship total */ "sponsorship-total": HTMLElement /* Sponsorship total */

View File

@ -20,12 +20,16 @@
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
import { Observable, merge } from "rxjs" import { BehaviorSubject, Observable, fromEvent, map, merge } from "rxjs"
import { configuration } from "~/_" import { configuration } from "~/_"
import { requestJSON } from "~/browser" import { requestJSON } from "~/browser"
import { Component, getComponentElement } from "../../_" import {
Component,
getComponentElement,
getComponentElements
} from "../../_"
import { import {
IconSearchQuery, IconSearchQuery,
mountIconSearchQuery mountIconSearchQuery
@ -64,6 +68,14 @@ export type IconSearch =
| IconSearchQuery | IconSearchQuery
| IconSearchResult | IconSearchResult
/**
* Icon search mode
*/
export type IconSearchMode =
| "all"
| "icons"
| "emojis"
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Functions * Functions
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
@ -87,8 +99,18 @@ export function mountIconSearch(
const query = getComponentElement("iconsearch-query", el) const query = getComponentElement("iconsearch-query", el)
const result = getComponentElement("iconsearch-result", el) const result = getComponentElement("iconsearch-result", el)
/* Retrieve select component */
const mode$ = new BehaviorSubject<IconSearchMode>("all")
const selects = getComponentElements("iconsearch-select", el)
for (const select of selects) {
fromEvent(select, "change").pipe(
map(ev => (ev.target as HTMLSelectElement).value as IconSearchMode)
)
.subscribe(mode$)
}
/* Create and return component */ /* Create and return component */
const query$ = mountIconSearchQuery(query) const query$ = mountIconSearchQuery(query)
const result$ = mountIconSearchResult(result, { index$, query$ }) const result$ = mountIconSearchResult(result, { index$, query$, mode$ })
return merge(query$, result$) return merge(query$, result$)
} }

View File

@ -26,6 +26,7 @@ import {
Subject, Subject,
bufferCount, bufferCount,
combineLatest, combineLatest,
combineLatestWith,
distinctUntilKeyChanged, distinctUntilKeyChanged,
filter, filter,
finalize, finalize,
@ -47,7 +48,7 @@ import { round } from "~/utilities"
import { Icon, renderIconSearchResult } from "_/templates" import { Icon, renderIconSearchResult } from "_/templates"
import { Component } from "../../_" import { Component } from "../../_"
import { IconSearchIndex } from "../_" import { IconSearchIndex, IconSearchMode } from "../_"
import { IconSearchQuery } from "../query" import { IconSearchQuery } from "../query"
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
@ -71,6 +72,7 @@ export interface IconSearchResult {
interface WatchOptions { interface WatchOptions {
index$: Observable<IconSearchIndex> /* Search index observable */ index$: Observable<IconSearchIndex> /* Search index observable */
query$: Observable<IconSearchQuery> /* Search query observable */ query$: Observable<IconSearchQuery> /* Search query observable */
mode$: Observable<IconSearchMode> /* Search mode observable */
} }
/** /**
@ -79,6 +81,7 @@ interface WatchOptions {
interface MountOptions { interface MountOptions {
index$: Observable<IconSearchIndex> /* Search index observable */ index$: Observable<IconSearchIndex> /* Search index observable */
query$: Observable<IconSearchQuery> /* Search query observable */ query$: Observable<IconSearchQuery> /* Search query observable */
mode$: Observable<IconSearchMode> /* Search mode observable */
} }
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
@ -94,7 +97,7 @@ interface MountOptions {
* @returns Icon search result observable * @returns Icon search result observable
*/ */
export function watchIconSearchResult( export function watchIconSearchResult(
el: HTMLElement, { index$, query$ }: WatchOptions el: HTMLElement, { index$, query$, mode$ }: WatchOptions
): Observable<IconSearchResult> { ): Observable<IconSearchResult> {
switch (el.getAttribute("data-mdx-mode")) { switch (el.getAttribute("data-mdx-mode")) {
@ -131,9 +134,14 @@ export function watchIconSearchResult(
query$.pipe(distinctUntilKeyChanged("value")), query$.pipe(distinctUntilKeyChanged("value")),
index$ index$
.pipe( .pipe(
map(({ icons, emojis }) => [ combineLatestWith(mode$),
...Object.keys(icons.data), map(([{ icons, emojis }, mode]) => [
...Object.keys(emojis.data) ...["all", "icons"].includes(mode)
? Object.keys(icons.data)
: [],
...["all", "emojis"].includes(mode)
? Object.keys(emojis.data)
: []
]) ])
) )
]) ])
@ -169,7 +177,7 @@ export function watchIconSearchResult(
* @returns Icon search result component observable * @returns Icon search result component observable
*/ */
export function mountIconSearchResult( export function mountIconSearchResult(
el: HTMLElement, { index$, query$ }: MountOptions el: HTMLElement, { index$, query$, mode$ }: MountOptions
): Observable<Component<IconSearchResult, HTMLElement>> { ): Observable<Component<IconSearchResult, HTMLElement>> {
const push$ = new Subject<IconSearchResult>() const push$ = new Subject<IconSearchResult>()
const boundary$ = watchElementBoundary(el) const boundary$ = watchElementBoundary(el)
@ -178,7 +186,7 @@ export function mountIconSearchResult(
) )
/* Update search result metadata */ /* Update search result metadata */
const meta = getElement(":scope > :first-child", el) const meta = getElement(".mdx-iconsearch-result__meta", el)
push$ push$
.pipe( .pipe(
withLatestFrom(query$) withLatestFrom(query$)
@ -228,7 +236,7 @@ export function mountIconSearchResult(
)) ))
/* Create and return component */ /* Create and return component */
return watchIconSearchResult(el, { query$, index$ }) return watchIconSearchResult(el, { query$, index$, mode$ })
.pipe( .pipe(
tap(state => push$.next(state)), tap(state => push$.next(state)),
finalize(() => push$.complete()), finalize(() => push$.complete()),

View File

@ -90,6 +90,38 @@
right: px2rem(12px); right: px2rem(12px);
font-size: px2rem(12.8px); font-size: px2rem(12.8px);
color: var(--md-default-fg-color--lighter); color: var(--md-default-fg-color--lighter);
// [mobile portrait -]: Hide meta
@include break-to-device(mobile portrait) {
display: none;
}
}
// Icon search result select
&__select {
position: absolute;
top: px2rem(8px);
right: px2rem(12px);
padding-block: 0.15em;
font-size: px2rem(12.8px);
color: var(--md-default-fg-color--light);
background-color: var(--md-default-fg-color--lightest);
border: none;
border-radius: px2rem(2px);
transition: color 125ms, background-color 125ms;
// Focused or hovered
&:focus,
&:hover {
color: var(--md-accent-bg-color);
background-color: var(--md-accent-fg-color);
outline: none;
}
// Adjust spacing
+ .mdx-iconsearch-result__meta {
right: px2rem(82px);
}
} }
// Icon search result list // Icon search result list