1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-02-22 05:50:01 +00:00

Refactor palette switcher a little

This commit is contained in:
Jeremy Ruston 2025-02-04 19:59:39 +00:00
parent 2e5a988bb3
commit a5c4d90154

View File

@ -7,19 +7,24 @@ title: $:/snippets/paletteswitcher
<$action-setfield $tiddler="$:/palette" text=<<navigateTo>>/>
\end actions
<!-- Display palette in currentTiddler with selection logic -->
\procedure palette-entry(thumbnails)
<div class={{{ [<currentTiddler>match{$:/palette}then[tc-chosen]] tc-chooser-item +[join[ ]] }}}>
<$link to={{!!title}} aria-label=`${[[$:/language/ControlPanel/Palette/Caption]get[text]]}$ - ${[all[current]get[name]]}$. ${[all[current]get[description]]}$`>
<%if [<thumbnails>match[yes]] %>
{{||$:/snippets/currpalettepreview}}
<%endif%>
''<$view field="name" format="text"/>''
<br>
<$view field="description" format="text"/>
</$link>
</div>
\end palette-entry
<$linkcatcher actions=<<actions>>>
<div class={{{ tc-chooser [<thumbnails>match[yes]then[tc-chooser-cards]] +[join[ ]] }}}>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Palette]sort[name]]">
<div class={{{ [<currentTiddler>match{$:/palette}then[tc-chosen]] tc-chooser-item +[join[ ]] }}}>
<$link to={{!!title}} aria-label=`${[[$:/language/ControlPanel/Palette/Caption]get[text]]}$ - ${[all[current]get[name]]}$. ${[all[current]get[description]]}$`>
<%if [<thumbnails>match[yes]] %>
{{||$:/snippets/currpalettepreview}}
<%endif%>
''<$view field="name" format="text"/>''
<br>
<$view field="description" format="text"/>
</$link>
</div>
<$transclude $variable="palette-entry" thumbnails=<<thumbnails>>/>
</$list>
</div>
</$linkcatcher>