refactor(nui): Improve design scalability

This commit is contained in:
Luke committed 2022-02-14 23:10:42 +01:00
1 parent 4e027c18fe
commit 1e00e9fe02
6 files changed
+20 -20

No files matched your search

+6 -6
View File
@@ -1,4 +1,4 @@
import { Center, Box } from '@chakra-ui/react';
import { Flex, Box } from '@chakra-ui/react';
import { debugData } from '../utils/debugData';
import TopBar from './NavBars/TopBar';
import LeftBar from './NavBars/LeftBar';
@@ -31,12 +31,12 @@ const App: React.FC = () => {
useNuiEvent('openUI', () => navigate('/'));
return (
<Center w="100%" h="100%">
<Flex w="100%" h="100%" alignItems="center" justifyContent="center">
<Box
width="60%"
height="50%"
width="6xl"
height="lg"
backgroundColor="#191E26"
borderRadius="1vh"
borderRadius="lg"
color="white"
fontFamily="Poppins"
userSelect="none"
@@ -51,7 +51,7 @@ const App: React.FC = () => {
</Routes>
</MainContent>
</Box>
</Center>
</Flex>
);
};
+5 -7
View File
@@ -3,13 +3,11 @@ import { Box, Center } from '@chakra-ui/react';
const MainContent: React.FC = ({ children }) => {
return (
<>
<Center h="95%" alignItems="stretch">
<Box h="100%" w="50%" backgroundColor="#1B2129" flex="1" overflowY="scroll">
{children}
</Box>
</Center>
</>
<Center>
<Box h="30.3rem" w="50%" backgroundColor="#1B2129" flex="1">
{children}
</Box>
</Center>
);
};
+4 -2
View File
@@ -18,7 +18,7 @@ const LeftBar: React.FC = () => {
});
return (
<Box p="1.2vh" fontSize="1.5vh" float="left" w="13%" height="90%" overflowY="scroll">
<Box pl={3} pr={3} pb={3} pt={2} fontSize="md" float="left" w={150} height="90%" overflowY="scroll">
<VStack align="left">
{initData.resources.map((resource, index) => (
<Box isTruncated key={`${resource}-${index}`}>
@@ -28,7 +28,9 @@ const LeftBar: React.FC = () => {
color: state.isActive ? 'white' : 'grey',
})}
>
<Box _hover={{ color: 'white' }}>{resource}</Box>
<Box _hover={{ color: 'white' }} isTruncated>
{resource}
</Box>
</NavLink>
</Box>
))}
+1 -1
View File
@@ -20,7 +20,7 @@ const RightBar: React.FC = () => {
});
return (
<Box float="right" w="20%" h="100%" p="1.2vh">
<Box float="right" w="3xs" h="100%" p={3}>
<Center h="100%">
<Flex direction="column" h="100%">
<Box>
+2 -2
View File
@@ -2,8 +2,8 @@ import { Box, Text } from '@chakra-ui/react';
const TopBar: React.FC = () => {
return (
<Box w="100%" h="5%">
<Text paddingLeft="1.2vh" fontSize="2vh">
<Box w="full" h="4xs">
<Text paddingLeft={3} fontSize="lg">
Resources
</Text>
</Box>
+2 -2
View File
@@ -105,7 +105,7 @@ const Resource: React.FC = () => {
});
return (
<Flex direction="column" justifyContent="space-between" alignItems="center" h="100%">
<Flex direction="column" justifyContent="space-between" alignItems="center" h="full">
<Table {...getTableProps()} size="sm">
<Thead>
{headerGroups.map((header): any => (
@@ -164,7 +164,7 @@ const Resource: React.FC = () => {
{!isLoaded && <Spinner />}
<Flex mt={3} justifyContent="center " alignItems="center" p="1.2vh">
<Flex justifyContent="center" alignItems="center" p={3}>
<Flex>
<IconButton
icon={<ArrowLeftIcon h={3} w={3} color="black" />}