1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-07-04 19:12:51 +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,9 +7,8 @@ title: $:/snippets/paletteswitcher
<$action-setfield $tiddler="$:/palette" text=<<navigateTo>>/> <$action-setfield $tiddler="$:/palette" text=<<navigateTo>>/>
\end actions \end actions
<$linkcatcher actions=<<actions>>> <!-- Display palette in currentTiddler with selection logic -->
<div class={{{ tc-chooser [<thumbnails>match[yes]then[tc-chooser-cards]] +[join[ ]] }}}> \procedure palette-entry(thumbnails)
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Palette]sort[name]]">
<div class={{{ [<currentTiddler>match{$:/palette}then[tc-chosen]] tc-chooser-item +[join[ ]] }}}> <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]]}$`> <$link to={{!!title}} aria-label=`${[[$:/language/ControlPanel/Palette/Caption]get[text]]}$ - ${[all[current]get[name]]}$. ${[all[current]get[description]]}$`>
<%if [<thumbnails>match[yes]] %> <%if [<thumbnails>match[yes]] %>
@ -20,6 +19,12 @@ title: $:/snippets/paletteswitcher
<$view field="description" format="text"/> <$view field="description" format="text"/>
</$link> </$link>
</div> </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]]">
<$transclude $variable="palette-entry" thumbnails=<<thumbnails>>/>
</$list> </$list>
</div> </div>
</$linkcatcher> </$linkcatcher>