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, Text,
AspectRatio, AspectRatio,
createStyles, createStyles,
Center,
SimpleGrid, SimpleGrid,
Card, Card,
useMantineTheme, useMantineTheme,
Image, Image,
Group,
Space,
} from '@mantine/core'; } from '@mantine/core';
import AppShelfMenu from './AppShelfMenu'; import AppShelfMenu from './AppShelfMenu';
import AddItemShelfItem from './AddAppShelfItem'; import AddItemShelfItem from './AddAppShelfItem';
@@ -60,6 +61,7 @@ export function AppShelfItem(props: any) {
const [hovering, setHovering] = useState(false); const [hovering, setHovering] = useState(false);
return ( return (
<motion.div <motion.div
key={service.name}
onHoverStart={(e) => { onHoverStart={(e) => {
setHovering(true); setHovering(true);
}} }}
@@ -74,19 +76,35 @@ export function AppShelfItem(props: any) {
}} }}
radius="md" 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 <motion.div
style={{
alignSelf: 'flex-end',
}}
animate={{ animate={{
opacity: hovering ? 1 : 0, opacity: hovering ? 1 : 0,
}} }}
> >
<AppShelfMenu name={service.name} removeitem={removeService} /> <AppShelfMenu name={service.name} removeitem={removeService} />
</motion.div> </motion.div>
<Card.Section> </Group>
<Center>
<Text mt="sm" weight={500}>
{service.name}
</Text>
</Center>
</Card.Section> </Card.Section>
<Card.Section> <Card.Section>
<AspectRatio ratio={5 / 3} m="xl"> <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) { export default function AppShelfMenu(props: any) {
const { name, removeitem: removeItem } = props; const { name, removeitem: removeItem } = props;
return ( return (
<Menu <Menu position="right">
style={{
position: 'absolute',
top: 10,
right: 10,
}}
>
<Menu.Label>Settings</Menu.Label> <Menu.Label>Settings</Menu.Label>
<Menu.Item <Menu.Item
color="primary" color="primary"
icon={<Edit size={14} />} icon={<Edit size={14} />}
// TODO: #2 Add the ability to edit the service.
onClick={() => { onClick={() => {
showNotification({ showNotification({
color: 'red', color: 'red',

View File

@@ -46,7 +46,7 @@ function SettingsMenu(props: any) {
color: '#a0aec0', 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> </Text>
</Group> </Group>
); );