Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Indicator components #314

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function getComponents() {
{ text: 'Card', link: '/components/card.md' },
{ text: 'Carousel', link: '/components/carousel' },
{ text: 'Dropdown', link: '/components/dropdown' },
{ text: "Indicator", link: '/components/indicator' },
{ text: 'Jumbotron', link: '/components/jumbotron' },
{ text: 'ListGroup', link: '/components/list-group' },
{ text: 'Pagination', link: '/components/pagination' },
Expand Down
60 changes: 60 additions & 0 deletions docs/components/indicator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<script setup>
import FwbIndicatorExample from './indicator/examples/FwbIndicatorExample.vue'
import FwbIndicatorPositionExample from './indicator/examples/FwbIndicatorPositionExample.vue'
</script>

# Vue Indicator - Flowbite

#### Use the indicator component to show a number count, account status, or as a loading label positioned relative to the parent component coded with Tailwind CSS

---

:::tip
Original reference: [https://flowbite.com/docs/components/indicators/](https://flowbite.com/docs/components/indicators/)
:::

The indicator component can be used as a small element positioned absolutely relative to another component such as a button or card and show a number count, account status (red for offline, green for online) and other useful information.

Check out the following examples for multiple sizes, colors, positionings, styles, and more all coded with Tailwind CSS and Flowbite.

## Default Indicator

Use this example to create a simple indicator with multiple colors and position it anywhere on the website.

<fwb-indicator-example />
```vue
<template>
<fwb-indicator />
<fwb-indicator type="dark" />
<fwb-indicator type="blue" />
<fwb-indicator type="green" />
<fwb-indicator type="red" />
<fwb-indicator type="indigo" />
<fwb-indicator type="purple" />
<fwb-indicator type="yellow" />
<fwb-indicator type="teal" />
</template>
```

## Indicator position

Use these examples to position the indicator component anywhere relative to the parent element.

<fwb-indicator-position-example />
<br />

```vue
<template>
<div class='relative'>
<fwb-indicator class="absolute top-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-left</fwb-indicator>
<fwb-indicator class="absolute top-0 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-center</fwb-indicator>
<fwb-indicator class="absolute top-0 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-right</fwb-indicator>
<fwb-indicator class="absolute top-1/2 left-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-left</fwb-indicator>
<fwb-indicator class="absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-center</fwb-indicator>
<fwb-indicator class="absolute top-1/2 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-right</fwb-indicator>
<fwb-indicator class="absolute bottom-0 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-left</fwb-indicator>
<fwb-indicator class="absolute bottom-0 left-1/2 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-center</fwb-indicator>
<fwb-indicator class="absolute bottom-0 right-0 translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-right</fwb-indicator>
</div>
</template>
```
18 changes: 18 additions & 0 deletions docs/components/indicator/examples/FwbIndicatorExample.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div class="vp-raw flex gap-4">

Check warning on line 2 in docs/components/indicator/examples/FwbIndicatorExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Expected indentation of 2 spaces but found 0 spaces
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation issues.

Expected indentation of 2 spaces but found 0 spaces.

-<div class="vp-raw flex gap-4">
+  <div class="vp-raw flex gap-4">
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div class="vp-raw flex gap-4">
<div class="vp-raw flex gap-4">
Tools
GitHub Check: lint (18.x)

[warning] 2-2:
Expected indentation of 2 spaces but found 0 spaces

<fwb-indicator />
<fwb-indicator type="dark" />
<fwb-indicator type="blue" />
<fwb-indicator type="green" />
<fwb-indicator type="red" />
<fwb-indicator type="indigo" />
<fwb-indicator type="purple" />
<fwb-indicator type="yellow" />
<fwb-indicator type="teal" />
</div>

Check warning on line 12 in docs/components/indicator/examples/FwbIndicatorExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Expected indentation of 2 spaces but found 0 spaces
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation issues.

Expected indentation of 2 spaces but found 0 spaces.

-</div>
+  </div>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
</div>
</div>
Tools
GitHub Check: lint (18.x)

[warning] 12-12:
Expected indentation of 2 spaces but found 0 spaces

</template>

<script setup lang="ts">
import { FwbIndicator } from '../../../../src/index'

</script>
18 changes: 18 additions & 0 deletions docs/components/indicator/examples/FwbIndicatorPositionExample.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div class="relative w-56 h-56 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-800 dark:border-gray-700">

Check warning on line 2 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Expected indentation of 2 spaces but found 0 spaces
<fwb-indicator class="absolute top-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-left</fwb-indicator>

Check warning on line 3 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'type' should be on a new line

Check warning on line 3 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Expected 1 line break after opening tag (`<fwb-indicator>`), but no line breaks found

Check warning on line 3 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Expected 1 line break before closing tag (`</fwb-indicator>`), but no line breaks found
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute top-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-left</fwb-indicator>
+    <fwb-indicator 
+      class="absolute top-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      top-left
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute top-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-left</fwb-indicator>
<fwb-indicator
class="absolute top-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
top-left
</fwb-indicator>
Tools
GitHub Check: lint (18.x)

[warning] 3-3:
'type' should be on a new line


[warning] 3-3:
Expected 1 line break after opening tag (<fwb-indicator>), but no line breaks found


[warning] 3-3:
Expected 1 line break before closing tag (</fwb-indicator>), but no line breaks found

<fwb-indicator class="absolute top-0 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-center</fwb-indicator>

Check warning on line 4 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'type' should be on a new line

Check warning on line 4 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Expected 1 line break after opening tag (`<fwb-indicator>`), but no line breaks found

Check warning on line 4 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

Expected 1 line break before closing tag (`</fwb-indicator>`), but no line breaks found
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute top-0 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-center</fwb-indicator>
+    <fwb-indicator 
+      class="absolute top-0 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      top-center
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute top-0 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-center</fwb-indicator>
<fwb-indicator
class="absolute top-0 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
top-center
</fwb-indicator>
Tools
GitHub Check: lint (18.x)

[warning] 4-4:
'type' should be on a new line


[warning] 4-4:
Expected 1 line break after opening tag (<fwb-indicator>), but no line breaks found


[warning] 4-4:
Expected 1 line break before closing tag (</fwb-indicator>), but no line breaks found

<fwb-indicator class="absolute top-0 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-right</fwb-indicator>

Check warning on line 5 in docs/components/indicator/examples/FwbIndicatorPositionExample.vue

View workflow job for this annotation

GitHub Actions / lint (18.x)

'type' should be on a new line
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute top-0 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-right</fwb-indicator>
+    <fwb-indicator 
+      class="absolute top-0 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      top-right
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute top-0 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">top-right</fwb-indicator>
<fwb-indicator
class="absolute top-0 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
top-right
</fwb-indicator>
Tools
GitHub Check: lint (18.x)

[warning] 5-5:
'type' should be on a new line

<fwb-indicator class="absolute top-1/2 left-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-left</fwb-indicator>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute top-1/2 left-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-left</fwb-indicator>
+    <fwb-indicator 
+      class="absolute top-1/2 left-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      middle-left
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute top-1/2 left-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-left</fwb-indicator>
<fwb-indicator
class="absolute top-1/2 left-0 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
middle-left
</fwb-indicator>

<fwb-indicator class="absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-center</fwb-indicator>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-center</fwb-indicator>
+    <fwb-indicator 
+      class="absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      middle-center
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-center</fwb-indicator>
<fwb-indicator
class="absolute top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
middle-center
</fwb-indicator>

<fwb-indicator class="absolute top-1/2 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-right</fwb-indicator>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute top-1/2 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-right</fwb-indicator>
+    <fwb-indicator 
+      class="absolute top-1/2 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      middle-right
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute top-1/2 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">middle-right</fwb-indicator>
<fwb-indicator
class="absolute top-1/2 right-0 -translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
middle-right
</fwb-indicator>

<fwb-indicator class="absolute bottom-0 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-left</fwb-indicator>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute bottom-0 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-left</fwb-indicator>
+    <fwb-indicator 
+      class="absolute bottom-0 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      bottom-left
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute bottom-0 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-left</fwb-indicator>
<fwb-indicator
class="absolute bottom-0 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
bottom-left
</fwb-indicator>

<fwb-indicator class="absolute bottom-0 left-1/2 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-center</fwb-indicator>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute bottom-0 left-1/2 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-center</fwb-indicator>
+    <fwb-indicator 
+      class="absolute bottom-0 left-1/2 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      bottom-center
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute bottom-0 left-1/2 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-center</fwb-indicator>
<fwb-indicator
class="absolute bottom-0 left-1/2 translate-y-1/2 -translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
bottom-center
</fwb-indicator>

<fwb-indicator class="absolute bottom-0 right-0 translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-right</fwb-indicator>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting issues.

The type attribute should be on a new line, and there should be line breaks after the opening tag and before the closing tag.

-    <fwb-indicator class="absolute bottom-0 right-0 translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-right</fwb-indicator>
+    <fwb-indicator 
+      class="absolute bottom-0 right-0 translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" 
+      type="blue"
+    >
+      bottom-right
+    </fwb-indicator>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<fwb-indicator class="absolute bottom-0 right-0 translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white" type="blue">bottom-right</fwb-indicator>
<fwb-indicator
class="absolute bottom-0 right-0 translate-y-1/2 translate-x-1/2 text-xs w-auto px-2 h-4 text-white"
type="blue"
>
bottom-right
</fwb-indicator>

</div>
</template>

<script setup lang="ts">
import { FwbIndicator } from '../../../../src/index'

</script>
42 changes: 42 additions & 0 deletions src/components/FwbIndicator/FwbIndicator.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<template>
<span :class="indicatorClasses">
<slot></slot>
</span>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import { useMergeClasses } from '@/composables/useMergeClasses'

type IndıcatorType = 'default' | 'dark' | 'blue' | 'green' | 'red' | 'indigo' | 'purple' | 'yellow' | 'teal'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix typo in type definition.

The type definition IndıcatorType has a typo. It should be IndicatorType.

-type IndıcatorType = 'default' | 'dark' | 'blue' | 'green' | 'red' | 'indigo' | 'purple' | 'yellow' | 'teal'
+type IndicatorType = 'default' | 'dark' | 'blue' | 'green' | 'red' | 'indigo' | 'purple' | 'yellow' | 'teal'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
type IndıcatorType = 'default' | 'dark' | 'blue' | 'green' | 'red' | 'indigo' | 'purple' | 'yellow' | 'teal'
type IndicatorType = 'default' | 'dark' | 'blue' | 'green' | 'red' | 'indigo' | 'purple' | 'yellow' | 'teal'


interface IIndicatorProps {
type?: IndıcatorType
class?: string
}

const props = withDefaults(defineProps<IIndicatorProps>(), {
type: 'default',
class: '',
})

const defaultIndicatorClasses = 'w-3 h-3 rounded-full'
const indicatorTypeClasses = {
default: 'bg-gray-200',
dark: 'bg-gray-900 dark:bg-gray-700',
blue: 'bg-blue-600',
green: 'bg-green-500',
red: 'bg-red-500',
indigo: 'bg-indigo-500',
purple: 'bg-purple-500',
yellow: 'bg-yellow-300',
teal: 'bg-teal-500',
}

const indicatorClasses = computed(() => useMergeClasses([
defaultIndicatorClasses,
indicatorTypeClasses[props.type],
props.class,
]))

</script>
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export { default as FwbFooterCopyright } from './components/FwbFooter/FwbFooterC
export { default as FwbFooterIcon } from './components/FwbFooter/FwbFooterIcon.vue'
export { default as FwbFooterLink } from './components/FwbFooter/FwbFooterLink.vue'
export { default as FwbFooterLinkGroup } from './components/FwbFooter/FwbFooterLinkGroup.vue'
export { default as FwbIndicator } from './components/FwbIndicator/FwbIndicator.vue'
export { default as FwbJumbotron } from './components/FwbJumbotron/FwbJumbotron.vue'
export { default as FwbListGroup } from './components/FwbListGroup/FwbListGroup.vue'
export { default as FwbListGroupItem } from './components/FwbListGroup/FwbListGroupItem.vue'
Expand Down
Loading