From a671b853f50701b109150a2e957c96a9de0dfdc0 Mon Sep 17 00:00:00 2001 From: Jamie Brynes Date: Sat, 6 Apr 2024 20:42:12 +0100 Subject: [PATCH] chore: add deprecation notice to settings --- plugin/src/ui/settings/SettingItem.tsx | 29 ++++++++++++++++++++++++-- plugin/src/ui/settings/index.tsx | 14 +++++++++++-- plugin/src/ui/settings/styles.scss | 12 +++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/plugin/src/ui/settings/SettingItem.tsx b/plugin/src/ui/settings/SettingItem.tsx index 25630a5..6f2b2e2 100644 --- a/plugin/src/ui/settings/SettingItem.tsx +++ b/plugin/src/ui/settings/SettingItem.tsx @@ -6,20 +6,45 @@ import { ObsidianIcon } from "../components/obsidian-icon"; type RootProps = { name: string; description: string; + deprecationMessage?: string; }; -const Root: React.FC> = ({ children, name, description }) => { +const Root: React.FC> = ({ + children, + name, + description, + deprecationMessage, +}) => { + const renderDeprecationNotice = deprecationMessage !== undefined; return (
{name}
-
{description}
+
+ {description} + {renderDeprecationNotice && } +
{children}
); }; +type DeprecationNoticeProps = { + message: string; +}; + +const DeprecationNotice: React.FC = ({ message }) => { + return ( +
+ +
+ This setting is deprecated and will be removed in a future release. {message} +
+
+ ); +}; + type ButtonProps = { label: string; icon?: string; diff --git a/plugin/src/ui/settings/index.tsx b/plugin/src/ui/settings/index.tsx index 0350003..bee3414 100644 --- a/plugin/src/ui/settings/index.tsx +++ b/plugin/src/ui/settings/index.tsx @@ -121,11 +121,16 @@ const SettingsRoot: React.FC = ({ plugin }) => { - + = ({ plugin }) => { @@ -148,7 +154,11 @@ const SettingsRoot: React.FC = ({ plugin }) => { - +