1
0
mirror of https://github.com/XFox111/MuiCharts.git synced 2026-04-22 06:51:05 +03:00

Created empty project

This commit is contained in:
2024-02-17 13:37:40 +00:00
parent d96b683a90
commit 26b0ffbf95
17 changed files with 3303 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { makeStyles } from "./Utils/makeStyles";
/**
* Stylesheet for the App component.
*/
const AppStyles = makeStyles(theme => ({
root:
{
display: "flex",
flexFlow: "column",
height: "100%",
alignItems: "center",
justifyContent: "center"
},
caption:
{
marginTop: theme.spacing(2),
},
}));
export default AppStyles;
+28
View File
@@ -0,0 +1,28 @@
import { Button, Container, GlobalStyles, Theme, ThemeProvider, Typography, createTheme } from "@mui/material";
import { useState } from "react";
import useStyles from "./App.styles";
const theme: Theme = createTheme();
/**
* The main application component.
*/
function App(): JSX.Element
{
const sx = useStyles();
const [clicks, setClicks] = useState<number>(0);
return (
<ThemeProvider theme={ theme }>
<GlobalStyles styles={ { "body, #root": { height: "100vh", margin: 0 } } } />
<Container sx={ sx.root }>
<Typography variant="h1" gutterBottom>Hello World!</Typography>
<Button variant="contained" color="primary" onClick={ () => setClicks(clicks + 1) }>Click me</Button>
<Typography variant="body1" sx={ sx.caption }>Times clicked: { clicks }</Typography>
</Container>
</ThemeProvider>
);
}
export default App;
+15
View File
@@ -0,0 +1,15 @@
import { SxProps, Theme, useTheme } from "@mui/material";
/**
* Utility function that allows to create SxProps stylesheets outside of the component.
* @param styles Your stylesheet. A function that takes a theme and returns a SxProps object.
* @returns A react hook that returns the SxProps object.
*/
const makeStyles = <T>(styles: (theme: Theme) => Record<keyof T, SxProps>) =>
(): Record<keyof T, SxProps> =>
{
const theme = useTheme();
return styles(theme);
};
export { makeStyles };
+10
View File
@@ -0,0 +1,10 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
);
+1
View File
@@ -0,0 +1 @@
/// <reference types="vite/client" />