From 09196910eb5fea78488fe0a77b2f44146c68ee9f Mon Sep 17 00:00:00 2001 From: Dirk Wilden Date: Mon, 24 Jan 2022 11:07:32 +0100 Subject: [PATCH 1/2] add spinner and sidebar toggle --- src/ui/styles.scss | 28 ++++++++++ src/ui/ui.tsx | 132 ++++++++++++++++++++++++++++++--------------- 2 files changed, 116 insertions(+), 44 deletions(-) diff --git a/src/ui/styles.scss b/src/ui/styles.scss index f24cdde..89ccca8 100644 --- a/src/ui/styles.scss +++ b/src/ui/styles.scss @@ -14,6 +14,7 @@ --primary-text-color: #3c3c3c; --secondary-text-color: #888; --sidebar-hover-color: var(--bluish-white); + --spinner-color: black; // @media-dependent variables --padding-standard: 30px; @@ -52,6 +53,7 @@ --primary-text-color: var(--bluish-white); --secondary-text-color: #7f91aa; --sidebar-hover-color: var(--border-color); + --spinner-color: white; } @font-face { @@ -235,6 +237,32 @@ mark { } } + .is-hidden { + filter: grayscale(100%); + cursor: pointer; + } + + .spinner-color { + fill: var(--spinner-color) + } + + .spinner { + width: 20px; + height: 20px; + animation: spin 1s linear infinite; + background: none; + padding: 0; + } + + @keyframes spin { + from { + transform:rotate(0deg); + } + to { + transform:rotate(360deg); + } + } + span { background: var(--no-results-color); border-radius: 15px; diff --git a/src/ui/ui.tsx b/src/ui/ui.tsx index d7fadbb..ceebfda 100644 --- a/src/ui/ui.tsx +++ b/src/ui/ui.tsx @@ -96,60 +96,93 @@ const Settings = ({ ); const Sidebar = ({ + visible, hiddenEngines, + onToggle, resultGroups, }: { + visible: boolean; hiddenEngines: string[]; + onToggle: (engineId: string) => void; resultGroups: ResultGroup[]; }) => (
); @@ -217,6 +250,7 @@ const Results = ({ className="title" dangerouslySetInnerHTML={{ __html: result.title }} href={result.url} + target="_blank" /> {result.modified ? ( { sortMode={sortMode} /> 0} hiddenEngines={localData.hiddenEngines || []} + onToggle={engineId => { + const hiddenEngines = localData.hiddenEngines || []; + setLocalData({ + ...localData, + hiddenEngines: hiddenEngines.includes(engineId) + ? hiddenEngines.filter(id => id !== engineId) + : [...hiddenEngines, engineId].sort(), + }); + }} resultGroups={resultGroups} /> Date: Tue, 25 Jan 2022 08:26:01 +0100 Subject: [PATCH 2/2] revert opening links in new tab --- src/ui/ui.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ui/ui.tsx b/src/ui/ui.tsx index ceebfda..042d3bc 100644 --- a/src/ui/ui.tsx +++ b/src/ui/ui.tsx @@ -250,7 +250,6 @@ const Results = ({ className="title" dangerouslySetInnerHTML={{ __html: result.title }} href={result.url} - target="_blank" /> {result.modified ? (