From 86266609aa45df9fe11af934839049e5cb5d744b Mon Sep 17 00:00:00 2001 From: BlowaterNostr <127284497+BlowaterNostr@users.noreply.github.com> Date: Sun, 24 Dec 2023 17:26:49 +0800 Subject: [PATCH] Christmas (#365) * christmas hat --- UI/components/avatar.test.tsx | 5 +++ UI/components/avatar.tsx | 78 ++++++++++++++++++++++++++--------- UI/edit-profile.tsx | 7 +--- UI/right-panel.tsx | 2 +- 4 files changed, 66 insertions(+), 26 deletions(-) create mode 100644 UI/components/avatar.test.tsx diff --git a/UI/components/avatar.test.tsx b/UI/components/avatar.test.tsx new file mode 100644 index 0000000..e308e32 --- /dev/null +++ b/UI/components/avatar.test.tsx @@ -0,0 +1,5 @@ +/** @jsx h */ +import { h, render } from "https://esm.sh/preact@10.17.1"; +import { Avatar } from "./avatar.tsx"; + +render(, document.body); diff --git a/UI/components/avatar.tsx b/UI/components/avatar.tsx index 31620bf..f36bc70 100644 --- a/UI/components/avatar.tsx +++ b/UI/components/avatar.tsx @@ -12,26 +12,64 @@ export function Avatar(props: { onClick?: h.JSX.MouseEventHandler; }) { return ( - avatar { - e.currentTarget.src = "logo.webp"; - e.currentTarget.style.objectFit = "contain"; - }} - onLoad={(e) => { - if (e.currentTarget.src.endsWith("logo.webp")) { +
+ {/* Container for positioning */} + + + avatar { + e.currentTarget.src = "logo.webp"; e.currentTarget.style.objectFit = "contain"; - } else { - e.currentTarget.style.objectFit = "cover"; - } - }} - /> + }} + onLoad={(e) => { + if (e.currentTarget.src.endsWith("logo.webp")) { + e.currentTarget.style.objectFit = "contain"; + } else { + e.currentTarget.style.objectFit = "cover"; + } + }} + > + +
+ ); +} + +function SantaHat(props: { class?: string }) { + return ( + + + + + + + + ); } diff --git a/UI/edit-profile.tsx b/UI/edit-profile.tsx index 0a997a7..d75118e 100644 --- a/UI/edit-profile.tsx +++ b/UI/edit-profile.tsx @@ -51,10 +51,7 @@ export class EditProfile extends Component { container: `py-4 bg-[${SecondaryBackgroundColor}]`, banner: { container: `h-72 w-full rounded-lg mb-20 relative`, - avatar: - `w-24 h-24 m-auto absolute top-60 left-1/2 box-border border-2 border-[${PrimaryTextColor}] -translate-x-2/4`, }, - avatar: `w-24 h-24 m-auto box-border border-2 border-[${PrimaryTextColor}]`, field: { title: `text-[${PrimaryTextColor}] mt-8`, input: `${InputClass}`, @@ -199,14 +196,14 @@ export class EditProfile extends Component { > ) : ( ); diff --git a/UI/right-panel.tsx b/UI/right-panel.tsx index 8c43067..dd4d545 100644 --- a/UI/right-panel.tsx +++ b/UI/right-panel.tsx @@ -32,7 +32,7 @@ export class RightPanel extends Component { class={`border-l fixed top-0 right-0 h-full bg-[#2F3136] overflow-hidden overflow-y-auto z-20 transition-all duration-300 ease-in-out w-96 max-w-full`} >