feat: Base implementation of v2 of avatars (#12369)
* feat: Base implementation of v2 of avatars * Make avatarUrl and logoUrl entirely optional * Made necessary backwards compat changes * fix: type errors * Fix: OG image * fix types * Consistency with other behaviour, ux tweak --------- Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
c55b36f235
commit
4f26ca1a7b
18 files changed
+258
-69
No files matched your search
@@ -177,6 +177,7 @@ export const DialogTrigger = DialogPrimitive.Trigger;
|
||||
|
||||
export function DialogClose(
|
||||
props: {
|
||||
"data-testid"?: string;
|
||||
dialogCloseProps?: React.ComponentProps<(typeof DialogPrimitive)["Close"]>;
|
||||
children?: ReactNode;
|
||||
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
||||
@@ -188,7 +189,10 @@ export function DialogClose(
|
||||
return (
|
||||
<DialogPrimitive.Close asChild {...props.dialogCloseProps}>
|
||||
{/* This will require the i18n string passed in */}
|
||||
<Button data-testid="dialog-rejection" color={props.color || "minimal"} {...props}>
|
||||
<Button
|
||||
data-testid={props["data-testid"] || "dialog-rejection"}
|
||||
color={props.color || "minimal"}
|
||||
{...props}>
|
||||
{props.children ? props.children : t("Close")}
|
||||
</Button>
|
||||
</DialogPrimitive.Close>
|
||||
|
||||
@@ -170,7 +170,11 @@ export default function ImageUploader({
|
||||
}
|
||||
}}>
|
||||
<DialogTrigger asChild>
|
||||
<Button color={triggerButtonColor ?? "secondary"} type="button" className="py-1 text-sm">
|
||||
<Button
|
||||
color={triggerButtonColor ?? "secondary"}
|
||||
type="button"
|
||||
data-testid="open-upload-avatar-dialog"
|
||||
className="py-1 text-sm">
|
||||
{buttonMsg}
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
@@ -190,7 +194,9 @@ export default function ImageUploader({
|
||||
</div>
|
||||
)}
|
||||
{result && <CropContainer imageSrc={result as string} onCropComplete={setCroppedAreaPixels} />}
|
||||
<label className="bg-subtle hover:bg-muted hover:text-emphasis border-subtle text-default mt-8 rounded-sm border px-3 py-1 text-xs font-medium leading-4 focus:outline-none focus:ring-2 focus:ring-neutral-900 focus:ring-offset-1">
|
||||
<label
|
||||
data-testid="open-upload-image-filechooser"
|
||||
className="bg-subtle hover:bg-muted hover:text-emphasis border-subtle text-default mt-8 rounded-sm border px-3 py-1 text-xs font-medium leading-4 focus:outline-none focus:ring-2 focus:ring-neutral-900 focus:ring-offset-1">
|
||||
<input
|
||||
onInput={onInputFile}
|
||||
type="file"
|
||||
@@ -205,8 +211,10 @@ export default function ImageUploader({
|
||||
</div>
|
||||
<DialogFooter className="relative">
|
||||
<DialogClose color="minimal">{t("cancel")}</DialogClose>
|
||||
|
||||
<DialogClose color="primary" onClick={() => showCroppedImage(croppedAreaPixels)}>
|
||||
<DialogClose
|
||||
data-testid="upload-avatar"
|
||||
color="primary"
|
||||
onClick={() => showCroppedImage(croppedAreaPixels)}>
|
||||
{t("save")}
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
|
||||
Reference in new issue
Block a user