Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
Update mime type icon styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Marttin Notta committed Jun 18, 2021
1 parent 8d298af commit fc41e36
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

34 changes: 25 additions & 9 deletions resources/js/components/IndexFileField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,31 @@ export default {
},
};
</script>
<style scoped lang="scss">
.mime-type-icon {
width: 100%;
max-width: 50px;
}
<style lang="scss">
.mime-type-icon-wrapper {
display: flex;
justify-content: center;
align-content: center;
align-items: center;
.mime-type-icon {
width: 100%;
max-width: 50px;
}
.mime-type-video {
padding: 6px;
}
.mime-type-audio {
padding: 8px;
}
img,
svg {
width: 100%;
height: 100%;
img,
svg {
width: 100%;
height: 100%;
object-fit: contain;
}
}
</style>
6 changes: 5 additions & 1 deletion resources/js/components/MimeTypeIcon.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="mime-type-icon">
<div :class="`mime-type-icon mime-type-${mimeStartsWith}`">
<img
v-if="isImageFile && src && !isImageFileMissing"
draggable="false"
Expand Down Expand Up @@ -38,6 +38,10 @@ export default {
},
computed: {
mimeStartsWith() {
const split = this.mimeType?.split('/');
return split.length ? split[0] : null;
},
isImageFile() {
return this.mimeType?.indexOf('image/') === 0;
},
Expand Down

0 comments on commit fc41e36

Please sign in to comment.