diff --git a/apps/web/src/app.js b/apps/web/src/app.js index 0c7ac0a10..b8fd578c0 100644 --- a/apps/web/src/app.js +++ b/apps/web/src/app.js @@ -1,14 +1,13 @@ -import React, { useState, useEffect } from "react"; +import React, { useEffect } from "react"; import "./app.css"; import Editor from "./components/editor"; import { motion } from "framer-motion"; -import { Flex, Box, Button, Text } from "rebass"; +import { Flex, Box } from "rebass"; import ThemeProvider from "./components/theme-provider"; import RootNavigator, { bottomRoutes, routes } from "./navigation/navigators/rootnavigator"; -import "./app.css"; import { usePersistentState } from "./utils/hooks"; import { useStore } from "./stores/app-store"; import { useStore as useNotesStore } from "./stores/note-store"; @@ -18,63 +17,7 @@ import * as Icon from "./components/icons"; import { useStore as useAppStore } from "./stores/app-store"; import { useStore as useUserStore } from "./stores/user-store"; import Animated from "./components/animated"; - -function NavMenuItem(props) { - const [isLoading, setIsLoading] = useState(false); - const isSyncing = useUserStore(store => store.isSyncing); - useEffect(() => { - if (props.item.animatable) { - if (props.item.key === "sync") setIsLoading(isSyncing); - } - }, [isSyncing, setIsLoading, props.item]); - - return ( - - ); -} +import NavItem from "./components/navitem"; function App() { const [selectedKey, setSelectedKey] = usePersistentState( @@ -143,7 +86,7 @@ function App() { }} > {Object.values(routes).map((item, index) => ( - { if (selectedKey === item.key) { setShow(!show); @@ -164,7 +107,7 @@ function App() { ))} {colors.map(color => { return ( - { setSelectedKey(undefined); setSelectedContext({ @@ -193,7 +136,7 @@ function App() { {Object.values(bottomRoutes).map((item, index) => ( - { if (item.onClick) { await item.onClick(); diff --git a/apps/web/src/components/navitem/index.js b/apps/web/src/components/navitem/index.js new file mode 100644 index 000000000..1a306a24f --- /dev/null +++ b/apps/web/src/components/navitem/index.js @@ -0,0 +1,40 @@ +import React, { useState, useEffect } from "react"; +import { Flex, Button, Text } from "rebass"; +import { useStore as useUserStore } from "../../stores/user-store"; + +function NavItem(props) { + const { key, animatable, icon: Icon, color, title } = props.item; + const [isLoading, setIsLoading] = useState(false); + const isSyncing = useUserStore(store => store.isSyncing); + + useEffect(() => { + if (animatable) { + if (key === "sync") setIsLoading(isSyncing); + } + }, [isSyncing, setIsLoading, animatable, key]); + + return ( + + ); +} +export default NavItem; diff --git a/apps/web/src/theme/variants/button.js b/apps/web/src/theme/variants/button.js index ef1b04ef3..d3104963d 100644 --- a/apps/web/src/theme/variants/button.js +++ b/apps/web/src/theme/variants/button.js @@ -16,14 +16,13 @@ export default ButtonFactory; class Default { constructor() { return { + bg: "transparent", fontFamily: "body", fontWeight: "body", borderRadius: "default", + cursor: "pointer", ":focus": { outline: "none" - }, - ":hover": { - cursor: "pointer" } }; } @@ -72,7 +71,7 @@ class List { class Anchor { constructor() { return { - variant: "button.default", + variant: "buttons.default", color: "primary", fontSize: "subBody", p: 0, @@ -84,8 +83,8 @@ class Anchor { class Menu { constructor() { return { - variant: "button.default", - cursor: "pointer", + variant: "buttons.default", + borderRadius: "none", ":hover": { backgroundColor: "shade" }