A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
ui: add dropdown menu to notes
thecodrr4dbb741d8084
diff --git a/apps/web/package.json b/apps/web/package.jsonindex 64ffc3533..54db87b75 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -15,6 +15,7 @@"react-feather": "^2.0.3","react-quill": "^1.3.3","react-scripts": "3.2.0",+ "react-simple-dropdown": "^3.2.3","rebass": "^4.0.7"},"devDependencies": {diff --git a/apps/web/src/app.css b/apps/web/src/app.cssindex afc388571..85f263205 100644--- a/apps/web/src/app.css+++ b/apps/web/src/app.css@@ -1,22 +1,9 @@-.App {- text-align: center;-}--.App-logo {- height: 40vmin;-}--.App-header {- background-color: #282c34;- min-height: 100vh;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- font-size: calc(10px + 2vmin);- color: white;-}--.App-link {- color: #09d3ac;+.unselectable {+ -webkit-touch-callout: none;+ -webkit-user-select: none;+ -khtml-user-select: none;+ -moz-user-select: none;+ -ms-user-select: none;+ user-select: none;+ cursor: default;}diff --git a/apps/web/src/theme.js b/apps/web/src/theme.jsindex 875822777..f1d9dac77 100644--- a/apps/web/src/theme.js+++ b/apps/web/src/theme.js@@ -8,14 +8,16 @@ export default {transparent: "#00000000",//font relatedfontPrimary: "black",- fontSecondary: "white"+ fontSecondary: "white",+ border: "#f0f0f0"},space: [0, 5, 10, 12],fontSizes: {heading: 42,input: 16,title: 18,- body: 14+ body: 14,+ menu: 14},fontWeights: {body: 500,diff --git a/apps/web/src/views/Home.js b/apps/web/src/views/Home.jsindex 4cf9f3095..2e25faa33 100644--- a/apps/web/src/views/Home.js+++ b/apps/web/src/views/Home.js@@ -3,6 +3,57 @@ import { Flex, Box, Text, Heading } from "rebass";import * as Icon from "react-feather";import { SHADOW } from "../theme";import { Input } from "@rebass/forms";+import Dropdown, {+ DropdownTrigger,+ DropdownContent+} from "react-simple-dropdown";+import "react-simple-dropdown/styles/Dropdown.css";++const menuItems = [+ { title: "Favorite", icon: Icon.Heart },+ { title: "Share", icon: Icon.Share2 },+ { title: "Delete", icon: Icon.Trash, color: "red" }+];+let notesMenu = undefined;+function NoteMenu() {+ return (+ <Flex+ bg="primary"+ py={1}+ sx={{ borderRadius: "default", boxShadow: SHADOW }}+ >+ <Box>+ {menuItems.map(v => (+ <Flex+ onClick={() => notesMenu.hide()}+ flexDirection="row"+ alignItems="center"+ py={2.5} //TODO use theme space here instead of custom padding+ px={2}+ sx={{+ color: v.color || "fontPrimary",+ ":hover": {+ backgroundColor: "accent",+ color: "fontSecondary"+ }+ }}+ >+ <v.icon size={15} strokeWidth={1.5} />+ <Text+ className="unselectable"+ as="span"+ mx={1}+ fontFamily="body"+ fontSize="menu"+ >+ {v.title}+ </Text>+ </Flex>+ ))}+ </Box>+ </Flex>+ );+}function Home() {return (@@ -27,11 +78,18 @@ function Home() {<Text fontFamily="body" fontSize="title" fontWeight="bold">This is a note title</Text>- <Icon.MoreVertical- size={20}- strokeWidth={1.5}- style={{ marginRight: -5 }}- />+ <Dropdown ref={ref => (notesMenu = ref)}>+ <DropdownTrigger>+ <Icon.MoreVertical+ size={20}+ strokeWidth={1.5}+ style={{ marginRight: -5 }}+ />+ </DropdownTrigger>+ <DropdownContent style={{ zIndex: 999 }}>+ <NoteMenu />+ </DropdownContent>+ </Dropdown></Flex><Text fontFamily="body" fontSize="body" sx={{ marginTop: 1 }}>You are born to be the greatest there ever was. Embrace your truediff --git a/apps/web/yarn.lock b/apps/web/yarn.lockindex 6a365bb69..35610976b 100644--- a/apps/web/yarn.lock+++ b/apps/web/yarn.lock@@ -2767,6 +2767,11 @@ class-utils@^0.3.5:isobject "^3.0.0"static-extend "^0.1.1"+classnames@^2.1.2:+ version "2.2.6"+ resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"+ integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==+version "4.2.1"resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17"@@ -8372,7 +8377,7 @@ prompts@^2.0.1:kleur "^3.0.3"sisteransi "^1.0.3"-prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2:+prop-types@^15.5.10, prop-types@^15.5.8, prop-types@^15.6.2, prop-types@^15.7.2:version "15.7.2"resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==@@ -8737,6 +8742,14 @@ [email protected]:optionalDependencies:fsevents "2.0.7"+react-simple-dropdown@^3.2.3:+ version "3.2.3"+ resolved "https://registry.yarnpkg.com/react-simple-dropdown/-/react-simple-dropdown-3.2.3.tgz#c9737bcb7a54c7de267a1afeeec04de588a3fa7b"+ integrity sha512-NmyyvA0D4wph5ctzkn8U4wmblOacavJMl9gTOhQR3v8I997mc1FL1NFKkj3Mx+HNysBKRD/HI+kpxXCAgXumPw==+ dependencies:+ classnames "^2.1.2"+ prop-types "^15.5.8"+react@^16.11.0:version "16.12.0"resolved "https://registry.yarnpkg.com/react/-/react-16.12.0.tgz#0c0a9c6a142429e3614834d5a778e18aa78a0b83"