Skip to content

Commit 266ec68

Browse files
committed
refactor: replace toggle with chevron for show variants in Hub
The "Show variants" toggle uses a Switch component, but toggle is not the right design pattern here. Toggles are for settings that apply immediately—in this context we're just expanding a layout to show more content. Replaced the Switch with a clickable chevron: - Text "Show variants" with chevron icon to the right - Entire line is clickable, not just the icon - Chevron points down when collapsed, up when expanded - Matches styling of other icons in the row (size 18, text-main-view-fg/50)
1 parent 4e49a3e commit 266ec68

1 file changed

Lines changed: 31 additions & 22 deletions

File tree

web-app/src/routes/hub/index.tsx

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { Card, CardItem } from '@/containers/Card'
1919
import { RenderMarkdown } from '@/containers/RenderMarkdown'
2020
import { extractModelName, extractDescription } from '@/lib/models'
2121
import {
22+
IconChevronDown,
23+
IconChevronUp,
2224
IconDownload,
2325
IconFileCode,
2426
IconEye,
@@ -582,29 +584,36 @@ function HubContent() {
582584
</div>
583585
)}
584586
</div>
585-
{filteredModels[virtualItem.index].quants.length >
586-
1 && (
587-
<div className="flex items-center gap-2 hub-show-variants-step">
588-
<Switch
589-
checked={
590-
!!expandedModels[
591-
filteredModels[virtualItem.index]
592-
.model_name
593-
]
594-
}
595-
onCheckedChange={() =>
596-
toggleModelExpansion(
597-
filteredModels[virtualItem.index]
598-
.model_name
599-
)
600-
}
601-
/>
602-
<p className="text-main-view-fg/70">
603-
{t('hub:showVariants')}
604-
</p>
605-
</div>
606-
)}
607587
</div>
588+
{filteredModels[virtualItem.index].quants.length >
589+
1 && (
590+
<button
591+
className="flex items-center gap-1 hub-show-variants-step ml-auto"
592+
onClick={() =>
593+
toggleModelExpansion(
594+
filteredModels[virtualItem.index]
595+
.model_name
596+
)
597+
}
598+
>
599+
<span className="text-main-view-fg/80">
600+
{t('hub:showVariants')}
601+
</span>
602+
{expandedModels[
603+
filteredModels[virtualItem.index].model_name
604+
] ? (
605+
<IconChevronUp
606+
size={18}
607+
className="text-main-view-fg/50"
608+
/>
609+
) : (
610+
<IconChevronDown
611+
size={18}
612+
className="text-main-view-fg/50"
613+
/>
614+
)}
615+
</button>
616+
)}
608617
</div>
609618
{expandedModels[
610619
filteredModels[virtualItem.index].model_name

0 commit comments

Comments
 (0)