Skip to content

Commit 25144be

Browse files
The-x-35Arpit Singhanwarulislam
authored
Solving issue #13 feat: add a badge component (#25)
* Made the Badge component and added the props for value, colour and text colour * feat: badge improved --------- Co-authored-by: Arpit Singh <[email protected]> Co-authored-by: Anwarul Islam <[email protected]>
1 parent 55e7b7a commit 25144be

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

src/components/Badge.vue

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div
3+
:style="{ backgroundColor: bg, color: color }"
4+
class="inline-flex items-center justify-center px-3 py-1 font-semibold hover:bg-opacity-80"
5+
:class="[style === 'rounded' ? 'rounded-full' : 'rounded-md', 'transition']"
6+
>
7+
{{ value }}
8+
</div>
9+
</template>
10+
11+
<script setup lang="ts">
12+
withDefaults(
13+
defineProps<{
14+
bg: string
15+
color: string
16+
value: string
17+
style: "rounded" | "pill"
18+
}>(),
19+
{
20+
bg: "#000000",
21+
color: "#ffffff",
22+
value: "Badge",
23+
style: "rounded",
24+
},
25+
)
26+
</script>
27+
28+
<style scoped>
29+
div {
30+
@apply transition;
31+
}
32+
</style>

src/components/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from "./button"
22
export * from "./smart"
33
export * from "./modal"
44
export * from "./toast"
5+
export { default as HoppBadge } from "./Badge.vue"

src/stories/Badge.story.vue

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<Story title="Badge">
3+
<Variant title="Single">
4+
<HoppBadge />
5+
</Variant>
6+
</Story>
7+
</template>
8+
9+
<script setup lang="ts">
10+
import { HoppBadge } from "../components"
11+
</script>

0 commit comments

Comments
 (0)