Skip to content

Commit

Permalink
🛠️: refactor props definition in TextShort
Browse files Browse the repository at this point in the history
  • Loading branch information
itisAliRH committed Feb 8, 2024
1 parent 535f8e9 commit 752e6b2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions client/src/components/Common/TextShort.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<script setup lang="ts">
import { computed } from "vue";
const props = defineProps({
text: {
type: String,
required: true,
},
maxLength: {
type: Number,
default: 24,
},
interface Props {
text: string;
maxLength?: number;
}
const props = withDefaults(defineProps<Props>(), {
maxLength: 24,
});
const text = computed(() => {
if (props.text.length > props.maxLength) {
const partialText = props.text.slice(0, props.maxLength);
Expand Down

0 comments on commit 752e6b2

Please sign in to comment.