Skip to content

Commit

Permalink
💄 Allow horizontal resizing of image in link page
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaHuhn committed Oct 20, 2021
1 parent 8502e63 commit 6057621
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
10 changes: 8 additions & 2 deletions client/components/ImageDisplay.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="image-wrapper" :style="{ '--max-height': maxHeight }">
<div class="image-wrapper" :style="{ '--max-height': maxHeight, '--resize': resize }">
<div class="image" @click.stop="fullscreen">
<img :src="src" :class="!loaded && 'loading'" @error="onError" @load="onLoad">
</div>
Expand All @@ -16,6 +16,10 @@ export default {
maxHeight: {
type: String,
default: '300px'
},
resize: {
type: String,
default: 'vertical'
}
},
data() {
Expand Down Expand Up @@ -43,13 +47,15 @@ export default {

<style lang="scss" scoped>
.image-wrapper {
margin: auto;
margin-top: 1rem;
margin-bottom: 1rem;
background: var(--background-2nd);
overflow: hidden;
border-radius: var(--border-radius);
resize: vertical;
resize: var(--resize);
height: var(--max-height);
max-width: 100%;
}
.image {
Expand Down
25 changes: 1 addition & 24 deletions client/pages/link/_.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</div>
<hr>
<div class="link-content">
<ImageDisplay v-if="link.meta && link.meta.image" :src="imageUrl" max-height="400px" />
<ImageDisplay v-if="link.meta && link.meta.image" :src="imageUrl" max-height="400px" resize="both" />
<LinkEditor v-model="linkDescription" :editable="editable" placeholder="Add some notes …" />
</div>
</div>
Expand Down Expand Up @@ -479,28 +479,5 @@ export default {
.link-content {
padding-top: 1rem;
.image-wrapper {
margin-bottom: 1rem;
background: var(--background-2nd);
overflow: hidden;
border-radius: var(--border-radius);
resize: vertical;
}
.image {
max-width: 100%;
max-height: 300px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
& img {
width: 100%;
height: 100%;
pointer-events: none;
}
}
}
</style>

0 comments on commit 6057621

Please sign in to comment.