Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: completely replace react-feather

thecodrra8ff14c3688f
diff --git a/apps/web/package.json b/apps/web/package.json
index f678f6724..6571b2e67 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -18,7 +18,6 @@
"react": "^16.11.0",
"react-app-polyfill": "^1.0.6",
"react-dom": "^16.11.0",
- "react-feather": "^2.0.3",
"react-modal": "^3.11.1",
"react-scripts": "3.2.0",
"react-simple-dropdown": "^3.2.3",
diff --git a/apps/web/src/common/selectionoptions.js b/apps/web/src/common/selectionoptions.js
index b17f5c8d2..1bb9b79a0 100644
--- a/apps/web/src/common/selectionoptions.js
+++ b/apps/web/src/common/selectionoptions.js
@@ -1,4 +1,4 @@
-import * as Icon from "react-feather";
+import * as Icon from "../components/icons";
import { store as appStore } from "../stores/app-store";
import { store as notesStore } from "../stores/note-store";
import { store as nbStore } from "../stores/notebook-store";
@@ -6,7 +6,6 @@ import { store as editorStore } from "../stores/editor-store";
import { db } from "./index";
import { showMoveNoteDialog } from "../components/dialogs/movenotedialog";
import { confirm } from "../components/dialogs/confirm";
-import { showPasswordDialog } from "../components/dialogs/passworddialog";
function createOption(icon, onClick) {
return {
@@ -22,9 +21,9 @@ function createOptions(options = []) {
return [...options, DeleteOption];
}
-const DeleteOption = createOption(Icon.Trash2, async function(state) {
+const DeleteOption = createOption(Icon.Trash, async function(state) {
if (
- !(await confirm(Icon.Trash2, "Delete", "Are you sure you want to proceed?"))
+ !(await confirm(Icon.Trash, "Delete", "Are you sure you want to proceed?"))
)
return;
const item = state.selectedItems[0];
@@ -79,7 +78,7 @@ const AddToNotebookOption = createOption(Icon.Plus, async function(state) {
}
});
-const RestoreOption = createOption(Icon.RefreshCcw, async function(state) {
+const RestoreOption = createOption(Icon.Restore, async function(state) {
const items = state.selectedItems.map(item => item.id);
await db.trash.restore(items);
});
diff --git a/apps/web/src/components/dialogs/signupdialog.js b/apps/web/src/components/dialogs/signupdialog.js
index 5fb50c60f..e4e703702 100644
--- a/apps/web/src/components/dialogs/signupdialog.js
+++ b/apps/web/src/components/dialogs/signupdialog.js
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { Flex, Box, Text } from "rebass";
import { Input } from "@rebass/forms";
-import * as Icon from "react-feather";
+import * as Icon from "../icons";
import Dialog, { showDialog } from "./dialog";
import { db } from "../../common";
@@ -15,7 +15,7 @@ const SignUpDialog = props => {
<Dialog
isOpen={true}
title={"Sign Up"}
- icon={Icon.LogIn}
+ icon={Icon.User}
onCloseClick={props.onClose}
negativeButton={{ onClick: props.onClose }}
positiveButton={{
diff --git a/apps/web/src/components/dialogs/topicdialog.js b/apps/web/src/components/dialogs/topicdialog.js
index 06f3d3c0a..541f5884d 100644
--- a/apps/web/src/components/dialogs/topicdialog.js
+++ b/apps/web/src/components/dialogs/topicdialog.js
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import { Box } from "rebass";
import { Input } from "@rebass/forms";
+import * as Icon from "../icons";
import { db } from "../../common";
import Dialog, { showDialog } from "./dialog";
import { store } from "../../stores/notebook-store";
@@ -32,11 +33,11 @@ const TopicDialog = props => {
);
};
-export const showTopicDialog = (icon, title, notebook) => {
+export const showTopicDialog = notebook => {
return showDialog(perform => (
<TopicDialog
- title={title}
- icon={icon}
+ title={"Topic"}
+ icon={Icon.Topic}
onNo={() => {
perform(false);
}}
diff --git a/apps/web/src/components/editor/titlebox.js b/apps/web/src/components/editor/titlebox.js
index b58f032b3..7229d161a 100644
--- a/apps/web/src/components/editor/titlebox.js
+++ b/apps/web/src/components/editor/titlebox.js
@@ -2,33 +2,18 @@ import React from "react";
import "./editor.css";
import { Input } from "@rebass/forms";
import { Flex } from "rebass";
-import * as Icon from "react-feather";
+import * as Icon from "../icons";
import { store as appStore } from "../../stores/app-store";
export default class TitleBox extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- iconType: Icon.PlusCircle
- };
- //this.ChangeIcon.bind(this);
- }
-
- ChangeIcon() {
- this.setState({
- iconType:
- this.state.iconType === Icon.PlusCircle
- ? Icon.MinusCircle
- : Icon.PlusCircle
- });
- }
+ state = { isFocusMode: false };
inputRef;
shouldComponentUpdate(nextProps, nextState) {
return (
nextProps.title !== this.props.title ||
nextProps.shouldFocus ||
- nextState.iconType !== this.state.iconType
+ nextState.isFocusMode !== this.state.isFocusMode
);
}
@@ -65,15 +50,21 @@ export default class TitleBox extends React.Component {
alignItems="center"
pr={3}
onClick={() => {
- if (this.state.iconType === Icon.PlusCircle) {
- appStore.getState().enableFocusMode();
+ const { enableFocusMode, disableFocusMode } = appStore.getState();
+ if (!this.state.isFocusMode) {
+ enableFocusMode();
+ this.setState({ isFocusMode: true });
} else {
- appStore.getState().disableFocusMode();
+ disableFocusMode();
+ this.setState({ isFocusMode: false });
}
- this.ChangeIcon();
}}
>
- <this.state.iconType size="30px"></this.state.iconType>
+ {this.state.isFocusMode ? (
+ <Icon.NormalMode size={30} />
+ ) : (
+ <Icon.FocusMode size={30} />
+ )}
</Flex>
</Flex>
);
diff --git a/apps/web/src/components/icons/index.js b/apps/web/src/components/icons/index.js
index 8eaf208df..4e8fd7df4 100644
--- a/apps/web/src/components/icons/index.js
+++ b/apps/web/src/components/icons/index.js
@@ -48,8 +48,11 @@ export const Trash = createIcon(Icons.mdiTrashCanOutline);
export const Search = createIcon(Icons.mdiMagnify);
export const Menu = createIcon(Icons.mdiHamburger);
export const Login = createIcon(Icons.mdiLogin);
+export const FocusMode = createIcon(Icons.mdiFullscreen);
+export const NormalMode = createIcon(Icons.mdiFullscreenExit);
export const Settings = createIcon(Icons.mdiCogOutline);
export const Home = createIcon(Icons.mdiHomeOutline);
+export const Restore = createIcon(Icons.mdiRecycle);
/** Properties Icons */
export const ChevronLeft = createIcon(Icons.mdiChevronLeft);
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index 9ee87f551..b0f08af61 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -2,7 +2,7 @@ import React, { useEffect } from "react";
import { Flex } from "rebass";
import Button from "../button";
import Search from "../search";
-import * as Icon from "react-feather";
+import * as Icon from "../icons";
import { Virtuoso as List } from "react-virtuoso";
import { useStore as useSearchStore } from "../../stores/searchstore";
import { useStore as useAppStore } from "../../stores/app-store";
diff --git a/apps/web/src/components/topic/index.js b/apps/web/src/components/topic/index.js
index 63b39a571..e36349ef6 100644
--- a/apps/web/src/components/topic/index.js
+++ b/apps/web/src/components/topic/index.js
@@ -1,14 +1,10 @@
import React from "react";
-import * as Icon from "react-feather";
import ListItem from "../list-item";
const dropdownRefs = [];
const menuItems = [
- { title: "Favorite", icon: Icon.Heart },
- { title: "Share", icon: Icon.Share2 },
{
title: "Delete",
- icon: Icon.Trash,
color: "red"
}
];
diff --git a/apps/web/src/navigation/routes.js b/apps/web/src/navigation/routes.js
index 344476fd5..9e87b8c16 100644
--- a/apps/web/src/navigation/routes.js
+++ b/apps/web/src/navigation/routes.js
@@ -1,5 +1,3 @@
-import * as Icon from "react-feather";
-
export function createRoute(key, component, props = {}, params = {}) {
return {
[key]: {
@@ -11,16 +9,6 @@ export function createRoute(key, component, props = {}, params = {}) {
};
}
-export function createColorRoute(key, component, color, props = {}) {
- return createRoute(key, component, {
- title: key,
- titleColor: color,
- icon: Icon.Circle,
- color,
- ...props
- });
-}
-
export function createNormalRoute(key, component, icon, props = {}) {
return createRoute(key, component, { title: component.name, icon, ...props });
}
diff --git a/apps/web/src/views/Topics.js b/apps/web/src/views/Topics.js
index dbda9365d..36ebca9d6 100644
--- a/apps/web/src/views/Topics.js
+++ b/apps/web/src/views/Topics.js
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import Topic from "../components/topic";
import { Flex } from "rebass";
import ListContainer from "../components/list-container";
-import * as Icon from "react-feather";
+import * as Icon from "../components/icons";
import { useStore as useNoteStore } from "../stores/note-store";
import { useStore as useNbStore } from "../stores/notebook-store";
import { showTopicDialog } from "../components/dialogs/topicdialog";
@@ -51,7 +51,7 @@ const Topics = props => {
button={{
content: "Add more topics",
onClick: async () => {
- await showTopicDialog(Icon.Book, "Topic", props.notebook.id);
+ await showTopicDialog(props.notebook.id);
}
}}
/>
diff --git a/apps/web/src/views/Trash.js b/apps/web/src/views/Trash.js
index 00b00ed37..592c18c9c 100644
--- a/apps/web/src/views/Trash.js
+++ b/apps/web/src/views/Trash.js
@@ -1,5 +1,5 @@
import React, { useEffect } from "react";
-import * as Icon from "react-feather";
+import * as Icon from "../components/icons";
import { Flex, Text } from "rebass";
import ListItem from "../components/list-item";
import TimeAgo from "timeago-react";
@@ -19,7 +19,7 @@ const menuItems = (item, index) => [
color: "red",
onClick: () => {
confirm(
- Icon.Trash2,
+ Icon.Trash,
"Delete",
`Are you sure you want to permanently delete this item?`
).then(async res => {
@@ -62,10 +62,10 @@ function Trash() {
)}
button={{
content: "Clear Trash",
- icon: Icon.Trash2,
+ icon: Icon.Trash,
onClick: function() {
confirm(
- Icon.Trash2,
+ Icon.Trash,
"Clear",
`This action is irreversible. Are you sure you want to proceed?s`
).then(async res => {
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index bcb41df75..71b3d7573 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -8461,13 +8461,6 @@ react-error-overlay@^6.0.3:
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.6.tgz#ac4d9dc4c1b5c536c2c312bf66aa2b09bfa384e2"
integrity sha512-Yzpno3enVzSrSCnnljmr4b/2KUQSMZaPuqmS26t9k4nW7uwJk6STWmH9heNjPuvqUTO3jOSPkHoKgO4+Dw7uIw==
-react-feather@^2.0.3:
- version "2.0.3"
- resolved "https://registry.yarnpkg.com/react-feather/-/react-feather-2.0.3.tgz#1453ff5d8c242f72b8c02846118fbd2d406375ad"
- integrity sha512-XVjtxIyMxb2RFlqC2APoB/IZvXKDW9uLN1c264XEeZNYe8jIxjQVQpeTo3nxtHiLTgMfgf0ZYxJC6HwmY8+9BA==
- dependencies:
- prop-types "^15.7.2"
-
react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4:
version "16.12.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c"