💄 Update AppShelf UI

This commit is contained in:
ajnart
2022-05-17 01:43:40 +02:00
parent e3d47d78e0
commit 9a49fbb747

View File

@@ -1,13 +1,32 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import { Text, AspectRatio, Card, Image, useMantineTheme, Center, Grid } from '@mantine/core'; import {
Text,
AspectRatio,
Card,
Image,
useMantineTheme,
Center,
Grid,
createStyles,
} from '@mantine/core';
import { useConfig } from '../../tools/state'; import { useConfig } from '../../tools/state';
import { serviceItem } from '../../tools/types'; import { serviceItem } from '../../tools/types';
import AppShelfMenu from './AppShelfMenu'; import AppShelfMenu from './AppShelfMenu';
const useStyles = createStyles((theme) => ({
item: {
transition: 'box-shadow 150ms ease, transform 100ms ease',
'&:hover': {
boxShadow: `${theme.shadows.md} !important`,
transform: 'scale(1.05)',
},
},
}));
const AppShelf = (props: any) => { const AppShelf = (props: any) => {
const { config } = useConfig(); const { config } = useConfig();
return ( return (
<Grid gutter="xl" align="center"> <Grid gutter="xl" align="center">
{config.services.map((service) => ( {config.services.map((service) => (
@@ -22,7 +41,7 @@ const AppShelf = (props: any) => {
export function AppShelfItem(props: any) { export function AppShelfItem(props: any) {
const { service }: { service: serviceItem } = props; const { service }: { service: serviceItem } = props;
const [hovering, setHovering] = useState(false); const [hovering, setHovering] = useState(false);
const theme = useMantineTheme(); const { classes, theme } = useStyles();
return ( return (
<motion.div <motion.div
key={service.name} key={service.name}
@@ -33,7 +52,7 @@ export function AppShelfItem(props: any) {
setHovering(false); setHovering(false);
}} }}
> >
<Card withBorder radius="lg" shadow="md"> <Card withBorder radius="lg" shadow="md" className={classes.item}>
<Card.Section> <Card.Section>
<Text mt="sm" align="center" lineClamp={1} weight={550}> <Text mt="sm" align="center" lineClamp={1} weight={550}>
{service.name} {service.name}