fix z-index for embed buttons

This commit is contained in:
hzrd149 2025-01-24 13:00:01 -06:00
parent 2bac97b819
commit 83c1616eeb
2 changed files with 14 additions and 4 deletions

View File

@ -25,10 +25,14 @@ export default function EmbedActions({
return (
<ButtonGroup variant="link" size="sm" {...props}>
<Button onClick={() => onToggle(!open)}>
<Button onClick={() => onToggle(!open)} zIndex={1}>
[ {label} {open ? <ChevronDownIcon /> : <ChevronUpIcon />} ]
</Button>
{navigator.clipboard && url && <Button onClick={copy}>{copied ? "[ Copied ]" : "[ Copy ]"}</Button>}
{navigator.clipboard && url && (
<Button onClick={copy} zIndex={1}>
{copied ? "[ Copied ]" : "[ Copy ]"}
</Button>
)}
{open && url && (
<Button as={Link} href={url.toString()} isExternal>
[ Open ]

View File

@ -1,6 +1,7 @@
import { MouseEvent, MouseEventHandler, forwardRef, useCallback, useEffect, useRef, useState } from "react";
import {
Button,
ButtonProps,
Code,
Image,
ImageProps,
@ -112,7 +113,11 @@ export function EmbeddedImage({ src, event, imageProps, ...props }: EmbeddedImag
);
}
function VerifyImageButton({ src, original }: { src: URL; original: string }) {
function VerifyImageButton({
src,
original,
...props
}: { src: URL; original: string } & Omit<ButtonProps, "children" | "onClick">) {
const toast = useToast();
const [loading, setLoading] = useState(false);
@ -144,6 +149,7 @@ function VerifyImageButton({ src, original }: { src: URL; original: string }) {
onClick={verify}
isLoading={loading}
colorScheme={matches === undefined ? undefined : matches ? "green" : "red"}
{...props}
>
[ {matches === undefined ? "Verify" : matches ? "Valid" : "Invalid!"} ]
</Button>
@ -177,7 +183,7 @@ export function renderImageUrl(match: URL) {
<ExpandableEmbed
label="Image"
url={match}
actions={hash ? <VerifyImageButton src={match} original={hash} /> : undefined}
actions={hash ? <VerifyImageButton src={match} original={hash} zIndex={1} /> : undefined}
hideOnDefaultOpen={!hash}
>
<EmbeddedImage src={match.toString()} imageProps={{ maxH: ["initial", "35vh"] }} />