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

Conversation

ogzcode
Copy link
Contributor

@ogzcode ogzcode commented Aug 2, 2024

Hi,
I completed the issue opened for the Indicator component. #209

Details:

  1. The component was coded according to the style codes found in Flowbite.
  2. Documentation file has been created for the component.
  3. Examples have been added for the component doc file. I only added examples for type and alignment, I can update them if there are any missing examples.

I hope it turned out the way you wanted. I'll be waiting for your feedback. Good luck

@Sqrcz @cogor @zoltanszogyenyi @robert1508

Summary by CodeRabbit

  • New Features

    • Introduced the FwbIndicator component for customizable visual indicators, supporting multiple color themes.
    • Added documentation for the FwbIndicator component and examples demonstrating different use cases.
    • Included the FwbIndicatorPositionExample component to showcase positioning variations for indicators.
  • Bug Fixes

    • Enhanced component documentation to ensure clarity and usability for developers.
  • Documentation

    • Comprehensive guides created for the new FwbIndicator component and its examples.

The FwbIndicator component is added to provide a customizable indicator element. It accepts a type prop to specify the indicator color and a class prop for additional styling. The component uses computed properties and the useMergeClasses composable to generate the appropriate CSS classes based on the props.

Note: This commit message follows the established convention of using a prefix (feat) to indicate a new feature or component being added.
This commit adds the Vue Indicator component, which allows for the creation of customizable indicators with different colors and positions. The component is implemented using Vue.js and Tailwind CSS, and it provides examples for default indicators and indicator positions. This addition enhances the functionality and visual appeal of the application.

Note: This commit message follows the established convention of using a prefix (feat) to indicate a new feature or component being added.
This commit adds the FwbIndicator component, which provides a customizable indicator element. It accepts a type prop to specify the indicator color and a class prop for additional styling. The component is implemented using Vue.js and Tailwind CSS, and it enhances the functionality and visual appeal of the application.

Note: This commit message follows the established convention of using a prefix (feat) to indicate a new feature or component being added.
Copy link

coderabbitai bot commented Aug 2, 2024

Important

Review skipped

Auto reviews are limited to specific labels.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces the new FwbIndicator component to enhance the visual representation of information in applications. Accompanied by comprehensive documentation and examples, developers can easily implement various indicators with different styles and positions. The changes facilitate better UI flexibility, enabling users to effectively convey statuses and counts within their applications.

Changes

