diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2021-04-14 03:23:29 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2021-04-14 03:23:29 +0900 |
| commit | 930127348a786f186d9064deb727e85c082c0c56 (patch) | |
| tree | edb318885c0c6fd042fb623f8bb1a8bfebfcc150 /src/client | |
| parent | Tweak UI (diff) | |
| download | misskey-930127348a786f186d9064deb727e85c082c0c56.tar.gz misskey-930127348a786f186d9064deb727e85c082c0c56.tar.bz2 misskey-930127348a786f186d9064deb727e85c082c0c56.zip | |
Tweak UI
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/directives/index.ts | 2 | ||||
| -rw-r--r-- | src/client/directives/sticky-container.ts | 15 | ||||
| -rw-r--r-- | src/client/pages/user/index.timeline.vue | 14 |
3 files changed, 28 insertions, 3 deletions
diff --git a/src/client/directives/index.ts b/src/client/directives/index.ts index 7b9d31a601..6513350e0d 100644 --- a/src/client/directives/index.ts +++ b/src/client/directives/index.ts @@ -7,6 +7,7 @@ import tooltip from './tooltip'; import hotkey from './hotkey'; import appear from './appear'; import anim from './anim'; +import stickyContainer from './sticky-container'; export default function(app: App) { app.directive('userPreview', userPreview); @@ -17,4 +18,5 @@ export default function(app: App) { app.directive('hotkey', hotkey); app.directive('appear', appear); app.directive('anim', anim); + app.directive('sticky-container', stickyContainer); } diff --git a/src/client/directives/sticky-container.ts b/src/client/directives/sticky-container.ts new file mode 100644 index 0000000000..db29ea64b7 --- /dev/null +++ b/src/client/directives/sticky-container.ts @@ -0,0 +1,15 @@ +import { Directive } from 'vue'; + +export default { + mounted(src, binding, vn) { + //const query = binding.value; + + const header = src.children[0]; + const currentStickyTop = getComputedStyle(src).getPropertyValue('--stickyTop'); + src.style.setProperty('--stickyTop', `${parseInt(currentStickyTop) + header.offsetHeight}px`); + header.style.setProperty('--stickyTop', currentStickyTop); + header.style.position = 'sticky'; + header.style.top = 'var(--stickyTop)'; + header.style.zIndex = '1'; + }, +} as Directive; diff --git a/src/client/pages/user/index.timeline.vue b/src/client/pages/user/index.timeline.vue index 1b7a96fff6..4941abdade 100644 --- a/src/client/pages/user/index.timeline.vue +++ b/src/client/pages/user/index.timeline.vue @@ -1,11 +1,11 @@ <template> -<div> - <MkTab v-model:value="with_" class="_gap _section"> +<div class="yrzkoczt" v-sticky-container> + <MkTab v-model:value="with_" class="_gap tab"> <option :value="null">{{ $ts.notes }}</option> <option value="replies">{{ $ts.notesAndReplies }}</option> <option value="files">{{ $ts.withFiles }}</option> </MkTab> - <XNotes ref="timeline" class="_section _noGap_" :pagination="pagination" @before="$emit('before')" @after="e => $emit('after', e)"/> + <XNotes ref="timeline" class="_noGap_" :pagination="pagination" @before="$emit('before')" @after="e => $emit('after', e)"/> </div> </template> @@ -56,3 +56,11 @@ export default defineComponent({ }, }); </script> + +<style lang="scss" scoped> +.yrzkoczt { + > .tab { + background: var(--bg); + } +} +</style> |