summaryrefslogtreecommitdiff
path: root/src/web/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-02-15 15:14:28 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-02-15 15:14:28 +0900
commitff67563dc8e7c7f96a0286607cf2dc981814df92 (patch)
treea34dd7c041f6b874bd99f8cf1d5fc74b93f90275 /src/web/app/common
parentwip (diff)
downloadmisskey-ff67563dc8e7c7f96a0286607cf2dc981814df92.tar.gz
misskey-ff67563dc8e7c7f96a0286607cf2dc981814df92.tar.bz2
misskey-ff67563dc8e7c7f96a0286607cf2dc981814df92.zip
wip
Diffstat (limited to 'src/web/app/common')
-rw-r--r--src/web/app/common/views/components/images.vue63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/web/app/common/views/components/images.vue b/src/web/app/common/views/components/images.vue
new file mode 100644
index 0000000000..dc802a0180
--- /dev/null
+++ b/src/web/app/common/views/components/images.vue
@@ -0,0 +1,63 @@
+<template>
+<div class="mk-images">
+ <mk-images-image v-for="image in images" ref="image" :image="image" :key="image.id"/>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+
+export default Vue.extend({
+ props: ['images'],
+ mounted() {
+ const tags = this.$refs.image as Vue[];
+
+ if (this.images.length == 1) {
+ (this.$el.style as any).gridTemplateRows = '1fr';
+
+ (tags[0].$el.style as any).gridColumn = '1 / 2';
+ (tags[0].$el.style as any).gridRow = '1 / 2';
+ } else if (this.images.length == 2) {
+ (this.$el.style as any).gridTemplateColumns = '1fr 1fr';
+ (this.$el.style as any).gridTemplateRows = '1fr';
+
+ (tags[0].$el.style as any).gridColumn = '1 / 2';
+ (tags[0].$el.style as any).gridRow = '1 / 2';
+ (tags[1].$el.style as any).gridColumn = '2 / 3';
+ (tags[1].$el.style as any).gridRow = '1 / 2';
+ } else if (this.images.length == 3) {
+ (this.$el.style as any).gridTemplateColumns = '1fr 0.5fr';
+ (this.$el.style as any).gridTemplateRows = '1fr 1fr';
+
+ (tags[0].$el.style as any).gridColumn = '1 / 2';
+ (tags[0].$el.style as any).gridRow = '1 / 3';
+ (tags[1].$el.style as any).gridColumn = '2 / 3';
+ (tags[1].$el.style as any).gridRow = '1 / 2';
+ (tags[2].$el.style as any).gridColumn = '2 / 3';
+ (tags[2].$el.style as any).gridRow = '2 / 3';
+ } else if (this.images.length == 4) {
+ (this.$el.style as any).gridTemplateColumns = '1fr 1fr';
+ (this.$el.style as any).gridTemplateRows = '1fr 1fr';
+
+ (tags[0].$el.style as any).gridColumn = '1 / 2';
+ (tags[0].$el.style as any).gridRow = '1 / 2';
+ (tags[1].$el.style as any).gridColumn = '2 / 3';
+ (tags[1].$el.style as any).gridRow = '1 / 2';
+ (tags[2].$el.style as any).gridColumn = '1 / 2';
+ (tags[2].$el.style as any).gridRow = '2 / 3';
+ (tags[3].$el.style as any).gridColumn = '2 / 3';
+ (tags[3].$el.style as any).gridRow = '2 / 3';
+ }
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+.mk-images
+ display grid
+ grid-gap 4px
+ height 256px
+
+ @media (max-width 500px)
+ height 192px
+</style>