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
+17 -17

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