feat(ui): standardize responsive control sizing (#3563)
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
updateMarketplaceSource,
|
||||
} from "@/lib/api/domains/marketplace-api";
|
||||
import type { MarketplaceSource } from "@/lib/types/plugins";
|
||||
import { controlSizingClassName } from "@kandev/ui/control-sizing";
|
||||
|
||||
type MarketplaceSourcesDialogProps = {
|
||||
open: boolean;
|
||||
@@ -128,7 +129,7 @@ function SourceItem({ source, onChanged }: { source: MarketplaceSource; onChange
|
||||
size="icon"
|
||||
disabled={busy}
|
||||
onClick={remove}
|
||||
className="min-h-11 min-w-11 cursor-pointer sm:min-h-0 sm:min-w-0"
|
||||
className={controlSizingClassName("icon", "cursor-pointer")}
|
||||
aria-label={t("plugins:removeSource", { name: source.name })}
|
||||
>
|
||||
<IconTrash className="h-4 w-4" />
|
||||
@@ -169,7 +170,7 @@ function AddSourceForm({ onChanged }: { onChanged: () => void }) {
|
||||
placeholder={t("plugins:sourceNamePlaceholder")}
|
||||
value={name}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
className="min-h-11 sm:min-h-7"
|
||||
className={controlSizingClassName("standard")}
|
||||
data-testid="marketplace-add-source-name"
|
||||
/>
|
||||
<div className="flex items-center gap-2">
|
||||
@@ -177,13 +178,13 @@ function AddSourceForm({ onChanged }: { onChanged: () => void }) {
|
||||
placeholder={t("plugins:sourceUrlPlaceholder")}
|
||||
value={url}
|
||||
onChange={(e) => setUrl(e.target.value)}
|
||||
className="min-h-11 sm:min-h-7"
|
||||
className={controlSizingClassName("standard")}
|
||||
data-testid="marketplace-add-source-url"
|
||||
/>
|
||||
<Button
|
||||
disabled={busy || !url.trim()}
|
||||
onClick={submit}
|
||||
className="min-h-11 cursor-pointer shrink-0 sm:min-h-0"
|
||||
className={controlSizingClassName("standard", "cursor-pointer shrink-0")}
|
||||
data-testid="marketplace-add-source-submit"
|
||||
>
|
||||
{t("plugins:add")}
|
||||
|
||||
@@ -26,6 +26,7 @@ import { usePluginActions } from "./use-plugin-actions";
|
||||
import { usePluginConfigForm } from "./use-plugin-config-form";
|
||||
import type { PluginRecord } from "@/lib/types/plugins";
|
||||
import { SETTINGS_TYPOGRAPHY } from "@/components/settings/settings-typography";
|
||||
import { controlSizingClassName } from "@kandev/ui/control-sizing";
|
||||
|
||||
const PLUGINS_SETTINGS_HREF = "/settings/plugins";
|
||||
|
||||
@@ -246,7 +247,10 @@ function PluginDangerZone({
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="cursor-pointer min-h-11 sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"cursor-pointer max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
disabled={busy}
|
||||
onClick={() => actions.handleEnable(plugin)}
|
||||
>
|
||||
@@ -257,7 +261,10 @@ function PluginDangerZone({
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="cursor-pointer min-h-11 sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"cursor-pointer max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
disabled={busy}
|
||||
onClick={() => actions.handleDisable(plugin)}
|
||||
>
|
||||
@@ -269,7 +276,10 @@ function PluginDangerZone({
|
||||
ref={uninstallAnchorRef}
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="cursor-pointer min-h-11 text-destructive hover:text-destructive sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"cursor-pointer text-destructive hover:text-destructive max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
disabled={busy}
|
||||
onClick={onUninstall}
|
||||
>
|
||||
|
||||
@@ -18,6 +18,7 @@ import { PluginErrorDiagnostic } from "./plugin-error-diagnostic";
|
||||
import { PluginUninstallConfirmation } from "./uninstall-plugin-dialog";
|
||||
import type { MarketplaceEntry, PluginRecord } from "@/lib/types/plugins";
|
||||
import { SETTINGS_TYPOGRAPHY } from "@/components/settings/settings-typography";
|
||||
import { controlSizingClassName } from "@kandev/ui/control-sizing";
|
||||
|
||||
/**
|
||||
* The row's view of its marketplace-update status, computed by
|
||||
@@ -496,7 +497,10 @@ function PluginRowActions({
|
||||
variant="default"
|
||||
size="sm"
|
||||
data-testid={`plugin-update-${plugin.id}`}
|
||||
className="cursor-pointer gap-1 min-h-11 sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"cursor-pointer gap-1 max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
aria-busy={update?.busy ? "true" : undefined}
|
||||
disabled={busy}
|
||||
onClick={() => onUpdate(updateEntry)}
|
||||
@@ -515,7 +519,10 @@ function PluginRowActions({
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="cursor-pointer min-h-11 sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"cursor-pointer max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
disabled={busy}
|
||||
onClick={() => onEnable(plugin)}
|
||||
>
|
||||
@@ -526,7 +533,10 @@ function PluginRowActions({
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="cursor-pointer min-h-11 sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"cursor-pointer max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
disabled={busy}
|
||||
onClick={() => onDisable(plugin)}
|
||||
>
|
||||
@@ -538,7 +548,10 @@ function PluginRowActions({
|
||||
ref={uninstallAnchorRef}
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="cursor-pointer min-h-11 text-destructive hover:text-destructive sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"cursor-pointer text-destructive hover:text-destructive max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
disabled={busy}
|
||||
onClick={() => onUninstall(plugin)}
|
||||
>
|
||||
@@ -549,7 +562,10 @@ function PluginRowActions({
|
||||
href={`/settings/plugins/${encodeURIComponent(plugin.id)}`}
|
||||
data-testid={`plugin-settings-link-${plugin.id}`}
|
||||
aria-label={t("plugins:openSettingsFor", { name: plugin.display_name })}
|
||||
className="inline-flex min-h-11 shrink-0 items-center gap-1 rounded-md px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground cursor-pointer sm:min-h-0"
|
||||
className={controlSizingClassName(
|
||||
"compact",
|
||||
"inline-flex shrink-0 items-center gap-1 rounded-md px-2 text-xs text-muted-foreground hover:bg-muted hover:text-foreground cursor-pointer max-md:min-h-11 [@media(pointer:coarse)]:min-h-11",
|
||||
)}
|
||||
>
|
||||
<IconSettings className="h-4 w-4" aria-hidden />
|
||||
{t("plugins:settings")}
|
||||
|
||||
Reference in New Issue
Block a user