Skip to content

Commit

Permalink
feat: create component to show in progress badge
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Oct 2, 2024
1 parent 2e8b68e commit 10d7af1
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .storybook/stories/BadgeContainer.stories.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions src/components/MyKiva/BadgeContainer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template>
<div
:class="{'in-progress tw-relative': inProgress}"
:title="title"
>
<slot></slot>
</div>
</template>

<script setup>
import {
toRefs,
defineProps,
computed
} from 'vue';
const props = defineProps({
name: {
type: String,
default: ''
},
status: {
type: String, // 'in-progress', 'completed'
default: 'completed'
}
});
const { name, status } = toRefs(props);
const inProgress = status.value === 'in-progress';
const title = computed(() => {
return `${status.value === 'in-progress' ? 'In Progress' : 'Completed'} badge: ${name.value}`;
});
</script>

<style lang="postcss" scoped>
.in-progress {
@apply tw-grayscale tw-rounded-full tw-w-fit tw-bg-secondary;
background-image: url("data:image/svg+xml,%3csvg width='100%25' height='100%25' xmlns='http://www.w3.org/2000/svg'%3e%3crect width='100%25' height='100%25' fill='none' rx='100' ry='100' stroke='gray' stroke-width='8' stroke-dasharray='23' stroke-dashoffset='0' stroke-linecap='round'/%3e%3c/svg%3e");

Check failure on line 41 in src/components/MyKiva/BadgeContainer.vue

View workflow job for this annotation

GitHub Actions / build

This line has a length of 302. Maximum allowed is 120
}
</style>

0 comments on commit 10d7af1

Please sign in to comment.