mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 17:35:28 +00:00
@@ -2,7 +2,7 @@ import { Attachment as AttachmentI } from "revolt-api/types/Autumn";
|
||||
|
||||
import styles from "./Attachment.module.scss";
|
||||
import classNames from "classnames";
|
||||
import { attachContextMenu } from "preact-context-menu";
|
||||
import { refContextMenu } from "preact-context-menu";
|
||||
import { useContext, useState } from "preact/hooks";
|
||||
|
||||
import { AppContext } from "../../../../context/revoltjs/RevoltClient";
|
||||
@@ -37,7 +37,7 @@ export default function Attachment({ attachment, hasContent }: Props) {
|
||||
<SizedGrid
|
||||
width={metadata.width}
|
||||
height={metadata.height}
|
||||
onContextMenu={attachContextMenu("Menu", {
|
||||
innerRef={refContextMenu("Menu", {
|
||||
attachment,
|
||||
})}
|
||||
className={classNames({
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import styled from "styled-components/macro";
|
||||
|
||||
import { Ref } from "preact";
|
||||
|
||||
import { Children } from "../../../../types/Preact";
|
||||
|
||||
const Grid = styled.div<{ width: number; height: number }>`
|
||||
@@ -71,13 +73,14 @@ type Props = Omit<
|
||||
children?: Children;
|
||||
width: number;
|
||||
height: number;
|
||||
innerRef?: Ref<any>;
|
||||
};
|
||||
|
||||
export function SizedGrid(props: Props) {
|
||||
const { width, height, children, ...divProps } = props;
|
||||
const { width, height, children, innerRef, ...divProps } = props;
|
||||
|
||||
return (
|
||||
<Grid {...divProps} width={width} height={height}>
|
||||
<Grid {...divProps} width={width} height={height} ref={innerRef}>
|
||||
{children}
|
||||
</Grid>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user