mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-02 09:47:57 -05:00
prettier side nav
This commit is contained in:
parent
e5bdfeba8c
commit
d903fba097
|
|
@ -10,35 +10,14 @@
|
|||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Montserrat|Pacifico&display=swap"
|
||||
rel="stylesheet"
|
||||
<link
|
||||
rel="manifest"
|
||||
href="%PUBLIC_URL%/manifest.json"
|
||||
/>
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>sendou.ink</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import React, { useContext } from "react"
|
||||
import { PseudoBox, ListIcon, ListItem } from "@chakra-ui/core"
|
||||
import { Link } from "@reach/router"
|
||||
import { Link, useLocation } from "@reach/router"
|
||||
import { IconType } from "react-icons/lib/cjs"
|
||||
import MyThemeContext from "../../themeContext"
|
||||
|
||||
/*const hoverColor = { light: "gray.900", dark: "whiteAlpha.900" }
|
||||
const activeColor = { light: "orange.800", dark: "pink.100" }
|
||||
const activeBg = { light: "orange.50", dark: "#308c7a4d" }*/
|
||||
const hoverColor = { light: "gray.900", dark: "whiteAlpha.900" }
|
||||
|
||||
interface NavItemProps {
|
||||
to: string
|
||||
|
|
@ -15,7 +13,13 @@ interface NavItemProps {
|
|||
}
|
||||
|
||||
const NavItem: React.FC<NavItemProps> = ({ to, Icon, title }) => {
|
||||
const { themeColorWithShade } = useContext(MyThemeContext)
|
||||
const { themeColorWithShade, colorMode, themeColor } = useContext(
|
||||
MyThemeContext
|
||||
)
|
||||
|
||||
const location = useLocation()
|
||||
console.log("location", location)
|
||||
const isActive = ("/" + to).indexOf(location.pathname) !== -1
|
||||
|
||||
return (
|
||||
<ListItem>
|
||||
|
|
@ -30,6 +34,17 @@ const NavItem: React.FC<NavItemProps> = ({ to, Icon, title }) => {
|
|||
fontWeight="medium"
|
||||
outline="none"
|
||||
_focus={{ shadow: "outline" }}
|
||||
_hover={{
|
||||
color: hoverColor[colorMode],
|
||||
transform: "translateX(2px)",
|
||||
}}
|
||||
{...(isActive && {
|
||||
bg:
|
||||
colorMode === "light" ? `${themeColor}.100` : `${themeColor}.800`,
|
||||
rounded: "sm",
|
||||
//color: activeColor[colorMode],
|
||||
_hover: {},
|
||||
})}
|
||||
>
|
||||
<ListIcon icon={Icon} color={themeColorWithShade} size="1.5em" />{" "}
|
||||
{title}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,11 @@ import {
|
|||
import { ApolloProvider } from "@apollo/react-hooks"
|
||||
import { QueryParamProvider } from "use-query-params"
|
||||
import { HelmetProvider } from "react-helmet-async"
|
||||
import { globalHistory } from "@reach/router"
|
||||
import {
|
||||
LocationProvider,
|
||||
createMemorySource,
|
||||
createHistory,
|
||||
} from "@reach/router"
|
||||
import ApolloClient from "apollo-boost"
|
||||
import * as serviceWorker from "./serviceWorker"
|
||||
import customIcons from "./assets/icons"
|
||||
|
|
@ -24,19 +28,23 @@ const client = new ApolloClient({
|
|||
|
||||
const customTheme = { ...theme, icons: { ...theme.icons, ...customIcons } }
|
||||
|
||||
let history = createHistory(window as any)
|
||||
|
||||
ReactDOM.render(
|
||||
<QueryParamProvider reachHistory={globalHistory}>
|
||||
<HelmetProvider>
|
||||
<ApolloProvider client={client}>
|
||||
<ThemeProvider theme={customTheme}>
|
||||
<ColorModeProvider>
|
||||
<CSSReset />
|
||||
<App />
|
||||
</ColorModeProvider>
|
||||
</ThemeProvider>
|
||||
</ApolloProvider>
|
||||
</HelmetProvider>
|
||||
</QueryParamProvider>,
|
||||
<LocationProvider history={history}>
|
||||
<QueryParamProvider reachHistory={history}>
|
||||
<HelmetProvider>
|
||||
<ApolloProvider client={client}>
|
||||
<ThemeProvider theme={customTheme}>
|
||||
<ColorModeProvider>
|
||||
<CSSReset />
|
||||
<App />
|
||||
</ColorModeProvider>
|
||||
</ThemeProvider>
|
||||
</ApolloProvider>
|
||||
</HelmetProvider>
|
||||
</QueryParamProvider>
|
||||
</LocationProvider>,
|
||||
document.getElementById("root")
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user