Skip to content

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

feat: use all values from theme

thecodrradd442172522
diff --git a/packages/editor/dist/extensions/attachment/component.js b/packages/editor/dist/extensions/attachment/component.js
index d68b48210..78b15a743 100644
--- a/packages/editor/dist/extensions/attachment/component.js
+++ b/packages/editor/dist/extensions/attachment/component.js
@@ -36,7 +36,7 @@ export function AttachmentComponent(props) {
userSelect: "none",
alignItems: "center",
backgroundColor: "bgSecondary",
- padding: "0px 5px 0px 5px",
+ px: 1,
borderRadius: "default",
border: "1px solid var(--border)",
cursor: "pointer",
@@ -46,14 +46,14 @@ export function AttachmentComponent(props) {
bg: "hover",
},
}, title: filename }, { children: [_jsx(Icon, { path: Icons.attachment, size: 14 }), _jsx(Text, __assign({ as: "span", sx: {
- ml: "3px",
+ ml: "small",
fontSize: "0.85rem",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
overflow: "hidden",
}, className: "filename" }, { children: filename })), _jsx(Text, __assign({ as: "span", className: "size", sx: {
- ml: "7px",
- fontSize: "0.7rem",
+ ml: 1,
+ fontSize: "subBody",
color: "fontTertiary",
flexShrink: 0,
} }, { children: formatBytes(size) }))] })), _jsx(MenuPresenter, __assign({ isOpen: isActive, onClose: function () { }, items: [], options: {
@@ -92,5 +92,5 @@ function AttachmentToolbar(props) {
flexWrap: "nowrap",
borderRadius: "default",
mb: 2,
- } }, { children: [_jsx(ToolButton, { toggled: false, title: "Download", id: "download", icon: "download", onClick: function () { }, iconSize: 16, sx: { mr: 1, p: "3px", borderRadius: "small" } }), _jsx(ToolButton, { toggled: false, title: "delete", id: "delete", icon: "delete", onClick: function () { }, iconSize: 16, sx: { mr: 0, p: "3px", borderRadius: "small" } })] })) })));
+ } }, { children: [_jsx(ToolButton, { toggled: false, title: "Download", id: "download", icon: "download", onClick: function () { }, variant: "small", sx: { mr: 1 } }), _jsx(ToolButton, { toggled: false, title: "delete", id: "delete", icon: "delete", onClick: function () { }, variant: "small", sx: { mr: 0 } })] })) })));
}
diff --git a/packages/editor/dist/toolbar/components/dropdown.js b/packages/editor/dist/toolbar/components/dropdown.js
index 0e1bc9564..ffc78e618 100644
--- a/packages/editor/dist/toolbar/components/dropdown.js
+++ b/packages/editor/dist/toolbar/components/dropdown.js
@@ -52,7 +52,7 @@ export function Dropdown(props) {
":last-of-type": {
mr: 0,
},
- }, onClick: function () { return setIsOpen(function (s) { return !s; }); }, onMouseDown: function (e) { return e.preventDefault(); } }, { children: [typeof selectedItem === "string" ? (_jsx(Text, __assign({ sx: { fontSize: 12, mr: 1, color: "text" } }, { children: selectedItem }))) : (selectedItem), _jsx(Icon, { path: toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown, size: 14, color: "text" })] })), _jsx(MenuPresenter, { options: {
+ }, onClick: function () { return setIsOpen(function (s) { return !s; }); }, onMouseDown: function (e) { return e.preventDefault(); } }, { children: [typeof selectedItem === "string" ? (_jsx(Text, __assign({ sx: { fontSize: "subBody", mr: 1, color: "text" } }, { children: selectedItem }))) : (selectedItem), _jsx(Icon, { path: toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown, size: "small", color: "text" })] })), _jsx(MenuPresenter, { options: {
type: "menu",
position: {
target: internalRef.current || undefined,
diff --git a/packages/editor/dist/toolbar/components/icon.d.ts b/packages/editor/dist/toolbar/components/icon.d.ts
index 1c7258431..2cf292b4a 100644
--- a/packages/editor/dist/toolbar/components/icon.d.ts
+++ b/packages/editor/dist/toolbar/components/icon.d.ts
@@ -1,10 +1,11 @@
/// <reference types="react" />
+import { Theme } from "@notesnook/theme";
import { SchemeColors } from "@notesnook/theme/dist/theme/colorscheme";
import { FlexProps } from "rebass";
declare type IconProps = {
title?: string;
path: string;
- size?: number;
+ size?: keyof Theme["iconSizes"] | number;
color?: keyof SchemeColors;
stroke?: string;
rotate?: boolean;
diff --git a/packages/editor/dist/toolbar/components/icon.js b/packages/editor/dist/toolbar/components/icon.js
index f51d1ea20..866db2346 100644
--- a/packages/editor/dist/toolbar/components/icon.js
+++ b/packages/editor/dist/toolbar/components/icon.js
@@ -30,7 +30,7 @@ function MDIIconWrapper(_a) {
var themedColor = theme.colors
? theme.colors[color]
: color;
- return (_jsx(MDIIcon, { className: "icon", title: title, path: path, size: size + "px", style: {
+ return (_jsx(MDIIcon, { className: "icon", title: title, path: path, size: typeof size === "string" ? "".concat(theme.iconSizes[size], "px") : "".concat(size, "px"), style: {
strokeWidth: stroke || "0px",
stroke: themedColor,
}, color: themedColor, spin: rotate }));
diff --git a/packages/editor/dist/toolbar/components/splitbutton.js b/packages/editor/dist/toolbar/components/splitbutton.js
index a86e0d92e..bd77a56b5 100644
--- a/packages/editor/dist/toolbar/components/splitbutton.js
+++ b/packages/editor/dist/toolbar/components/splitbutton.js
@@ -61,7 +61,7 @@ export function SplitButton(props) {
":last-of-type": {
mr: 0,
},
- }, onClick: function () { return setIsOpen(function (s) { return !s; }); }, onMouseDown: function (e) { return e.preventDefault(); } }, { children: _jsx(Icon, { path: toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown, color: "text", size: 14 }) }))] })), _jsx(MenuPresenter, __assign({ isOpen: isOpen, onClose: function () { return setIsOpen(false); }, options: {
+ }, onClick: function () { return setIsOpen(function (s) { return !s; }); }, onMouseDown: function (e) { return e.preventDefault(); } }, { children: _jsx(Icon, { path: toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown, color: "text", size: "small" }) }))] })), _jsx(MenuPresenter, __assign({ isOpen: isOpen, onClose: function () { return setIsOpen(false); }, options: {
type: "menu",
position: {
target: ref.current || undefined,
diff --git a/packages/editor/dist/toolbar/components/toolbutton.js b/packages/editor/dist/toolbar/components/toolbutton.js
index ab2672bb7..7454167c0 100644
--- a/packages/editor/dist/toolbar/components/toolbutton.js
+++ b/packages/editor/dist/toolbar/components/toolbutton.js
@@ -26,7 +26,7 @@ import { Icons } from "../icons";
import { Icon } from "./icon";
export function ToolButton(props) {
var id = props.id, icon = props.icon, iconSize = props.iconSize, iconColor = props.iconColor, toggled = props.toggled, sx = props.sx, buttonRef = props.buttonRef, _a = props.variant, variant = _a === void 0 ? "normal" : _a, buttonProps = __rest(props, ["id", "icon", "iconSize", "iconColor", "toggled", "sx", "buttonRef", "variant"]);
- return (_jsx(Button, __assign({ ref: buttonRef, tabIndex: -1, id: "tool-".concat(id), sx: __assign({ p: variant === "small" ? "3px" : 1, borderRadius: variant === "small" ? "small" : "default", m: 0, bg: toggled ? "hover" : "transparent", mr: variant === "small" ? 0 : 1, ":hover": { bg: "hover" }, ":last-of-type": {
+ return (_jsx(Button, __assign({ ref: buttonRef, tabIndex: -1, id: "tool-".concat(id), sx: __assign({ p: variant === "small" ? "small" : 1, borderRadius: variant === "small" ? "small" : "default", m: 0, bg: toggled ? "hover" : "transparent", mr: variant === "small" ? 0 : 1, ":hover": { bg: "hover" }, ":last-of-type": {
mr: 0,
- } }, sx), onMouseDown: function (e) { return e.preventDefault(); } }, buttonProps, { children: _jsx(Icon, { path: Icons[icon], color: iconColor || "text", size: iconSize || variant === "small" ? 16 : 18 }) })));
+ } }, sx), onMouseDown: function (e) { return e.preventDefault(); } }, buttonProps, { children: _jsx(Icon, { path: Icons[icon], color: iconColor || "icon", size: iconSize || variant === "small" ? "medium" : "big" }) })));
}
diff --git a/packages/editor/dist/toolbar/popups/cellproperties.js b/packages/editor/dist/toolbar/popups/cellproperties.js
index ee117455f..5debd0e59 100644
--- a/packages/editor/dist/toolbar/popups/cellproperties.js
+++ b/packages/editor/dist/toolbar/popups/cellproperties.js
@@ -57,8 +57,7 @@ function ColorPickerTool(props) {
var color = props.color, title = props.title, icon = props.icon, onColorChange = props.onColorChange;
var _a = __read(useState(false), 2), isOpen = _a[0], setIsOpen = _a[1];
var buttonRef = useRef(null);
- return (_jsxs(_Fragment, { children: [_jsxs(Flex, __assign({ sx: { justifyContent: "space-between", alignItems: "center", mt: 1 } }, { children: [_jsx(Text, __assign({ variant: "body" }, { children: title })), _jsx(ToolButton, { buttonRef: buttonRef, toggled: isOpen, title: title, id: icon, icon: icon, iconSize: 16, sx: {
- p: "2.5px",
+ return (_jsxs(_Fragment, { children: [_jsxs(Flex, __assign({ sx: { justifyContent: "space-between", alignItems: "center", mt: 1 } }, { children: [_jsx(Text, __assign({ variant: "body" }, { children: title })), _jsx(ToolButton, { buttonRef: buttonRef, toggled: isOpen, title: title, id: icon, icon: icon, variant: "small", sx: {
borderRadius: "small",
backgroundColor: color || "transparent",
":hover": { bg: color, filter: "brightness(90%)" },
diff --git a/packages/editor/dist/toolbar/popups/tablepopup.js b/packages/editor/dist/toolbar/popups/tablepopup.js
index 944f846c7..531da41ef 100644
--- a/packages/editor/dist/toolbar/popups/tablepopup.js
+++ b/packages/editor/dist/toolbar/popups/tablepopup.js
@@ -74,7 +74,7 @@ export function TablePopup(props) {
} }, { children: _jsxs(Flex, __assign({ sx: { p: 1, flexDirection: "column", alignItems: "center" } }, { children: [_jsx(Box, __assign({ sx: {
display: "grid",
gridTemplateColumns: "repeat(".concat(tableSize.columns, ", minmax(").concat(cellSize || 15, "px, 1fr))"),
- gap: "3px",
+ gap: "small",
bg: "background",
width: "100%",
}, onTouchMove: function (e) {
@@ -90,7 +90,7 @@ export function TablePopup(props) {
.fill(0)
.map(function (_, index) { return (_jsx(Box, { "data-index": index, height: cellSize || 15, sx: {
border: "1px solid var(--disabled)",
- borderRadius: "2px",
+ borderRadius: "small",
bg: isCellHighlighted(index, cellLocation, tableSize)
? "disabled"
: "transparent",
diff --git a/packages/editor/dist/toolbar/tools/colors.js b/packages/editor/dist/toolbar/tools/colors.js
index cab7467eb..aa7808930 100644
--- a/packages/editor/dist/toolbar/tools/colors.js
+++ b/packages/editor/dist/toolbar/tools/colors.js
@@ -112,7 +112,7 @@ export function ColorPicker(props) {
bg: color,
width: 25,
height: 25,
- m: "2px",
+ m: "small",
borderRadius: "default",
cursor: "pointer",
":hover": {
@@ -124,8 +124,8 @@ export function ColorPicker(props) {
} })); }), _jsx(Flex, __assign({ sx: {
width: 25,
height: 25,
- m: "2px",
- borderRadius: "default",
+ m: "small",
+ borderRadius: "small",
cursor: "pointer",
alignItems: "center",
justifyContent: "center",
diff --git a/packages/editor/dist/toolbar/tools/font.js b/packages/editor/dist/toolbar/tools/font.js
index 24613fe27..b8a097341 100644
--- a/packages/editor/dist/toolbar/tools/font.js
+++ b/packages/editor/dist/toolbar/tools/font.js
@@ -48,7 +48,7 @@ export function FontSize(props) {
},
} }, { children: [_jsx(ToolButton, { toggled: false, title: "Decrease font size", icon: "minus", variant: "small", onClick: function () {
editor.chain().focus().setFontSize("".concat(decreaseFontSize(), "px")).run();
- } }), _jsx(Text, __assign({ variant: "body", sx: { fontSize: 12, mx: "3px", textAlign: "center" }, title: "Reset font size", onClick: function () {
+ } }), _jsx(Text, __assign({ variant: "body", sx: { fontSize: "subBody", mx: 1, textAlign: "center" }, title: "Reset font size", onClick: function () {
editor.chain().focus().setFontSize("16px").run();
} }, { children: fontSize })), _jsx(ToolButton, { toggled: false, title: "Increase font size", icon: "plus", variant: "small", onClick: function () {
editor
diff --git a/packages/editor/dist/toolbar/tools/lists.js b/packages/editor/dist/toolbar/tools/lists.js
index 07bbe5e67..143d4173b 100644
--- a/packages/editor/dist/toolbar/tools/lists.js
+++ b/packages/editor/dist/toolbar/tools/lists.js
@@ -107,6 +107,6 @@ function ListThumbnail(props) {
flexShrink: 0,
height: 4,
bg: "#cbcbcb",
- borderRadius: "2px",
+ borderRadius: "small",
} }) })) }))); }) })));
}
diff --git a/packages/editor/src/extensions/attachment/component.tsx b/packages/editor/src/extensions/attachment/component.tsx
index bd51e1b3f..c3630dbe2 100644
--- a/packages/editor/src/extensions/attachment/component.tsx
+++ b/packages/editor/src/extensions/attachment/component.tsx
@@ -45,7 +45,7 @@ export function AttachmentComponent(props: ImageProps & NodeViewProps) {
userSelect: "none",
alignItems: "center",
backgroundColor: "bgSecondary",
- padding: "0px 5px 0px 5px",
+ px: 1,
borderRadius: "default",
border: "1px solid var(--border)",
cursor: "pointer",
@@ -61,7 +61,7 @@ export function AttachmentComponent(props: ImageProps & NodeViewProps) {
<Text
as="span"
sx={{
- ml: "3px",
+ ml: "small",
fontSize: "0.85rem",
whiteSpace: "nowrap",
textOverflow: "ellipsis",
@@ -75,8 +75,8 @@ export function AttachmentComponent(props: ImageProps & NodeViewProps) {
as="span"
className="size"
sx={{
- ml: "7px",
- fontSize: "0.7rem",
+ ml: 1,
+ fontSize: "subBody",
color: "fontTertiary",
flexShrink: 0,
}}
@@ -151,8 +151,8 @@ function AttachmentToolbar(props: AttachmentToolbarProps) {
id="download"
icon="download"
onClick={() => {}}
- iconSize={16}
- sx={{ mr: 1, p: "3px", borderRadius: "small" }}
+ variant="small"
+ sx={{ mr: 1 }}
/>
<ToolButton
toggled={false}
@@ -160,8 +160,8 @@ function AttachmentToolbar(props: AttachmentToolbarProps) {
id="delete"
icon="delete"
onClick={() => {}}
- iconSize={16}
- sx={{ mr: 0, p: "3px", borderRadius: "small" }}
+ variant="small"
+ sx={{ mr: 0 }}
/>
</Flex>
</Flex>
diff --git a/packages/editor/src/toolbar/components/dropdown.tsx b/packages/editor/src/toolbar/components/dropdown.tsx
index 6f9d6d162..17fcff733 100644
--- a/packages/editor/src/toolbar/components/dropdown.tsx
+++ b/packages/editor/src/toolbar/components/dropdown.tsx
@@ -42,7 +42,7 @@ export function Dropdown(props: DropdownProps) {
onMouseDown={(e) => e.preventDefault()}
>
{typeof selectedItem === "string" ? (
- <Text sx={{ fontSize: 12, mr: 1, color: "text" }}>
+ <Text sx={{ fontSize: "subBody", mr: 1, color: "text" }}>
{selectedItem}
</Text>
) : (
@@ -52,7 +52,7 @@ export function Dropdown(props: DropdownProps) {
path={
toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown
}
- size={14}
+ size={"small"}
color={"text"}
/>
</Button>
diff --git a/packages/editor/src/toolbar/components/icon.tsx b/packages/editor/src/toolbar/components/icon.tsx
index 6df86b219..526061d3a 100644
--- a/packages/editor/src/toolbar/components/icon.tsx
+++ b/packages/editor/src/toolbar/components/icon.tsx
@@ -7,7 +7,7 @@ import { Flex, FlexProps } from "rebass";
type IconProps = {
title?: string;
path: string;
- size?: number;
+ size?: keyof Theme["iconSizes"] | number;
color?: keyof SchemeColors;
stroke?: string;
rotate?: boolean;
@@ -31,7 +31,9 @@ function MDIIconWrapper({
className="icon"
title={title}
path={path}
- size={size + "px"}
+ size={
+ typeof size === "string" ? `${theme.iconSizes[size]}px` : `${size}px`
+ }
style={{
strokeWidth: stroke || "0px",
stroke: themedColor,
diff --git a/packages/editor/src/toolbar/components/split-button.tsx b/packages/editor/src/toolbar/components/split-button.tsx
index f48f03fd2..139678033 100644
--- a/packages/editor/src/toolbar/components/split-button.tsx
+++ b/packages/editor/src/toolbar/components/split-button.tsx
@@ -47,7 +47,7 @@ export function SplitButton(props: PropsWithChildren<SplitButtonProps>) {
toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown
}
color="text"
- size={14}
+ size={"small"}
/>
</Button>
</Flex>
diff --git a/packages/editor/src/toolbar/components/tool-button.tsx b/packages/editor/src/toolbar/components/tool-button.tsx
index f1531a708..2d6b14f80 100644
--- a/packages/editor/src/toolbar/components/tool-button.tsx
+++ b/packages/editor/src/toolbar/components/tool-button.tsx
@@ -1,4 +1,6 @@
+import { Theme } from "@notesnook/theme";
import { SchemeColors } from "@notesnook/theme/dist/theme/colorscheme";
+import { useTheme } from "emotion-theming";
import React from "react";
import { Button, ButtonProps } from "rebass";
import { IconNames, Icons } from "../icons";
@@ -31,7 +33,7 @@ export function ToolButton(props: ToolButtonProps) {
tabIndex={-1}
id={`tool-${id}`}
sx={{
- p: variant === "small" ? "3px" : 1,
+ p: variant === "small" ? "small" : 1,
borderRadius: variant === "small" ? "small" : "default",
m: 0,
bg: toggled ? "hover" : "transparent",
@@ -47,8 +49,8 @@ export function ToolButton(props: ToolButtonProps) {
>
<Icon
path={Icons[icon]}
- color={iconColor || "text"}
- size={iconSize || variant === "small" ? 16 : 18}
+ color={iconColor || "icon"}
+ size={iconSize || variant === "small" ? "medium" : "big"}
/>
</Button>
);
diff --git a/packages/editor/src/toolbar/popups/cell-properties.tsx b/packages/editor/src/toolbar/popups/cell-properties.tsx
index 8b137c74c..50f2d3ee5 100644
--- a/packages/editor/src/toolbar/popups/cell-properties.tsx
+++ b/packages/editor/src/toolbar/popups/cell-properties.tsx
@@ -95,9 +95,8 @@ function ColorPickerTool(props: ColorPickerToolProps) {
title={title}
id={icon}
icon={icon}
- iconSize={16}
+ variant="small"
sx={{
- p: "2.5px",
borderRadius: "small",
backgroundColor: color || "transparent",
":hover": { bg: color, filter: "brightness(90%)" },
diff --git a/packages/editor/src/toolbar/popups/table-popup.tsx b/packages/editor/src/toolbar/popups/table-popup.tsx
index f12bfbfe6..af4c1f6ae 100644
--- a/packages/editor/src/toolbar/popups/table-popup.tsx
+++ b/packages/editor/src/toolbar/popups/table-popup.tsx
@@ -71,7 +71,7 @@ export function TablePopup(props: TablePopupProps) {
gridTemplateColumns: `repeat(${tableSize.columns}, minmax(${
cellSize || 15
}px, 1fr))`, // "1fr ".repeat(tableSize.columns),
- gap: "3px",
+ gap: "small",
bg: "background",
width: "100%",
}}
@@ -95,7 +95,7 @@ export function TablePopup(props: TablePopupProps) {
height={cellSize || 15}
sx={{
border: "1px solid var(--disabled)",
- borderRadius: "2px",
+ borderRadius: "small",
bg: isCellHighlighted(index, cellLocation, tableSize)
? "disabled"
: "transparent",
diff --git a/packages/editor/src/toolbar/tools/colors.tsx b/packages/editor/src/toolbar/tools/colors.tsx
index cb6864fc7..29fbbe3a1 100644
--- a/packages/editor/src/toolbar/tools/colors.tsx
+++ b/packages/editor/src/toolbar/tools/colors.tsx
@@ -144,7 +144,7 @@ export function ColorPicker(props: ColorPickerProps) {
bg: color,
width: 25,
height: 25,
- m: "2px",
+ m: "small",
borderRadius: "default",
cursor: "pointer",
":hover": {
@@ -161,8 +161,8 @@ export function ColorPicker(props: ColorPickerProps) {
sx={{
width: 25,
height: 25,
- m: "2px",
- borderRadius: "default",
+ m: "small",
+ borderRadius: "small",
cursor: "pointer",
alignItems: "center",
justifyContent: "center",
diff --git a/packages/editor/src/toolbar/tools/font.tsx b/packages/editor/src/toolbar/tools/font.tsx
index ef4203557..2ffc8e543 100644
--- a/packages/editor/src/toolbar/tools/font.tsx
+++ b/packages/editor/src/toolbar/tools/font.tsx
@@ -41,7 +41,7 @@ export function FontSize(props: ToolProps) {
/>
<Text
variant={"body"}
- sx={{ fontSize: 12, mx: "3px", textAlign: "center" }}
+ sx={{ fontSize: "subBody", mx: 1, textAlign: "center" }}
title="Reset font size"
onClick={() => {
editor.chain().focus().setFontSize(`16px`).run();
diff --git a/packages/editor/src/toolbar/tools/lists.tsx b/packages/editor/src/toolbar/tools/lists.tsx
index c0298b6ed..f9e84dca2 100644
--- a/packages/editor/src/toolbar/tools/lists.tsx
+++ b/packages/editor/src/toolbar/tools/lists.tsx
@@ -150,7 +150,7 @@ function ListThumbnail(props: ListThumbnailProps) {
flexShrink: 0,
height: 4,
bg: "#cbcbcb",
- borderRadius: "2px",
+ borderRadius: "small",
}}
/>
</Flex>