mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-11-04 07:05:41 +00:00 
			
		
		
		
	add basic theme
This commit is contained in:
		
							
								
								
									
										5
									
								
								src/frontend/src/theme.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/frontend/src/theme.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					import { createTheme } from '@mantine/core';
 | 
				
			||||||
 | 
					import { themeToVars } from '@mantine/vanilla-extract';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const theme = createTheme({});
 | 
				
			||||||
 | 
					export const vars = themeToVars(theme);
 | 
				
			||||||
@@ -1,9 +1,12 @@
 | 
				
			|||||||
 | 
					import { MantineProvider } from '@mantine/core';
 | 
				
			||||||
 | 
					import '@mantine/core/styles.css';
 | 
				
			||||||
import { useViewportSize } from '@mantine/hooks';
 | 
					import { useViewportSize } from '@mantine/hooks';
 | 
				
			||||||
import { lazy, useEffect } from 'react';
 | 
					import { lazy, useEffect } from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { setApiDefaults } from '../App';
 | 
					import { setApiDefaults } from '../App';
 | 
				
			||||||
import { Loadable } from '../functions/loading';
 | 
					import { Loadable } from '../functions/loading';
 | 
				
			||||||
import { useLocalState } from '../states/LocalState';
 | 
					import { useLocalState } from '../states/LocalState';
 | 
				
			||||||
 | 
					import { theme } from '../theme';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function checkMobile() {
 | 
					function checkMobile() {
 | 
				
			||||||
  const { height, width } = useViewportSize();
 | 
					  const { height, width } = useViewportSize();
 | 
				
			||||||
@@ -25,9 +28,17 @@ export default function MainView() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // Check if mobile
 | 
					  // Check if mobile
 | 
				
			||||||
  if (!allowMobile && checkMobile()) {
 | 
					  if (!allowMobile && checkMobile()) {
 | 
				
			||||||
    return <MobileAppView />;
 | 
					    return (
 | 
				
			||||||
 | 
					      <MantineProvider theme={theme}>
 | 
				
			||||||
 | 
					        <MobileAppView />
 | 
				
			||||||
 | 
					      </MantineProvider>
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Main App component
 | 
					  // Main App component
 | 
				
			||||||
  return <DesktopAppView />;
 | 
					  return (
 | 
				
			||||||
 | 
					    <MantineProvider theme={theme}>
 | 
				
			||||||
 | 
					      <DesktopAppView />
 | 
				
			||||||
 | 
					    </MantineProvider>
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user