fix(web): adapt provider settings to available content width (#12138)
This commit is contained in:
1 parent
d1a6448971
commit
384de0858d
4 files changed
+25
-17
No files matched your search
@@ -817,7 +817,7 @@ export function ProviderInstanceCard({
|
||||
inert={readOnly}
|
||||
aria-disabled={readOnly || undefined}
|
||||
className={cn(
|
||||
"flex w-full items-center justify-end gap-2 sm:w-auto",
|
||||
"flex w-full min-w-0 items-center justify-end gap-2 @min-[32rem]/settings-row:w-auto",
|
||||
readOnly && "opacity-50 select-none",
|
||||
)}
|
||||
>
|
||||
@@ -831,7 +831,7 @@ export function ProviderInstanceCard({
|
||||
<DraftInput
|
||||
id={`provider-instance-${instanceId}-display-name`}
|
||||
size="sm"
|
||||
className="min-w-0 flex-1 sm:w-56 sm:flex-none"
|
||||
className="min-w-0 flex-1 @min-[32rem]/settings-row:w-56"
|
||||
value={instance.displayName ?? ""}
|
||||
onCommit={updateDisplayName}
|
||||
placeholder={driverOption?.label ?? "Instance label"}
|
||||
|
||||
@@ -265,14 +265,14 @@ function ProviderSettingsFieldRow({
|
||||
value={value}
|
||||
inputId={inputId}
|
||||
size="sm"
|
||||
className="w-full sm:w-56"
|
||||
className="w-full max-w-full @min-[32rem]/settings-row:w-56"
|
||||
onChange={onChange}
|
||||
/>
|
||||
) : field.control === "textarea" ? (
|
||||
<Textarea
|
||||
id={inputId}
|
||||
aria-describedby={descriptionId}
|
||||
className="w-full sm:w-96"
|
||||
className="w-full max-w-full @min-[32rem]/settings-row:w-[min(24rem,50cqw)]"
|
||||
value={readProviderConfigString(value, field.key)}
|
||||
onChange={(event) =>
|
||||
onChange(nextProviderConfigWithFieldValue(value, field, event.target.value))
|
||||
@@ -285,7 +285,7 @@ function ProviderSettingsFieldRow({
|
||||
id={inputId}
|
||||
aria-describedby={descriptionId}
|
||||
size="sm"
|
||||
className="w-full sm:w-56"
|
||||
className="w-full max-w-full @min-[32rem]/settings-row:w-56"
|
||||
type={field.control === "password" ? "password" : undefined}
|
||||
autoComplete={field.control === "password" ? "off" : undefined}
|
||||
value={readProviderConfigString(value, field.key)}
|
||||
|
||||
@@ -174,7 +174,8 @@ function providerEnvironmentDetail(environment: EnvironmentPresentation): string
|
||||
const providerCardClassName = "rounded-xl border border-border/60 bg-card/40 shadow-xs/5";
|
||||
// Shared by the editor grid and the placeholder states so switching devices
|
||||
// never changes the card's footprint.
|
||||
const providerCardHeightClassName = "lg:h-[min(44rem,calc(100dvh-11rem))] lg:min-h-[32rem]";
|
||||
const providerCardHeightClassName =
|
||||
"@min-[48rem]/providers:h-[min(44rem,calc(100dvh-11rem))] @min-[48rem]/providers:min-h-[32rem]";
|
||||
|
||||
/**
|
||||
* Same chrome as the provider editor (section heading, floating device tabs,
|
||||
@@ -271,7 +272,7 @@ interface ProviderSettingsTarget {
|
||||
|
||||
export function ProviderSettingsPanel(target: ProviderSettingsTarget) {
|
||||
return (
|
||||
<SettingsPageContainer width="wide" className="gap-8">
|
||||
<SettingsPageContainer width="wide" className="@container/providers gap-8">
|
||||
<ProviderSettingsPanelContent
|
||||
key={`${target.environmentId ?? ""}:${target.instanceId ?? ""}`}
|
||||
{...target}
|
||||
@@ -1054,20 +1055,24 @@ export function EnvironmentProviderSettings({
|
||||
className={cn(
|
||||
providerCardClassName,
|
||||
providerCardHeightClassName,
|
||||
"overflow-hidden lg:grid lg:grid-cols-[17rem_minmax(0,1fr)]",
|
||||
"overflow-hidden @min-[48rem]/providers:grid @min-[48rem]/providers:grid-cols-[17rem_minmax(0,1fr)]",
|
||||
)}
|
||||
>
|
||||
<div className="border-b border-border/60 bg-muted/10 lg:flex lg:min-h-0 lg:flex-col lg:border-r lg:border-b-0">
|
||||
<ScrollArea scrollFade chainVerticalScroll className="lg:min-h-0 lg:flex-1">
|
||||
<div className="border-b border-border/60 bg-muted/10 @min-[48rem]/providers:flex @min-[48rem]/providers:min-h-0 @min-[48rem]/providers:flex-col @min-[48rem]/providers:border-r @min-[48rem]/providers:border-b-0">
|
||||
<ScrollArea
|
||||
scrollFade
|
||||
chainVerticalScroll
|
||||
className="@min-[48rem]/providers:min-h-0 @min-[48rem]/providers:flex-1"
|
||||
>
|
||||
<div className="divide-y divide-border/50">
|
||||
{rows.map((row) => renderProviderInstance(row, "list"))}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
<div className="min-w-0 lg:min-h-0">
|
||||
<div className="min-w-0 @min-[48rem]/providers:min-h-0">
|
||||
{selectedRow ? (
|
||||
<ScrollArea scrollFade chainVerticalScroll className="lg:h-full">
|
||||
<ScrollArea scrollFade chainVerticalScroll className="@min-[48rem]/providers:h-full">
|
||||
<div className="space-y-6 p-4">{renderProviderInstance(selectedRow, "editor")}</div>
|
||||
</ScrollArea>
|
||||
) : (
|
||||
|
||||
@@ -368,11 +368,14 @@ export function SettingsRow({
|
||||
// Focusable so keyboard users can still reach the explanation.
|
||||
<span
|
||||
tabIndex={0}
|
||||
className="flex w-full items-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring sm:w-auto"
|
||||
className="flex w-full items-center rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring @min-[32rem]/settings-row:w-auto"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<div inert className="flex w-full items-center gap-2 opacity-50 sm:w-auto">
|
||||
<div
|
||||
inert
|
||||
className="flex w-full items-center gap-2 opacity-50 @min-[32rem]/settings-row:w-auto"
|
||||
>
|
||||
{control}
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
@@ -437,12 +440,12 @@ export function SettingsRow({
|
||||
tabIndex={rowProps.id ? -1 : rowProps.tabIndex}
|
||||
data-slot="settings-row"
|
||||
className={cn(
|
||||
"rounded-xl px-3 sm:px-4 aria-disabled:opacity-50 aria-disabled:[&_*]:text-muted-foreground",
|
||||
"@container/settings-row rounded-xl px-3 sm:px-4 aria-disabled:opacity-50 aria-disabled:[&_*]:text-muted-foreground",
|
||||
children ? "pt-3 pb-1" : "py-3",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="flex flex-col gap-3 sm:grid sm:grid-cols-[minmax(0,1fr)_minmax(10rem,auto)] sm:items-center sm:gap-8">
|
||||
<div className="flex flex-col gap-3 @min-[32rem]/settings-row:grid @min-[32rem]/settings-row:grid-cols-[minmax(0,1fr)_minmax(10rem,auto)] @min-[32rem]/settings-row:items-center @min-[32rem]/settings-row:gap-8">
|
||||
<div className="min-w-0 flex-1 space-y-1">
|
||||
<div className="flex min-h-5 items-center gap-1.5">
|
||||
<h3 className="text-sm font-medium tracking-[-0.005em] text-foreground">{title}</h3>
|
||||
@@ -465,7 +468,7 @@ export function SettingsRow({
|
||||
) : null}
|
||||
</div>
|
||||
{renderedControl ? (
|
||||
<div className="flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end">
|
||||
<div className="flex w-full min-w-0 shrink-0 items-center gap-2 @min-[32rem]/settings-row:w-auto @min-[32rem]/settings-row:justify-end">
|
||||
{renderedControl}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
Reference in new issue
Block a user