Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
ui/buttons: add support for low profile style
Adorian Dorand64f2c72b708
diff --git a/apps/client/src/widgets/react/Button.tsx b/apps/client/src/widgets/react/Button.tsxindex ffdc6ddd2c..1aab2153e6 100644--- a/apps/client/src/widgets/react/Button.tsx+++ b/apps/client/src/widgets/react/Button.tsx@@ -18,7 +18,7 @@ export interface ButtonProps {keyboardShortcut?: string;/** Called when the button is clicked. If not set, the button will submit the form (if any). */onClick?: () => void;- primary?: boolean;+ kind?: "primary" | "secondary" | "lowProfile";disabled?: boolean;size?: "normal" | "small" | "micro";style?: CSSProperties;@@ -26,15 +26,23 @@ export interface ButtonProps {title?: string;}-const Button = memo(({ name, buttonRef, className, text, onClick, keyboardShortcut, icon, primary, disabled, size, style, triggerCommand, ...restProps }: ButtonProps) => {+const Button = memo(({ name, buttonRef, className, text, onClick, keyboardShortcut, icon, kind, disabled, size, style, triggerCommand, ...restProps }: ButtonProps) => {// Memoize classes array to prevent recreationconst classes = useMemo(() => {const classList: string[] = ["btn"];- if (primary) {- classList.push("btn-primary");- } else {- classList.push("btn-secondary");++ switch(kind) {+ case "primary":+ classList.push("btn-primary");+ break;+ case "lowProfile":+ classList.push("tn-low-profile");+ break;+ default:+ classList.push("btn-secondary");+ break;}+if (className) {classList.push(className);}@@ -44,7 +52,7 @@ const Button = memo(({ name, buttonRef, className, text, onClick, keyboardShortcclassList.push("btn-micro");}return classList.join(" ");- }, [primary, className, size]);+ }, [kind, className, size]);// Memoize keyboard shortcut renderingconst shortcutElements = useMemo(() => {