Merge pull request #16 from Pup-Ion-Dev/ui-overhaul

UI overhaul
This commit is contained in:
Drew Rautenberg
2025-01-17 10:18:27 -06:00
committed by GitHub
13 changed files with 565 additions and 975 deletions
+402 -899
View File
File diff suppressed because it is too large Load Diff
+6 -3
View File
@@ -10,6 +10,9 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@mantine/core": "^7.16.0",
"@mantine/form": "^7.16.0",
"@mantine/hooks": "^7.16.0",
"@tanstack/react-query": "^5.64.1", "@tanstack/react-query": "^5.64.1",
"@tanstack/react-query-devtools": "^5.64.1", "@tanstack/react-query-devtools": "^5.64.1",
"axios": "^1.7.9", "axios": "^1.7.9",
@@ -24,13 +27,13 @@
"@types/react": "^18.3.18", "@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5", "@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4", "@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20",
"eslint": "^9.17.0", "eslint": "^9.17.0",
"eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.16", "eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.14.0", "globals": "^15.14.0",
"postcss": "^8.4.49", "postcss": "^8.5.1",
"tailwindcss": "^3.4.17", "postcss-preset-mantine": "^1.17.0",
"postcss-simple-vars": "^7.0.1",
"typescript": "~5.6.2", "typescript": "~5.6.2",
"typescript-eslint": "^8.18.2", "typescript-eslint": "^8.18.2",
"vite": "^6.0.5" "vite": "^6.0.5"
+14
View File
@@ -0,0 +1,14 @@
module.exports = {
plugins: {
'postcss-preset-mantine': {},
'postcss-simple-vars': {
variables: {
'mantine-breakpoint-xs': '36em',
'mantine-breakpoint-sm': '48em',
'mantine-breakpoint-md': '62em',
'mantine-breakpoint-lg': '75em',
'mantine-breakpoint-xl': '88em',
},
},
},
};
-6
View File
@@ -1,6 +0,0 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
+23 -2
View File
@@ -2,12 +2,33 @@ import { Routes, Route} from 'react-router';
import Home from './pages/home.tsx'; import Home from './pages/home.tsx';
import InventoryList from "./features/inventory/InventoryList.tsx"; import InventoryList from "./features/inventory/InventoryList.tsx";
import { QueryClientProvider, QueryClient } from '@tanstack/react-query'; import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
import {createTheme, MantineProvider} from '@mantine/core';
import '@mantine/core/styles.css';
// Create a client // Create a client
const queryClient = new QueryClient() const queryClient = new QueryClient()
const barkTheme = createTheme({
primaryColor: 'red',
colors: {
'red': [
"#ffe8e8",
"#ffcfd0",
"#fd9d9d",
"#fb6868",
"#fa3c3b",
"#f9211e",
"#fa120f",
"#df0404",
"#c70002",
"#ae0000"
],
},
});
function App() { function App() {
return ( return <MantineProvider defaultColorScheme="auto" theme={barkTheme}>{ (
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<> <>
<Routes> <Routes>
@@ -18,7 +39,7 @@ function App() {
</> </>
</QueryClientProvider> </QueryClientProvider>
) ) }</MantineProvider>;
} }
export default App export default App
@@ -0,0 +1,10 @@
import {PropsWithChildren} from "react";
import { Button } from '@mantine/core';
function BarkButton({children}: PropsWithChildren) {
return (
<Button variant="filled" color="red" size="md" radius="md">{children}</Button>
)
}
export default BarkButton;
@@ -0,0 +1,33 @@
.header {
height: 56px;
margin-bottom: 6px;
background-color: var(--mantine-color-body);
border-bottom: 1px solid var(--mantine-color-default-border);
}
.inner {
height: 56px;
display: flex;
justify-content: space-between;
align-items: center;
}
.link {
display: block;
line-height: 1;
padding: 8px 12px;
border-radius: var(--mantine-radius-sm);
text-decoration: none;
color: var(--mantine-color-text);
font-size: var(--mantine-font-size-sm);
font-weight: 500;
&:hover {
background-color: var(--mantine-color-default-hover);
}
[data-mantine-color-scheme] &.active {
background-color: var(--mantine-color-red-filled);
color: var(--mantine-color-white);
}
}
@@ -0,0 +1,33 @@
import { Burger, Container, Group } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
import classes from './BarkHeader.module.css';
import {NavLink} from "react-router";
const links = [
{ link: '/', label: 'Home' },
{ link: '/inventory', label: 'Inventory' },
];
export function BarkHeader() {
const [opened, { toggle }] = useDisclosure(false);
const items = links.map((link) => (
<NavLink className = {({ isActive }) =>
classes.link + ' ' + (isActive ? classes.active : '')} to={link.link} >
{link.label}
</NavLink>
));
return (
<header className={classes.header}>
<Container size="md" className={classes.inner}>
<Group gap={5} visibleFrom="xs">
{items}
</Group>
<Burger opened={opened} onClick={toggle} hiddenFrom="xs" size="sm" />
</Container>
</header>
);
}
@@ -1,9 +0,0 @@
import {PropsWithChildren} from "react";
function Button({children}: PropsWithChildren) {
return (
<button className="bg-brand rounded text-white font-bold px-4 py-2">{children}</button>
)
}
export default Button
@@ -1,7 +1,8 @@
import {useQuery} from "@tanstack/react-query"; import {useQuery} from "@tanstack/react-query";
import {Link} from "react-router";
import {InventoryItem} from "./types"; import {InventoryItem} from "./types";
import Button from "../../common/components/Button.tsx"; import {BarkHeader} from "../../common/components/BarkHeader.tsx";
import {Flex, Table} from '@mantine/core';
import BarkButton from "../../common/components/BarkButton.tsx";
function InventoryList() { function InventoryList() {
@@ -26,37 +27,45 @@ function InventoryList() {
return ( return (
<> <>
<div> <BarkHeader></BarkHeader>
<h1 className={"text-brand"}>Inventory</h1>
</div> <Flex
<p> mih={50}
ARFF ARFF BARK BARK gap="xl"
</p> justify="center"
<Link to="/"> align="center"
<Button>Home</Button> direction="row"
</Link> wrap="wrap"
>
<p>
ARFF ARFF BARK BARK
</p>
<BarkButton>Add Item</BarkButton>
</Flex>
<div>{isFetching ? 'Updating...' : ''}</div> <div>{isFetching ? 'Updating...' : ''}</div>
<table className="w-1/2"> <Table striped>
<thead> <Table.Thead>
<tr className="text-left"> <Table.Tr>
<th className="text-brand">ID</th> <Table.Th c="red">ID</Table.Th>
<th className="text-brand">Brand</th> <Table.Th c="red">Brand</Table.Th>
<th className="text-brand">Item</th> <Table.Th c="red">Item</Table.Th>
<th className="text-brand">Status</th> <Table.Th c="red">Status</Table.Th>
</tr> </Table.Tr>
</thead> </Table.Thead>
<tbody> <Table.Tbody>
{data.map((data) => ( {data.map((data) => (
<tr key={data.id}> <Table.Tr key={data.id}>
<td>{data.id}</td> <Table.Td>{data.id}</Table.Td>
<td>{data.brand}</td> <Table.Td>{data.brand}</Table.Td>
<td>{data.name}</td> <Table.Td>{data.name}</Table.Td>
<td>{data.status}</td> <Table.Td>{data.status}</Table.Td>
</tr> </Table.Tr>
))} ))}
</tbody> </Table.Tbody>
</table> </Table>
</> </>
) )
} }
-3
View File
@@ -1,3 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
+6 -11
View File
@@ -1,5 +1,5 @@
import {Link} from "react-router"; import {BarkHeader} from "../common/components/BarkHeader.tsx";
import Button from "../common/components/Button.tsx"; import {Text} from "@mantine/core";
function Home() { function Home() {
@@ -7,15 +7,10 @@ function Home() {
return ( return (
<> <>
<div> <BarkHeader></BarkHeader>
<h1 className={"text-brand"}>Home</h1>
</div> <Text c="red">ARFF ARFF BARK BARK</Text>
<p>
ARFF ARFF BARK BARK
</p>
<Link to="/inventory">
<Button>Inventory</Button>
</Link>
</> </>
) )
-13
View File
@@ -1,13 +0,0 @@
/** @type {import('tailwindcss').Config} */
export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {
colors: {
brand: "#D40404",
},
},
},
plugins: [],
}