Files Change Summary
docs/.vitepress/config.mts Added "Indicator" to the getComponents function, expanding available components for reference.
docs/components/indicator.md Created documentation for the FwbIndicator component, detailing usage and examples.
docs/components/indicator/examples/*.vue Introduced examples showcasing FwbIndicator in different colors and positions for clear implementation guidance.
src/components/FwbIndicator/FwbIndicator.vue Added FwbIndicator component with customizable styles based on types defined in IIndicatorProps.
src/index.ts Exported FwbIndicator from the main index file for improved accessibility in imports.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant FwbIndicator

    User->>App: Requests status indicator
    App->>FwbIndicator: Render indicator with type
    FwbIndicator-->>App: Return styled indicator
    App-->>User: Display indicator
Loading

🐇 In a meadow bright and fair,
A new indicator's in the air!
Colors dance, and statuses twirl,
Come see the magic, give it a whirl!
With styles and grace, it shines so fine,
Hop along, dear friends, it's indicator time! 🌈✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Aug 2, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit e3a64a5
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/66aceab30562bf00080fcd96
😎 Deploy Preview https://deploy-preview-314--sensational-seahorse-8635f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 12

Outside diff range, codebase verification and nitpick comments (1)
docs/components/indicator.md (1)

6-8: Fix heading level.

The heading level should increment by one level at a time. Change the h4 to h2.

- #### 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
+ ## 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
Tools
Markdownlint

8-8: Expected: h2; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3ba50d7 and e3a64a5.

Files selected for processing (6)
  • docs/.vitepress/config.mts (1 hunks)
  • docs/components/indicator.md (1 hunks)
  • docs/components/indicator/examples/FwbIndicatorExample.vue (1 hunks)
  • docs/components/indicator/examples/FwbIndicatorPositionExample.vue (1 hunks)
  • src/components/FwbIndicator/FwbIndicator.vue (1 hunks)
  • src/index.ts (1 hunks)
Files skipped from review due to trivial changes (2)
  • docs/.vitepress/config.mts
  • src/index.ts
Additional context used
GitHub Check: lint (18.x)
docs/components/indicator/examples/FwbIndicatorExample.vue

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


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

docs/components/indicator/examples/FwbIndicatorPositionExample.vue

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


[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


[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


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

Markdownlint
docs/components/indicator.md

8-8: Expected: h2; Actual: h4
Heading levels should only increment by one level at a time

(MD001, heading-increment)

Additional comments not posted (9)
docs/components/indicator/examples/FwbIndicatorExample.vue (1)

15-18: LGTM!

The script section is straightforward and doesn't have any issues.

src/components/FwbIndicator/FwbIndicator.vue (2)

1-5: LGTM!

The template section is straightforward and doesn't have any issues.


36-40: LGTM!

The computed property is well-structured and doesn't have any issues.

docs/components/indicator/examples/FwbIndicatorPositionExample.vue (1)

15-18: LGTM!

The script section is straightforward and doesn't have any issues.

docs/components/indicator.md (5)

1-4: LGTM!

The imports and script setup are correct and necessary for the documentation examples.


12-14: LGTM!

The tip section is clear and the reference link is correct.


16-18: LGTM!

The description of the indicator component is clear and provides accurate information.


20-37: LGTM!

The default indicator example is clear and the code is correct.


39-60: LGTM!

The indicator position example is clear and the code is correct.

<fwb-indicator type="purple" />
<fwb-indicator type="yellow" />
<fwb-indicator type="teal" />
</div>
Copy link

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

@@ -0,0 +1,18 @@
<template>
<div class="vp-raw flex gap-4">
Copy link

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

import { computed } from 'vue'
import { useMergeClasses } from '@/composables/useMergeClasses'

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

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'

@@ -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">
<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>
Copy link

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-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>
Copy link

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 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>
Copy link

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 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>
Copy link

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>

<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>
Copy link

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>

<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">
<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>
Copy link

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

<div class="relative w-56 h-56 bg-gray-100 border border-gray-200 rounded-lg dark:bg-gray-800 dark:border-gray-700">
<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>
Copy link

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

@Sqrcz Sqrcz linked an issue Aug 2, 2024 that may be closed by this pull request
@Sqrcz Sqrcz self-assigned this Aug 2, 2024
@Sqrcz Sqrcz added 🔧 enhancement New feature or request 📦 new component New component implementation labels Aug 2, 2024
@Sqrcz
Copy link
Collaborator

Sqrcz commented Aug 2, 2024

@ogzcode

This one is a bit tricky... 🙈

We already have status and total props for avatars doing this thing... we're missing something like that for buttons... but indicator as component on it's own... I'm not sure if it's needed... maybe as an internal component that we can use in avatars, buttons and other things that need that kind of feature.

Another thing that makes this component "hard" to use is that it can't influence it's parent CSS position setting... so it would require adding class="relative" to every parent of that... and even then... it may not be exactly what user needs as parent's slot may not be the same as the outer tag with added class.

It may be OK in pure HTML/CSS components library... but in library of dynamic components... it may be batter as part of "bigger things" rather on it's own.

Before moving on with the review and potential code changes....

Please convince me that this component makes sense on it's own... ;) especially by giving examples of use with different components.... because now adding this to a button or an avatar is not working as expected and I'm not sure how do you see it being used.

@ogzcode
Copy link
Contributor Author

ogzcode commented Aug 6, 2024

@Sqrcz

This component is not meaningful on its own, I agree with you on this issue. Also, having to have relative content in the parent component and requiring extra code for positioning is not good for developer experience.

But if used in another situation, it can reduce code duplication. And it allows the developer to have a more accessible component.

So the user does not have to copy and paste the following code every time and the code base becomes more readable.

<span class="flex w-3 h-3 me-3 bg-blue-600 rounded-full"></span>

I can also style the component required for placement through a props, but this may also restrict the user.

Example:

<fwb-indicator position="top" type="green" />

These are what come to my mind right now. I can't give more detailed examples :) because this is a small component.

I opened this PR because the issue was also open. If you don't think it's necessary, I can turn it off.

Thank you for your feedback. I will be waiting for your reply. Have a nice day.

@Sqrcz
Copy link
Collaborator

Sqrcz commented Aug 6, 2024

Hey,

Yes... it will be hard to use on it's own... we could refactor avatars and buttons to use this internally but I'm not sure if it's worth the effort for now.

I've taken over maintaining this project only recently... ant there are a lot of outdated things that I need to clean.

If you want to pick something to help... there is a long list of things that we can improve: #236 ;)

Thank you for your input 🙏

@ogzcode
Copy link
Contributor Author

ogzcode commented Aug 6, 2024

Then we need to think a little more about this component. I won't close PR, maybe someone will need it.

I'll take a look at #236 and would be happy to contribute. Thank you, have a nice day

@Sqrcz Sqrcz marked this pull request as draft August 6, 2024 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 enhancement New feature or request 📦 new component New component implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

component: Indicator
2 participants