forge
Explore
Log in

Don't you dare go Hollow

🩹 pin the settings dialog save bar to its edges

Browse files at this commit

11567779a52deb806beb36dd2f68b3d72b189066Burak BoduroğluParent: 1aafbb6
  • fix
    • 🩹 pin the settings dialog save bar to its edges
Show full message
fix: 🩹 pin the settings dialog save bar to its edges
- the account section's scroll area drops its bottom padding, which let
  content scroll past under the sticky save bar
- ProfileForm takes a footerClass so the dialog pulls the bar flush to
  its right edge past the close-button gutter
src/components/users/account-profile-dialog.tsxmodified+5 -1
@@ -62,11 +62,15 @@ export function AccountProfileDialog(props: { open: boolean; onOpenChange: (open
62 {navItem("appearance", t("settings.tabAppearance"), <IconSun class="h-4 w-4 shrink-0" />)}62 {navItem("appearance", t("settings.tabAppearance"), <IconSun class="h-4 w-4 shrink-0" />)}
63 </nav>63 </nav>
64 64
65- <div class="min-w-0 flex-1 overflow-y-auto p-5 pr-12">65+ {/* The account form's save bar is sticky at the bottom of this
66+ scroll area, so that section drops the bottom padding — any
67+ padding under a sticky bar shows content scrolling past it. */}
68+ <div class={cn("min-w-0 flex-1 overflow-y-auto p-5 pr-12", section() === "account" && "pb-0")}>
66 <Switch>69 <Switch>
67 <Match when={section() === "account"}>70 <Match when={section() === "account"}>
68 <ProfileForm71 <ProfileForm
69 user={user}72 user={user}
73+ footerClass="-mr-12 pr-12 pb-5"
70 onSaved={async () => {74 onSaved={async () => {
71 await auth.refresh();75 await auth.refresh();
72 props.onOpenChange(false);76 props.onOpenChange(false);
src/components/users/profile-form.tsxmodified+7 -1
@@ -1,4 +1,5 @@
1 import { For, Show, createSignal } from "solid-js";1 import { For, Show, createSignal } from "solid-js";
2+import { cn } from "@/lib/cn";
2 import { patchMe } from "@/api/users";3 import { patchMe } from "@/api/users";
3 import type { Gender, ProfileUpdate, User } from "@/api/client";4 import type { Gender, ProfileUpdate, User } from "@/api/client";
4 import { formatApiError } from "@/api/client";5 import { formatApiError } from "@/api/client";
@@ -57,6 +58,11 @@ export function ProfileForm(props: {
57 branches?: string[];58 branches?: string[];
58 maxDisplayNameLen?: number;59 maxDisplayNameLen?: number;
59 maxBioLen?: number;60 maxBioLen?: number;
61+ /**
62+ * Extra classes for the sticky save bar, so a host whose scroll area has
63+ * other padding can pull the bar flush to its edges (the settings dialog).
64+ */
65+ footerClass?: string;
60 /** Cap for the address field, from limits.user.max_address_len. */66 /** Cap for the address field, from limits.user.max_address_len. */
61 maxAddressLen?: number;67 maxAddressLen?: number;
62 /**68 /**
@@ -274,7 +280,7 @@ export function ProfileForm(props: {
274 </div>280 </div>
275 </div>281 </div>
276 {error() && <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p>}282 {error() && <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p>}
277- <div class="!mt-auto sticky bottom-0 -mx-5 flex justify-end border-t border-border-hairline bg-surface-base px-5 pb-1 pt-4">283+ <div class={cn("!mt-auto sticky bottom-0 -mx-5 flex justify-end border-t border-border-hairline bg-surface-base px-5 pb-1 pt-4", props.footerClass)}>
278 <Button type="submit" class="h-10 w-full sm:w-auto" disabled={pending()}>{t("common.save")}</Button>284 <Button type="submit" class="h-10 w-full sm:w-auto" disabled={pending()}>{t("common.save")}</Button>
279 </div>285 </div>
280 </form>286 </form>