Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit bf80166

Browse files
feat: add splitpanes
1 parent 08d5a4f commit bf80166

File tree

6 files changed

+37
-6
lines changed

6 files changed

+37
-6
lines changed

client/components/MediaPreview.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<script setup lang="ts">
22
import { computed, reactive, inject, provide, watchEffect, watch } from 'vue'
33
// @ts-ignore
4+
import { Pane, Splitpanes } from 'splitpanes'
5+
// @ts-ignore
46
import { useRuntimeConfig, useRoute } from '#app'
57
68
import type { PreviewState } from '../../types/preview'
@@ -76,11 +78,15 @@ watchEffect(() => {
7678
leave-from-class="transform scale-1 opacity-100"
7779
leave-to-class="transform scale-0 opacity-0"
7880
>
79-
<div v-if="selectedAssetKey" v-focus tabindex="0" class="rounded border n-border-base drop-shadow-sm flex flex-1 relative n-bg-base h-full items-center justify-center">
80-
<div class="rounded flex flex-1 h-full w-full">
81-
<MediaPreviewImage class="w-6/12 md:w-7/12 lg:w-8/12" :selected-asset-key="selectedAssetKey" />
82-
<MediaPreviewStats class="w-6/12 md:w-5/12 lg:w-4/12" :selected-asset-key="selectedAssetKey" />
83-
</div>
81+
<div v-if="selectedAssetKey" v-focus tabindex="0" class="border outline-none n-border-base drop-shadow-sm flex flex-1 relative n-bg-base h-full items-center justify-center">
82+
<Splitpanes class="flex flex-1 h-full w-full">
83+
<Pane class="border border-r border-base of-auto" min-size="30">
84+
<MediaPreviewImage class="h-full" :selected-asset-key="selectedAssetKey" />
85+
</Pane>
86+
<Pane size="30" min-size="30">
87+
<MediaPreviewStats class="h-full" :selected-asset-key="selectedAssetKey" />
88+
</Pane>
89+
</Splitpanes>
8490
</div>
8591
</Transition>
8692
</div>

client/nuxt.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export default defineNuxtConfig({
1111
publicDir: resolve(__dirname, '../dist/client')
1212
}
1313
},
14+
css: [
15+
'splitpanes/dist/splitpanes.css'
16+
],
1417
app: {
1518
baseURL: '/__media_viewer/client'
1619
},

client/pages/index.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,18 @@ onKeyStroke('ArrowLeft', (e) => {
209209
<MediaDropPlaceholder v-if="!selectedAssetKey" />
210210
</div>
211211
</template>
212+
213+
<style>
214+
/* Splitpanes */
215+
.splitpanes__splitter{
216+
--at-apply: relative;
217+
}
218+
.splitpanes__splitter:before {
219+
--at-apply: absolute left-0 top-0 opacity-0;
220+
content: '';
221+
transition: opacity 0.4s;
222+
z-index: 1;
223+
}
224+
.splitpanes--vertical > .splitpanes__splitter:before {left: -4px;right: -4px;height: 100%;}
225+
.splitpanes--horizontal > .splitpanes__splitter:before {top: -4px;bottom: -4px;width: 100%;}
226+
</style>

client/utils/snippets/html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function generateHtmlDownloadSnippet (previewState: PreviewState) {
105105
return [
106106
'<a',
107107
` href="${hostname}${previewState.stats.path}"`,
108-
' download,',
108+
' download',
109109
'>',
110110
` Download ${previewState.stats.name}`,
111111
'</a>'

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"npm-run-all": "^4.1.5",
5353
"nuxt": "^3.2.0",
5454
"sirv": "^2.0.2",
55+
"splitpanes": "^3.1.5",
5556
"standard-version": "^9.5.0",
5657
"typescript": "^4.9.5"
5758
}

pnpm-lock.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)