🐛 wrong absolute position of torrent options menu

This commit is contained in:
Manuel Ruwe
2022-10-15 23:45:46 +02:00
committed by Manuel
parent 096dd4c156
commit f951bcd750
5 changed files with 34 additions and 11 deletions

View File

@@ -11,6 +11,15 @@ export interface IModule {
icon: TablerIcon;
component: React.ComponentType;
options?: Option;
padding?: PaddingOptions = {
right: 15,
top: 15,
},
}
interface PaddingOptions {
top: number;
right: number;
}
interface Option {

View File

@@ -186,8 +186,13 @@ export function ModuleWrapper(props: any) {
);
}
export function ModuleMenu(props: any) {
const { module, styles, hovered } = props;
interface ModuleMenuProps {
hovered: boolean;
module: IModule;
}
export function ModuleMenu(props: ModuleMenuProps) {
const { module, hovered } = props;
const items: JSX.Element[] = getItems(module);
const { t } = useTranslation('modules/common');
return (
@@ -207,12 +212,13 @@ export function ModuleMenu(props: any) {
<motion.div
style={{
position: 'absolute',
top: 15,
right: 15,
top: module.padding?.top ?? 15,
right: module.padding?.right ?? 15,
alignSelf: 'flex-end',
zIndex: 10,
}}
animate={{
opacity: hovered === true ? 1 : 0,
opacity: hovered ? 1 : 0,
}}
>
<ActionIcon>

View File

@@ -34,6 +34,10 @@ export const TorrentsModule: IModule = {
value: false,
},
},
padding: {
right: 0,
top: -10,
},
};
export default function TorrentsComponent() {