AppShelf styling
This commit is contained in:
@@ -18,6 +18,7 @@ import { useState } from 'react';
|
|||||||
import { Apps } from 'tabler-icons-react';
|
import { Apps } from 'tabler-icons-react';
|
||||||
import { useConfig } from '../../tools/state';
|
import { useConfig } from '../../tools/state';
|
||||||
import { ServiceTypeList } from '../../tools/types';
|
import { ServiceTypeList } from '../../tools/types';
|
||||||
|
import { AppShelfItemWrapper } from './AppShelf';
|
||||||
|
|
||||||
export default function AddItemShelfItem(props: any) {
|
export default function AddItemShelfItem(props: any) {
|
||||||
const { addService } = useConfig();
|
const { addService } = useConfig();
|
||||||
@@ -34,30 +35,39 @@ export default function AddItemShelfItem(props: any) {
|
|||||||
>
|
>
|
||||||
<AddAppShelfItemForm setOpened={setOpened} />
|
<AddAppShelfItemForm setOpened={setOpened} />
|
||||||
</Modal>
|
</Modal>
|
||||||
<AspectRatio
|
<AppShelfItemWrapper>
|
||||||
style={{
|
<Card.Section>
|
||||||
minHeight: 120,
|
<Group position="center" mx="lg">
|
||||||
minWidth: 120,
|
<Text
|
||||||
}}
|
// TODO: #1 Remove this hack to get the text to be centered.
|
||||||
ratio={4 / 3}
|
ml={15}
|
||||||
>
|
style={{
|
||||||
<Card
|
alignSelf: 'center',
|
||||||
style={{
|
alignContent: 'center',
|
||||||
backgroundColor:
|
alignItems: 'center',
|
||||||
theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1],
|
justifyContent: 'center',
|
||||||
width: 200,
|
justifyItems: 'center',
|
||||||
height: 180,
|
}}
|
||||||
}}
|
mt="sm"
|
||||||
radius="md"
|
weight={500}
|
||||||
>
|
>
|
||||||
<Group direction="column" position="center">
|
Add a service
|
||||||
<motion.div whileHover={{ scale: 1.2 }}>
|
</Text>
|
||||||
<Apps style={{ cursor: 'pointer' }} onClick={() => setOpened(true)} size={60} />
|
|
||||||
</motion.div>
|
|
||||||
<Text>Add Service</Text>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Card>
|
</Card.Section>
|
||||||
</AspectRatio>
|
<Card.Section>
|
||||||
|
<AspectRatio ratio={5 / 3} m="xl">
|
||||||
|
<motion.i
|
||||||
|
whileHover={{
|
||||||
|
cursor: 'pointer',
|
||||||
|
scale: 1.1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Apps style={{ cursor: 'pointer' }} onClick={() => setOpened(true)} size={60} />
|
||||||
|
</motion.i>
|
||||||
|
</AspectRatio>
|
||||||
|
</Card.Section>
|
||||||
|
</AppShelfItemWrapper>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,14 +17,25 @@ import { useConfig } from '../../tools/state';
|
|||||||
import { pingQbittorrent } from '../../tools/api';
|
import { pingQbittorrent } from '../../tools/api';
|
||||||
import { serviceItem } from '../../tools/types';
|
import { serviceItem } from '../../tools/types';
|
||||||
|
|
||||||
const useStyles = createStyles((theme) => ({
|
export function AppShelfItemWrapper(props: any) {
|
||||||
main: {
|
const { children, hovering } = props;
|
||||||
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[1],
|
const theme = useMantineTheme();
|
||||||
//TODO: #3 Fix this temporary fix and make the width and height dynamic / responsive
|
return (
|
||||||
width: 200,
|
<Card
|
||||||
height: 180,
|
style={{
|
||||||
},
|
boxShadow: hovering ? '0px 0px 3px rgba(0, 0, 0, 0.5)' : '0px 0px 1px rgba(0, 0, 0, 0.5)',
|
||||||
}));
|
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[1],
|
||||||
|
|
||||||
|
//TODO: #3 Fix this temporary fix and make the width and height dynamic / responsive
|
||||||
|
width: 200,
|
||||||
|
height: 180,
|
||||||
|
}}
|
||||||
|
radius="md"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const AppShelf = (props: any) => {
|
const AppShelf = (props: any) => {
|
||||||
const { config, addService, removeService, setConfig } = useConfig();
|
const { config, addService, removeService, setConfig } = useConfig();
|
||||||
@@ -58,7 +69,6 @@ export function AppShelfItem(props: any) {
|
|||||||
const { service }: { service: serviceItem } = props;
|
const { service }: { service: serviceItem } = props;
|
||||||
const theme = useMantineTheme();
|
const theme = useMantineTheme();
|
||||||
const { removeService } = useConfig();
|
const { removeService } = useConfig();
|
||||||
const { classes } = useStyles();
|
|
||||||
const [hovering, setHovering] = useState(false);
|
const [hovering, setHovering] = useState(false);
|
||||||
return (
|
return (
|
||||||
<motion.div
|
<motion.div
|
||||||
@@ -70,13 +80,7 @@ export function AppShelfItem(props: any) {
|
|||||||
setHovering(false);
|
setHovering(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Card
|
<AppShelfItemWrapper hovering={hovering}>
|
||||||
className={classes.main}
|
|
||||||
style={{
|
|
||||||
boxShadow: hovering ? '0px 0px 3px rgba(0, 0, 0, 0.5)' : '0px 0px 1px rgba(0, 0, 0, 0.5)',
|
|
||||||
}}
|
|
||||||
radius="md"
|
|
||||||
>
|
|
||||||
<Card.Section>
|
<Card.Section>
|
||||||
<Group position="apart" mx="lg">
|
<Group position="apart" mx="lg">
|
||||||
<Space />
|
<Space />
|
||||||
@@ -128,7 +132,7 @@ export function AppShelfItem(props: any) {
|
|||||||
</motion.i>
|
</motion.i>
|
||||||
</AspectRatio>
|
</AspectRatio>
|
||||||
</Card.Section>
|
</Card.Section>
|
||||||
</Card>
|
</AppShelfItemWrapper>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user