Skip to content

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

feat: show Clear Trash button in Trash

thecodrr6b320aacdf72
diff --git a/apps/web/src/components/button/index.js b/apps/web/src/components/button/index.js
index b72821a4b..e610aa411 100644
--- a/apps/web/src/components/button/index.js
+++ b/apps/web/src/components/button/index.js
@@ -1,29 +1,37 @@
-import React from "react";
-import { Flex } from "rebass";
+import React, { useMemo } from "react";
+import { Flex, Text } from "rebass";
import { useTheme } from "emotion-theming";
+import useMobile from "../../utils/use-mobile";
+import useTablet from "../../utils/use-tablet";
//TODO use normal button
function Button(props) {
const theme = useTheme();
+ const isMobile = useMobile();
+ const isTablet = useTablet();
+ const boxShadow = useMemo(
+ () => `1px 1px 10px 0px ${theme.colors["primary"]}`,
+ [theme.colors]
+ );
return (
<Flex
data-test-id={props.testId}
bg="primary"
- py={3}
- px={3}
+ py={[3, 3, 2]}
+ px={[3, 3, 2]}
mx={2}
alignItems="center"
- display={["flex", "none", "none"]}
+ display={["flex", "flex", props.show ? "flex" : "none"]}
sx={{
- position: "absolute",
- bottom: 2,
- right: 2,
- borderRadius: 50,
+ position: ["absolute", "absolute", "relative"],
+ bottom: [2, 2, 0],
+ right: [2, 2, 0],
+ borderRadius: [50, 50, "default"],
marginBottom: 2,
color: "static",
fontFamily: "body",
fontWeight: "body",
- boxShadow: `1px 1px 10px 0px ${theme.colors["primary"]}`,
+ boxShadow: [boxShadow, boxShadow, "none"],
":hover": {
cursor: "pointer",
bg: theme.colors.primary + "dd",
@@ -31,10 +39,18 @@ function Button(props) {
}}
onClick={props.onClick}
>
- {props.Icon && <props.Icon color="static" />}
- {/* <Text as="span" mx={1} fontSize={"body"} flex="1 1 auto">
+ {props.Icon && (
+ <props.Icon color="static" size={isMobile || isTablet ? 24 : 20} />
+ )}
+ <Text
+ display={["none", "none", "flex"]}
+ as="span"
+ mx={1}
+ fontSize={"body"}
+ flex="1 1 auto"
+ >
{props.content}
- </Text> */}
+ </Text>
</Flex>
);
}
diff --git a/apps/web/src/components/list-container/index.js b/apps/web/src/components/list-container/index.js
index eeb916499..e22bacf7b 100644
--- a/apps/web/src/components/list-container/index.js
+++ b/apps/web/src/components/list-container/index.js
@@ -104,6 +104,7 @@ function ListContainer(props) {
Icon={props.button.icon || Icon.Plus}
content={props.button.content}
onClick={props.button.onClick}
+ show={props.button.show}
/>
)}
</Flex>
diff --git a/apps/web/src/views/trash.js b/apps/web/src/views/trash.js
index bbffb5960..20399c96c 100644
--- a/apps/web/src/views/trash.js
+++ b/apps/web/src/views/trash.js
@@ -18,6 +18,7 @@ function Trash() {
placeholder={TrashPlaceholder}
items={items}
button={{
+ show: true,
content: "Clear Trash",
icon: Icon.Trash,
onClick: function () {