Fix right menu position and a typo

This commit is contained in:
Aj - Thomas
2022-05-04 07:49:29 +02:00
parent 1667ea2754
commit 6769ca701c
3 changed files with 32 additions and 19 deletions

View File

@@ -4,11 +4,12 @@ import {
Text,
AspectRatio,
createStyles,
Center,
SimpleGrid,
Card,
useMantineTheme,
Image,
Group,
Space,
} from '@mantine/core';
import AppShelfMenu from './AppShelfMenu';
import AddItemShelfItem from './AddAppShelfItem';
@@ -60,6 +61,7 @@ export function AppShelfItem(props: any) {
const [hovering, setHovering] = useState(false);
return (
<motion.div
key={service.name}
onHoverStart={(e) => {
setHovering(true);
}}
@@ -74,19 +76,35 @@ export function AppShelfItem(props: any) {
}}
radius="md"
>
<Card.Section>
<Group position="apart" mx="lg">
<Space />
<Text
// TODO: #1 Remove this hack to get the text to be centered.
ml={15}
style={{
alignSelf: 'center',
alignContent: 'center',
alignItems: 'center',
justifyContent: 'center',
justifyItems: 'center',
}}
mt="sm"
weight={500}
>
{service.name}
</Text>
<motion.div
style={{
alignSelf: 'flex-end',
}}
animate={{
opacity: hovering ? 1 : 0,
}}
>
<AppShelfMenu name={service.name} removeitem={removeService} />
</motion.div>
<Card.Section>
<Center>
<Text mt="sm" weight={500}>
{service.name}
</Text>
</Center>
</Group>
</Card.Section>
<Card.Section>
<AspectRatio ratio={5 / 3} m="xl">

View File

@@ -5,17 +5,12 @@ import { Check, Edit, Trash } from 'tabler-icons-react';
export default function AppShelfMenu(props: any) {
const { name, removeitem: removeItem } = props;
return (
<Menu
style={{
position: 'absolute',
top: 10,
right: 10,
}}
>
<Menu position="right">
<Menu.Label>Settings</Menu.Label>
<Menu.Item
color="primary"
icon={<Edit size={14} />}
// TODO: #2 Add the ability to edit the service.
onClick={() => {
showNotification({
color: 'red',

View File

@@ -46,7 +46,7 @@ function SettingsMenu(props: any) {
color: '#a0aec0',
}}
>
tip: You can upload your config file by dragging and dropping it into the page
tip: You can upload your config file by dragging and dropping it onto the page
</Text>
</Group>
);