summaryrefslogtreecommitdiff
path: root/packages/client/src/directives
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2021-11-28 20:07:37 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2021-11-28 20:07:37 +0900
commite8005c8d3a6edf2c8cdce3fe098fb9acff8a57c6 (patch)
tree4283a0a36f5cb03f0fb3a534142c06783f8ff725 /packages/client/src/directives
parent/antennas/notes API で日付による絞り込みができるようにする... (diff)
downloadsharkey-e8005c8d3a6edf2c8cdce3fe098fb9acff8a57c6.tar.gz
sharkey-e8005c8d3a6edf2c8cdce3fe098fb9acff8a57c6.tar.bz2
sharkey-e8005c8d3a6edf2c8cdce3fe098fb9acff8a57c6.zip
client: refine ui
Diffstat (limited to 'packages/client/src/directives')
-rw-r--r--packages/client/src/directives/index.ts2
-rw-r--r--packages/client/src/directives/panel.ts24
2 files changed, 26 insertions, 0 deletions
diff --git a/packages/client/src/directives/index.ts b/packages/client/src/directives/index.ts
index cd71bc26d3..4b11bb6213 100644
--- a/packages/client/src/directives/index.ts
+++ b/packages/client/src/directives/index.ts
@@ -10,6 +10,7 @@ import appear from './appear';
import anim from './anim';
import stickyContainer from './sticky-container';
import clickAnime from './click-anime';
+import panel from './panel';
export default function(app: App) {
app.directive('userPreview', userPreview);
@@ -23,4 +24,5 @@ export default function(app: App) {
app.directive('anim', anim);
app.directive('click-anime', clickAnime);
app.directive('sticky-container', stickyContainer);
+ app.directive('panel', panel);
}
diff --git a/packages/client/src/directives/panel.ts b/packages/client/src/directives/panel.ts
new file mode 100644
index 0000000000..86ec2a9116
--- /dev/null
+++ b/packages/client/src/directives/panel.ts
@@ -0,0 +1,24 @@
+import { Directive } from 'vue';
+
+export default {
+ mounted(src, binding, vn) {
+ const getBgColor = (el: HTMLElement) => {
+ const style = window.getComputedStyle(el);
+ if (style.backgroundColor && !['rgba(0, 0, 0, 0)', 'rgba(0,0,0,0)', 'transparent'].includes(style.backgroundColor)) {
+ return style.backgroundColor;
+ } else {
+ return getBgColor(el.parentElement);
+ }
+ }
+
+ const parentBg = getBgColor(src.parentElement);
+
+ const myBg = getComputedStyle(document.documentElement).getPropertyValue('--panel');
+
+ if (parentBg === myBg) {
+ src.style.backgroundColor = 'var(--bg)';
+ } else {
+ src.style.backgroundColor = 'var(--panel)';
+ }
+ },
+} as Directive;