From 402217030915c44b8da6bafd9793f402548fc90a Mon Sep 17 00:00:00 2001 From: Jamie Brynes Date: Sun, 15 Dec 2024 21:30:13 +0000 Subject: [PATCH] fix: use built-in obisidian sizes --- plugin/src/ui/components/callout/index.tsx | 2 +- plugin/src/ui/components/obsidian-icon/index.tsx | 8 ++++---- plugin/src/ui/components/obsidian-icon/styles.scss | 9 +++++++++ plugin/src/ui/components/token-validation-icon/index.tsx | 6 +++--- plugin/src/ui/createTaskModal/DueDateSelector.tsx | 6 +++--- plugin/src/ui/createTaskModal/LabelSelector.tsx | 4 ++-- plugin/src/ui/createTaskModal/PrioritySelector.tsx | 2 +- plugin/src/ui/createTaskModal/ProjectSelector.tsx | 6 +++--- plugin/src/ui/query/QueryHeader.tsx | 2 +- plugin/src/ui/query/styles.scss | 1 - plugin/src/ui/query/task/TaskMetadata.tsx | 2 +- plugin/src/ui/settings/SettingItem.tsx | 4 ++-- 12 files changed, 30 insertions(+), 22 deletions(-) diff --git a/plugin/src/ui/components/callout/index.tsx b/plugin/src/ui/components/callout/index.tsx index 1b29c42..46b38ea 100644 --- a/plugin/src/ui/components/callout/index.tsx +++ b/plugin/src/ui/components/callout/index.tsx @@ -14,7 +14,7 @@ export const Callout: React.FC = ({ title, contents, iconId, className }) return (
- + {title}
{contents && ( diff --git a/plugin/src/ui/components/obsidian-icon/index.tsx b/plugin/src/ui/components/obsidian-icon/index.tsx index 82c6fa5..e7e49e5 100644 --- a/plugin/src/ui/components/obsidian-icon/index.tsx +++ b/plugin/src/ui/components/obsidian-icon/index.tsx @@ -6,7 +6,7 @@ import { useRef } from "react"; import "./styles.scss"; type Props = { - size: number; + size: "xs" | "s" | "m" | "l" | "xl"; id: string; className?: string; }; @@ -18,8 +18,8 @@ export const ObsidianIcon: React.FC = ({ size, id, className }) => { return; } - setIcon(div.current, id, size); - }, [id, size]); + setIcon(div.current, id); + }, [id]); - return
; + return
; }; diff --git a/plugin/src/ui/components/obsidian-icon/styles.scss b/plugin/src/ui/components/obsidian-icon/styles.scss index 5c0f2c7..5c0b54e 100644 --- a/plugin/src/ui/components/obsidian-icon/styles.scss +++ b/plugin/src/ui/components/obsidian-icon/styles.scss @@ -1,4 +1,13 @@ +$sizes: xs, s, m, l, xl; + .obsidian-icon { display: flex; align-items: center; + + @each $size in $sizes { + &[data-icon-size="#{$size}"] { + --icon-size: var(--icon-#{$size}); + --icon-stroke: var(--icon-#{$size}-stroke-width); + } + } } diff --git a/plugin/src/ui/components/token-validation-icon/index.tsx b/plugin/src/ui/components/token-validation-icon/index.tsx index ee70d7e..ac434bb 100644 --- a/plugin/src/ui/components/token-validation-icon/index.tsx +++ b/plugin/src/ui/components/token-validation-icon/index.tsx @@ -8,10 +8,10 @@ export const TokenValidationIcon: React.FC<{ status: TokenValidation.Result }> = case "none": return <>; case "in-progress": - return ; + return ; case "error": - return ; + return ; case "success": - return ; + return ; } }; diff --git a/plugin/src/ui/createTaskModal/DueDateSelector.tsx b/plugin/src/ui/createTaskModal/DueDateSelector.tsx index 8baeab9..a3fdd94 100644 --- a/plugin/src/ui/createTaskModal/DueDateSelector.tsx +++ b/plugin/src/ui/createTaskModal/DueDateSelector.tsx @@ -101,7 +101,7 @@ export const DueDateSelector: React.FC = ({ selected, setSelected }) => { return ( @@ -145,7 +145,7 @@ export const DueDateSelector: React.FC = ({ selected, setSelected }) => {
@@ -213,7 +213,7 @@ const DateSuggestion: React.FC = ({ id, icon, label, target
- + {label}
{dayOfWeek}
diff --git a/plugin/src/ui/createTaskModal/LabelSelector.tsx b/plugin/src/ui/createTaskModal/LabelSelector.tsx index 452a103..a20e969 100644 --- a/plugin/src/ui/createTaskModal/LabelSelector.tsx +++ b/plugin/src/ui/createTaskModal/LabelSelector.tsx @@ -35,7 +35,7 @@ export const LabelSelector: React.FC = ({ selected, setSelected }) => { return ( @@ -70,7 +70,7 @@ const LabelItem: React.FC = ({ label, isSelected }) => { textValue={label.name} > {label.name} - {isSelected && } + {isSelected && } ); }; diff --git a/plugin/src/ui/createTaskModal/PrioritySelector.tsx b/plugin/src/ui/createTaskModal/PrioritySelector.tsx index bed6429..9820b6e 100644 --- a/plugin/src/ui/createTaskModal/PrioritySelector.tsx +++ b/plugin/src/ui/createTaskModal/PrioritySelector.tsx @@ -31,7 +31,7 @@ export const PrioritySelector: React.FC = ({ selected, setSelected }) => return ( diff --git a/plugin/src/ui/createTaskModal/ProjectSelector.tsx b/plugin/src/ui/createTaskModal/ProjectSelector.tsx index 4b7a7e7..abab937 100644 --- a/plugin/src/ui/createTaskModal/ProjectSelector.tsx +++ b/plugin/src/ui/createTaskModal/ProjectSelector.tsx @@ -65,7 +65,7 @@ export const ProjectSelector: React.FC = ({ selected, setSelected }) => { @@ -216,7 +216,7 @@ const ItemKey = { const SectionLabel: React.FC<{ section: Section }> = ({ section }) => { return ( <> - +
{section.name}
); @@ -227,7 +227,7 @@ const ProjectLabel: React.FC<{ project: Project }> = ({ project }) => { return ( <> - +
{project.name}
); diff --git a/plugin/src/ui/query/QueryHeader.tsx b/plugin/src/ui/query/QueryHeader.tsx index 7bc270c..d72005f 100644 --- a/plugin/src/ui/query/QueryHeader.tsx +++ b/plugin/src/ui/query/QueryHeader.tsx @@ -74,7 +74,7 @@ const HeaderButton: React.FC = ({ iconId, action, className }) => { return ( ); }; diff --git a/plugin/src/ui/query/styles.scss b/plugin/src/ui/query/styles.scss index 22ab276..017f48f 100644 --- a/plugin/src/ui/query/styles.scss +++ b/plugin/src/ui/query/styles.scss @@ -135,7 +135,6 @@ justify-content: space-between; font-size: var(--font-smaller); margin-top: 0.25em; - --icon-size: 14px; color: var(--text-muted); & > div { diff --git a/plugin/src/ui/query/task/TaskMetadata.tsx b/plugin/src/ui/query/task/TaskMetadata.tsx index 6b1da1a..21f904b 100644 --- a/plugin/src/ui/query/task/TaskMetadata.tsx +++ b/plugin/src/ui/query/task/TaskMetadata.tsx @@ -111,7 +111,7 @@ const getMetadataElems = ( .flatMap((meta) => { return meta.content(task).map((content) => { const icon = meta.icon.shouldRender(settings) ? ( - + ) : undefined; const children = [icon, {content.content}]; diff --git a/plugin/src/ui/settings/SettingItem.tsx b/plugin/src/ui/settings/SettingItem.tsx index ae3aff9..55c0014 100644 --- a/plugin/src/ui/settings/SettingItem.tsx +++ b/plugin/src/ui/settings/SettingItem.tsx @@ -40,7 +40,7 @@ const DeprecationNotice: React.FC = ({ message }) => { const prefix = t().settings.deprecation.warningMessage; return (
- +
{prefix} {message}
@@ -58,7 +58,7 @@ type ButtonProps = { const ButtonControl: React.FC = ({ label, icon, onClick, disabled }) => { return ( );