Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migrate ui to mantine #93

Merged
merged 15 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ that you can visit in your browser.
- React.js
- TypeScript
- Redux / Redux Toolkit
- Tailwind CSS
- Evergreen UI
- Mantine UI / @emotion/react
- Framer Motion
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/evan-buss/openbooks

go 1.18
go 1.19

require (
github.com/brianvoe/gofakeit/v5 v5.11.2
Expand Down
4,913 changes: 1,927 additions & 2,986 deletions server/app/package-lock.json

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions server/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,30 @@
"prettier": "prettier --write 'src/**/*.{ts,tsx,js,vue}'"
},
"dependencies": {
"@reduxjs/toolkit": "^1.8.3",
"clsx": "^1.2.1",
"evergreen-ui": "^6.10.3",
"framer-motion": "^7.0.0",
"@emotion/react": "^11.10.0",
"@mantine/core": "^5.2.4",
"@mantine/hooks": "^5.2.4",
"@mantine/notifications": "^5.2.4",
"@reduxjs/toolkit": "^1.8.5",
"@tanstack/react-table": "^8.5.11",
"@tanstack/react-virtual": "^3.0.0-alpha.0",
"framer-motion": "^7.2.1",
"lodash": "^4.17.21",
"npm": "^8.16.0",
"npm": "^8.18.0",
"phosphor-react": "^1.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.2",
"react-use": "^17.4.0"
"react-router-dom": "^6.3.0"
},
"devDependencies": {
"@types/lodash": "^4.14.182",
"@types/node": "^18.6.5",
"@types/lodash": "^4.14.184",
"@types/node": "^18.7.13",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@vitejs/plugin-react-refresh": "^1.3.6",
"autoprefixer": "^10.4.8",
"postcss": "^8.4.16",
"@vitejs/plugin-react": "^2.0.1",
"prettier": "2.7.1",
"tailwindcss": "^3.1.8",
"typescript": "^4.7.4",
"vite": "^3.0.5"
"typescript": "^4.8.2",
"vite": "^3.0.9"
}
}
6 changes: 0 additions & 6 deletions server/app/postcss.config.js

This file was deleted.

115 changes: 106 additions & 9 deletions server/app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,111 @@
import React from "react";
import Sidebar from "./components/SideBar/Sidebar";
import {
AppShell,
Burger,
ColorScheme,
ColorSchemeProvider,
createEmotionCache,
createStyles,
MantineProvider,
MediaQuery
} from "@mantine/core";
import { useLocalStorage } from "@mantine/hooks";
import { NotificationsProvider } from "@mantine/notifications";
import { Route, Routes } from "react-router-dom";
import NotificationDrawer from "./components/drawer/NotificationDrawer";
import Sidebar from "./components/sidebar/Sidebar";
import SearchPage from "./pages/SearchPage";
import { toggleSidebar } from "./state/stateSlice";
import { useAppDispatch, useAppSelector } from "./state/store";

const emotionCache = createEmotionCache({ key: "openbooks" });

const useStyles = createStyles(() => ({
burger: {
position: "absolute",
bottom: 0,
left: 0
},
wrapper: {
boxSizing: "border-box",
display: "flex",
flexWrap: "nowrap",
maxHeight: "100vh",
minHeight: "100vh"
}
}));

export default function App() {
const { classes } = useStyles();
const [colorScheme, setColorScheme] = useLocalStorage({
key: "color-scheme",
defaultValue: "light" as ColorScheme,
getInitialValueInEffect: true
});

const dispatch = useAppDispatch();
const open = useAppSelector((state) => state.state.isSidebarOpen);

function App() {
return (
<div className="flex flex-row max-h-screen min-h-screen flex-nowrap bg-tint1">
<Sidebar />
<SearchPage />
</div>
<ColorSchemeProvider
colorScheme={colorScheme}
toggleColorScheme={() =>
setColorScheme((color) => (color === "dark" ? "light" : "dark"))
}>
<MantineProvider
emotionCache={emotionCache}
withGlobalStyles
withNormalizeCSS
theme={{
colorScheme,
activeStyles: { transform: "none" },
primaryColor: "brand",
primaryShade: { light: 4, dark: 2 },
colors: {
brand: [
"#e0ecff",
"#b0c6ff",
"#7e9fff",
"#4c79ff",
// "#1a53ff",
"#3366ff",
"#0039e6",
"#002db4",
"#002082",
"#001351",
"#000621"
]
}
}}>
<NotificationsProvider position="top-center">
<AppShell
navbar={<Sidebar />}
padding={0}
styles={(theme) => ({
main: {
backgroundColor:
theme.colorScheme === "dark"
? theme.colors.dark[8]
: theme.colors.gray[0]
}
})}>
<div className={classes.wrapper}>
<MediaQuery largerThan="sm" styles={{ display: "none" }}>
<Burger
className={classes.burger}
opened={open}
onClick={() => dispatch(toggleSidebar())}
size="sm"
mr="xl"
/>
</MediaQuery>
<Routes>
<Route path="/" element={<SearchPage />} />
</Routes>
<NotificationDrawer />
</div>
</AppShell>
</NotificationsProvider>
</MantineProvider>
</ColorSchemeProvider>
);
}

export default App;
2 changes: 1 addition & 1 deletion server/app/src/assets/reading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
206 changes: 0 additions & 206 deletions server/app/src/components/BooksGrid/BooksGrid.tsx

This file was deleted.

Loading