Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanOXDi committed Mar 26, 2024
1 parent 4e68b0b commit a3ae700
Showing 1 changed file with 40 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<template>

<BaseCard
:title="title"
:headingLevel="headingLevel"
:to="to"
:titleLines="titleLines"
>
<div class="">
<div>
<KImg
v-if="layout === 'vertical' && thumbnailDisplay !== 'none'"
:src="thumbnailSrc"
Expand All @@ -22,7 +23,7 @@
<slot v-if="!thumbnailSrc" name="thumbnailPlaceholder"></slot>

<div class="horizontal-layout-style">

<KImg
v-if="layout === 'horizontal' && thumbnailDisplay === 'large'"
:src="thumbnailSrc"
Expand All @@ -38,8 +39,8 @@
<slot v-if="!thumbnailSrc" name="thumbnailPlaceholder"></slot>

<div>
<div
v-if="thumbnailDisplay === 'none'"
<div
v-if="thumbnailDisplay === 'none'"
class="spacing"
>
<slot name="aboveTitle"></slot>
Expand Down Expand Up @@ -90,16 +91,19 @@
</div>
</div>
</BaseCard>

</template>


<script>
import KImg from '../KImg';
import BaseCard from './BaseCard.vue';
export default {
name: "KCard",
components: { BaseCard , KImg},
props:{
import KImg from '../KImg';
import BaseCard from './BaseCard.vue';
export default {
name: 'KCard',
components: { BaseCard, KImg },
props: {
title: {
type: String,
required: false,
Expand All @@ -116,18 +120,18 @@ export default {
return true;
},
},
titleLines:{
type:Number,
required:true,
default:2
titleLines: {
type: Number,
required: true,
default: 2,
},
to: {
type: Object,
required: true,
validator(value) {
if (!value) {
console.error('Error: Prop to is required.');
return false;
return false;
}
return true;
},
Expand All @@ -146,39 +150,43 @@ export default {
thumbnailDisplay: {
type: String,
required: false,
default:'none'
default: 'none',
},
thumbnailSrc:{
thumbnailSrc: {
type: String,
required: false,
default: null
default: null,
},
thumbnailScaleType:{
thumbnailScaleType: {
type: String,
required: false,
default: 'centerInside'
}
default: 'centerInside',
},
},
computed:{
KImgVerticalSmallStyle(){
if(this.thumbnailDisplay === 'small'){
computed: {
KImgVerticalSmallStyle() {
if (this.thumbnailDisplay === 'small') {
return {
padding: '2em',
};
}else{
} else {
return {
padding: '0em',
};
}
},
isVerticalLayout(){
return this.layout === 'vertical' || (this.layout === 'horizontal' && this.thumbnailDisplay === 'large');
}
}
}
isVerticalLayout() {
return (
this.layout === 'vertical' ||
(this.layout === 'horizontal' && this.thumbnailDisplay === 'large')
);
},
},
};
</script>


<style scoped>
.spacing{
Expand All @@ -191,4 +199,4 @@ export default {
.horizontal-layout-style{
display: flex;
}
</style>
</style>

0 comments on commit a3ae700

Please sign in to comment.