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 properties show/hide animation (#91)
Ammar Ahmede6a5891b2e81
diff --git a/apps/web/package.json b/apps/web/package.jsonindex da9d9d04c..e1b939807 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -6,6 +6,7 @@"@rebass/forms": "^4.0.6","emotion-theming": "^10.0.19","events": "^3.0.0",+ "framer-motion": "^1.9.1","immer": "^5.3.6","localforage": "^1.7.3","notes-core": "npm:@streetwriters/notesnook-core@latest",diff --git a/apps/web/src/components/properties/index.js b/apps/web/src/components/properties/index.jsindex a9a7521f2..8b98b70e1 100644--- a/apps/web/src/components/properties/index.js+++ b/apps/web/src/components/properties/index.js@@ -8,7 +8,7 @@ import { useStore } from "../../stores/editor-store";import { COLORS } from "../../common";import { objectMap } from "../../utils/object";import { useStore as useAppStore } from "../../stores/app-store";-+import { motion } from "framer-motion";const Properties = props => {const pinned = useStore(store => store.session.pinned);const favorite = useStore(store => store.session.favorite);@@ -28,6 +28,7 @@ const Properties = props => {state.session[prop] = value;});}+return (!isFocusModeEnabled && (<>@@ -49,137 +50,160 @@ const Properties = props => {><Icon.ChevronLeft size={32} /></Box>- <Box- sx={{- position: arePropertiesVisible ? "absolute" : "relative",++ <motion.div+ animate={{ x: arePropertiesVisible ? 0 : 800 }}+ transition={{+ duration: 0.5,+ bounceDamping: 1,+ bounceStiffness: 1,+ ease: "easeOut"+ }}+ initial={false}+ style={{+ position: "absolute",right: 0,- display: arePropertiesVisible ? "flex" : "none",- borderLeft: "1px solid",- borderColor: "border",- width: [0, 0, "20%"]+ display: "flex",+ width: 280,+ height: "100%"}}- flexDirection="column"- bg="background"- px={3}- py={0}>- <Text- variant="title"- color="primary"- my={2}- alignItems="center"- justifyContent="space-between"- sx={{ display: "flex" }}+ <Box+ sx={{+ position: "absolute",+ right: 0,+ display: "flex",+ width: [0, 0, "100%"],+ height: "100%",+ boxShadow: "-1px 1px 10px 0px #888888"+ }}+ flexDirection="column"+ bg="background"+ px={3}+ py={0}>- Properties<Text- as="span"- onClick={() => hideProperties()}- sx={{- color: "red",- height: 24,- ":active": { color: "darkRed" }- }}+ variant="title"+ color="primary"+ my={2}+ alignItems="center"+ justifyContent="space-between"+ sx={{ display: "flex" }}>- <Icon.X />- </Text>- </Text>- <CheckBox- checked={pinned}- icon={PinIcon}- label="Pin"- onChecked={state => changeState("pinned", state)}- />- <CheckBox- icon={Icon.Star}- checked={favorite}- label="Favorite"- onChecked={state => changeState("favorite", state)}- />- <CheckBox icon={Icon.Lock} label="Lock" onChecked={props.onLocked} />- <Flex fontSize="body" sx={{ marginBottom: 3 }} alignItems="center">- <Icon.Book size={18} />- <Text sx={{ marginLeft: 1 }}>Move to notebook</Text>- </Flex>- <Flex fontSize="body" sx={{ marginBottom: 2 }} alignItems="center">- <Icon.Tag size={18} />- <Text sx={{ marginLeft: 1 }}>Tags:</Text>- </Flex>- <Input- variant="default"- placeholder="#tag"- sx={{ marginBottom: 2 }}- onKeyUp={event => {- if (- event.key === "Enter" ||- event.key === " " ||- event.key === ","- ) {- const value = event.target.value;- setTag(value.trim().replace(",", ""));- event.target.value = "";- }- }}- />- <Flex- fontSize="body"- sx={{ marginBottom: 2 }}- alignItems="center"- justifyContent="flex-start"- flexWrap="wrap"- >- {tags.map(tag => (+ Properties<Text+ as="span"+ onClick={() => hideProperties()}sx={{- backgroundColor: "primary",- color: "static",- borderRadius: "default",- padding: "2px 5px 2px 5px",- marginBottom: 1,- marginRight: 1,- cursor: "pointer"- }}- onClick={() => {- setTag(tag);+ color: "red",+ height: 24,+ ":active": { color: "darkRed" }}}>- #{tag}+ <Icon.X /></Text>- ))}- </Flex>- <Flex fontSize="body" sx={{ marginBottom: 2 }} alignItems="center">- <Icon.Octagon size={18} />- <Text sx={{ marginLeft: 1 }}>Colors:</Text>- </Flex>- <Flex flexWrap="wrap" sx={{ marginBottom: 2 }}>- {objectMap(COLORS, (label, code) => (- <Flex- sx={{ position: "relative" }}- justifyContent="center"- alignItems="center"- onClick={() => setColor(label)}- key={label}- >- <Icon.Circle- size={40}- style={{ cursor: "pointer" }}- fill={code}- strokeWidth={0}- />- {colors.includes(label) && (- <Icon.Check- style={{- position: "absolute",- cursor: "pointer",- color: "white"- }}- size={20}+ </Text>+ <CheckBox+ checked={pinned}+ icon={PinIcon}+ label="Pin"+ onChecked={state => changeState("pinned", state)}+ />+ <CheckBox+ icon={Icon.Star}+ checked={favorite}+ label="Favorite"+ onChecked={state => changeState("favorite", state)}+ />+ <CheckBox+ icon={Icon.Lock}+ label="Lock"+ onChecked={props.onLocked}+ />+ <Flex fontSize="body" sx={{ marginBottom: 3 }} alignItems="center">+ <Icon.Book size={18} />+ <Text sx={{ marginLeft: 1 }}>Move to notebook</Text>+ </Flex>+ <Flex fontSize="body" sx={{ marginBottom: 2 }} alignItems="center">+ <Icon.Tag size={18} />+ <Text sx={{ marginLeft: 1 }}>Tags:</Text>+ </Flex>+ <Input+ variant="default"+ placeholder="#tag"+ sx={{ marginBottom: 2 }}+ onKeyUp={event => {+ if (+ event.key === "Enter" ||+ event.key === " " ||+ event.key === ","+ ) {+ const value = event.target.value;+ setTag(value.trim().replace(",", ""));+ event.target.value = "";+ }+ }}+ />+ <Flex+ fontSize="body"+ sx={{ marginBottom: 2 }}+ alignItems="center"+ justifyContent="flex-start"+ flexWrap="wrap"+ >+ {tags.map(tag => (+ <Text+ sx={{+ backgroundColor: "primary",+ color: "static",+ borderRadius: "default",+ padding: "2px 5px 2px 5px",+ marginBottom: 1,+ marginRight: 1,+ cursor: "pointer"+ }}+ onClick={() => {+ setTag(tag);+ }}+ >+ #{tag}+ </Text>+ ))}+ </Flex>+ <Flex fontSize="body" sx={{ marginBottom: 2 }} alignItems="center">+ <Icon.Octagon size={18} />+ <Text sx={{ marginLeft: 1 }}>Colors:</Text>+ </Flex>+ <Flex flexWrap="wrap" sx={{ marginBottom: 2 }}>+ {objectMap(COLORS, (label, code) => (+ <Flex+ sx={{ position: "relative" }}+ justifyContent="center"+ alignItems="center"+ onClick={() => setColor(label)}+ key={label}+ >+ <Icon.Circle+ size={40}+ style={{ cursor: "pointer" }}+ fill={code}+ strokeWidth={0}/>- )}- </Flex>- ))}- </Flex>- </Box>+ {colors.includes(label) && (+ <Icon.Check+ style={{+ position: "absolute",+ cursor: "pointer",+ color: "white"+ }}+ size={20}+ />+ )}+ </Flex>+ ))}+ </Flex>+ </Box>+ </motion.div></>));diff --git a/apps/web/yarn.lock b/apps/web/yarn.lockindex 5c80ccf96..b426f80a8 100644--- a/apps/web/yarn.lock+++ b/apps/web/yarn.lock@@ -969,6 +969,13 @@dependencies:"@emotion/memoize" "0.7.4"+"@emotion/is-prop-valid@^0.8.2":+ version "0.8.7"+ resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.7.tgz#803449993f436f9a6c67752251ea3fc492a1044c"+ integrity sha512-OPkKzUeiid0vEKjZqnGcy2mzxjIlCffin+L2C02pdz/bVlt5zZZE2VzO0D3XOPnH0NEeF21QNKSXiZphjr4xiQ==+ dependencies:+ "@emotion/memoize" "0.7.4"+"@emotion/[email protected]", "@emotion/memoize@^0.7.1":version "0.7.4"resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.4.tgz#19bf0f5af19149111c40d98bb0cf82119f5d9eeb"@@ -1221,6 +1228,22 @@resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==+"@popmotion/easing@^1.0.1", "@popmotion/easing@^1.0.2":+ version "1.0.2"+ resolved "https://registry.yarnpkg.com/@popmotion/easing/-/easing-1.0.2.tgz#17d925c45b4bf44189e5a38038d149df42d8c0b4"+ integrity sha512-IkdW0TNmRnWTeWI7aGQIVDbKXPWHVEYdGgd5ZR4SH/Ty/61p63jCjrPxX1XrR7IGkl08bjhJROStD7j+RKgoIw==++"@popmotion/popcorn@^0.4.2", "@popmotion/popcorn@^0.4.4":+ version "0.4.4"+ resolved "https://registry.yarnpkg.com/@popmotion/popcorn/-/popcorn-0.4.4.tgz#a5f906fccdff84526e3fcb892712d7d8a98d6adc"+ integrity sha512-jYO/8319fKoNLMlY4ZJPiPu8Ea8occYwRZhxpaNn/kZsK4QG2E7XFlXZMJBsTWDw7I1i0uaqyC4zn1nwEezLzg==+ dependencies:+ "@popmotion/easing" "^1.0.1"+ framesync "^4.0.1"+ hey-listen "^1.0.8"+ style-value-types "^3.1.7"+ tslib "^1.10.0"+"@rebass/forms@^4.0.6":version "4.0.6"resolved "https://registry.yarnpkg.com/@rebass/forms/-/forms-4.0.6.tgz#19a3af64f855baa65dec65aecadda5cd95a09dd7"@@ -4481,6 +4504,30 @@ fragment-cache@^0.2.1:dependencies:map-cache "^0.2.2"+framer-motion@^1.9.1:+ version "1.9.1"+ resolved "https://registry.yarnpkg.com/framer-motion/-/framer-motion-1.9.1.tgz#dc7cd963eedc0dcf92b27d0ef7fc22be5227452a"+ integrity sha512-13vSUxdh8CP2pIQicOBF9RJaLlCj4mh0w6mSqbIoXtRatWMC7V9nKJvHauvaUEj9+xirT6hTML5YHn0DN3IGRg==+ dependencies:+ "@popmotion/easing" "^1.0.2"+ "@popmotion/popcorn" "^0.4.2"+ framesync "^4.0.4"+ hey-listen "^1.0.8"+ popmotion "9.0.0-beta-8"+ style-value-types "^3.1.6"+ stylefire "^7.0.2"+ tslib "^1.10.0"+ optionalDependencies:+ "@emotion/is-prop-valid" "^0.8.2"++framesync@^4.0.0, framesync@^4.0.1, framesync@^4.0.4:+ version "4.0.4"+ resolved "https://registry.yarnpkg.com/framesync/-/framesync-4.0.4.tgz#79c42c0118f26821c078570db0ff81fb863516a2"+ integrity sha512-mdP0WvVHe0/qA62KG2LFUAOiWLng5GLpscRlwzBxu2VXOp6B8hNs5C5XlFigsMgrfDrr2YbqTsgdWZTc4RXRMQ==+ dependencies:+ hey-listen "^1.0.8"+ tslib "^1.10.0"+version "0.5.2"resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"@@ -4809,6 +4856,11 @@ hex-color-regex@^1.1.0:resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==+hey-listen@^1.0.8:+ version "1.0.8"+ resolved "https://registry.yarnpkg.com/hey-listen/-/hey-listen-1.0.8.tgz#8e59561ff724908de1aa924ed6ecc84a56a9aa68"+ integrity sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==+hmac-drbg@^1.0.0:version "1.0.1"resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"@@ -7382,6 +7434,18 @@ [email protected]:dependencies:ts-pnp "^1.1.2"+ version "9.0.0-beta-8"+ resolved "https://registry.yarnpkg.com/popmotion/-/popmotion-9.0.0-beta-8.tgz#f5a709f11737734e84f2a6b73f9bcf25ee30c388"+ integrity sha512-6eQzqursPvnP7ePvdfPeY4wFHmS3OLzNP8rJRvmfFfEIfpFqrQgLsM50Gd9AOvGKJtYJOFknNG+dsnzCpgIdAA==+ dependencies:+ "@popmotion/easing" "^1.0.1"+ "@popmotion/popcorn" "^0.4.2"+ framesync "^4.0.4"+ hey-listen "^1.0.8"+ style-value-types "^3.1.6"+ tslib "^1.10.0"+portfinder@^1.0.9:version "1.0.25"resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.25.tgz#254fd337ffba869f4b9d37edc298059cb4d35eca"@@ -8275,18 +8339,7 @@ quill-markdown-shortcuts@^0.0.10:dependencies:quill "^1.3.1"-quill@^1.3.1:- version "1.3.7"- resolved "https://github.com/thecodrr/quill.git#a88a62366eeb52a3b4aa6c4f140426055d7b0bc9"- dependencies:- clone "^2.1.1"- deep-equal "^1.0.1"- eventemitter3 "^2.0.3"- extend "^3.0.2"- parchment "^1.1.4"- quill-delta "^3.6.2"--"quill@https://github.com/thecodrr/quill.git#1.3.7":+quill@^1.3.1, "quill@https://github.com/thecodrr/quill.git#1.3.7":version "1.3.7"resolved "https://github.com/thecodrr/quill.git#4ff9cee6f27efb2a7bad5aef50b6af140b4629fb"dependencies:@@ -9620,6 +9673,14 @@ [email protected]:loader-utils "^1.2.3"schema-utils "^2.0.1"+style-value-types@^3.1.6, style-value-types@^3.1.7:+ version "3.1.7"+ resolved "https://registry.yarnpkg.com/style-value-types/-/style-value-types-3.1.7.tgz#3d7d3cf9cb9f9ee86c00e19ba65d6a181a0db33a"+ integrity sha512-jPaG5HcAPs3vetSwOJozrBXxuHo9tjZVnbRyBjxqb00c2saIoeuBJc1/2MtvB8eRZy41u/BBDH0CpfzWixftKg==+ dependencies:+ hey-listen "^1.0.8"+ tslib "^1.10.0"+styled-system@^5.0.0, styled-system@^5.1.5:version "5.1.5"resolved "https://registry.yarnpkg.com/styled-system/-/styled-system-5.1.5.tgz#e362d73e1dbb5641a2fd749a6eba1263dc85075e"@@ -9639,6 +9700,17 @@ styled-system@^5.0.0, styled-system@^5.1.5:"@styled-system/variant" "^5.1.5"object-assign "^4.1.1"+stylefire@^7.0.2:+ version "7.0.2"+ resolved "https://registry.yarnpkg.com/stylefire/-/stylefire-7.0.2.tgz#874a82dd2bcada39c13e75e0c67b70009e06f556"+ integrity sha512-LFIBP6fIA+EMqLSvM4V6zLa+O/iAcHoNJVuXkkZ5G8+T+Pd3KaQLqgxrpkeo1bwWQHqzgab8U3V3gudO231fZA==+ dependencies:+ "@popmotion/popcorn" "^0.4.4"+ framesync "^4.0.0"+ hey-listen "^1.0.8"+ style-value-types "^3.1.7"+ tslib "^1.10.0"+stylehacks@^4.0.0:version "4.0.3"resolved "https://registry.yarnpkg.com/stylehacks/-/stylehacks-4.0.3.tgz#6718fcaf4d1e07d8a1318690881e8d96726a71d5"