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: Label added for FileInput dropzone #304

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ogzcode
Copy link
Contributor

@ogzcode ogzcode commented Jul 24, 2024

#292

Label was missing in FileInput's dropzone property, it was added

Summary by CodeRabbit

  • New Features

    • Improved layout of the file input component for better organization and usability.
    • Added a conditional label display to enhance user feedback within the drop zone.
  • Bug Fixes

    • Adjusted alignment to ensure a more intuitive experience for users interacting with file uploads.
  • Refactor

    • Streamlined the structure of the component's template and script sections for enhanced readability.
    • Compact formatting of input elements and SVG attributes for cleaner markup.

Copy link

coderabbitai bot commented Jul 24, 2024

Walkthrough

The recent updates to the FwbFileInput component enhance its layout and user experience. By shifting to a vertical arrangement for the file input area, the design allows for better organization of elements. The addition of a conditional label further guides users, improving accessibility and usability. These changes reflect a commitment to creating a more intuitive interface for file uploads.

Changes

Files Change Summary
src/components/FwbFileInput/FwbFileInput.vue Modified layout to vertical alignment in the file input area, added a conditional label for improved user guidance, and streamlined the script for better readability.

Poem

In the file input, a change so bright,
Vertical stacks make everything right.
A label appears, a friendly embrace,
Guiding the users with style and grace.
Hoppy and happy, we cheer with delight,
For a smoother journey, both easy and bright! 🐇✨


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 Jul 24, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit 08ca958
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/66ac8b4aeb80dd0008823e03
😎 Deploy Preview https://deploy-preview-304--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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a0f04ed and 0ee8e66.

Files selected for processing (1)
  • src/components/FwbFileInput/FwbFileInput.vue (1 hunks)
Additional comments not posted (2)
src/components/FwbFileInput/FwbFileInput.vue (2)

18-18: LGTM! Verify the overall layout.

The change from flex items-center justify-center to flex flex-col items-start justify-center shifts the layout from horizontal to vertical alignment. This can improve the organization of elements within the dropzone. Ensure that this change does not negatively impact the overall layout and user experience.


23-23: LGTM! Verify the conditional rendering.

The addition of the <span> element to conditionally render based on the presence of a label prop improves the component's usability by providing a visual cue for users regarding the expected input. Ensure that the conditional rendering works correctly and does not cause any issues.

@cogor cogor added 🔧 enhancement New feature or request ✨ good first issue Good for newcomers labels Jul 29, 2024
Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

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

Please fix linter issues... 🙏

@zoltanszogyenyi would like to know your opinion on this one...

Flowbite's dropzone also has no Label...

The way it is proposed in this PR (outside of <label> tag) could be accepted for now as a temporary solution but it's not perfect in terms of UX/Accessibility. Is there a chance to update Original Flowbite component to allow additional labels?

@change="handleChange"
@dragover="dragOverHandler"
@drop="dropFileHandler"
>
<span v-if="label !== ''" :class="labelClasses">{{ label }}</span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

please fix code style according to linter (npm run lint)

/src/components/FwbFileInput/FwbFileInput.vue
  23:1   warning  Expected indentation of 6 spaces but found 4 spaces   vue/html-indent
  23:31  warning  ':class' should be on a new line                      vue/max-attributes-per-line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did npm run format. Lint was giving too many errors.

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: 4

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0ee8e66 and 78ac82d.

Files selected for processing (1)
  • src/components/FwbFileInput/FwbFileInput.vue (5 hunks)
Additional context used
GitHub Check: lint (18.x)
src/components/FwbFileInput/FwbFileInput.vue

[warning] 6-6:
Disallow self-closing on HTML void elements ()


[warning] 6-6:
':multiple' should be on a new line


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


[warning] 6-6:
':accept' should be on a new line


[warning] 6-6:
'@change' should be on a new line


[warning] 10-10:
'class' should be on a new line


[warning] 10-10:
'@change' should be on a new line


[warning] 10-10:
'@dragover' should be on a new line


[warning] 10-10:
'@drop' should be on a new line


[warning] 11-11:
':class' should be on a new line


[failure] 77-77:
Missing space before function parentheses


[failure] 80-80:
Missing space before function parentheses

Additional comments not posted (3)
src/components/FwbFileInput/FwbFileInput.vue (3)

14-14: LGTM!

The SVG element is correctly formatted and enhances the visual representation of the dropzone.


48-49: LGTM!

The additions to the FileInputProps interface are correct and enhance the component's functionality.


119-119: LGTM!

The usage of useFileInputClasses is correct and enhances the component's styling.

@drop="dropFileHandler"
>
<div v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler">
<span v-if="label !== ''" :class="labelClasses">{{ label }}</span>
Copy link

Choose a reason for hiding this comment

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

Format the span element attribute.

The attribute of the <span> element should be on a separate line for better readability and to conform to the project's style guide.

- <span v-if="label !== ''" :class="labelClasses">{{ label }}</span>
+ <span 
+  v-if="label !== ''" 
+  :class="labelClasses"
+ >
+  {{ label }}
+ </span>
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
<span v-if="label !== ''" :class="labelClasses">{{ label }}</span>
<span
v-if="label !== ''"
:class="labelClasses"
>
{{ label }}
</span>
Tools
GitHub Check: lint (18.x)

[warning] 11-11:
':class' should be on a new line

@dragover="dragOverHandler"
@drop="dropFileHandler"
>
<div v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler">
Copy link

Choose a reason for hiding this comment

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

Format the div element attributes.

The attributes of the <div> element should be on separate lines for better readability and to conform to the project's style guide.

- <div v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler">
+ <div 
+  v-else 
+  class="flex flex-col items-start justify-center" 
+  @change="handleChange" 
+  @dragover="dragOverHandler" 
+  @drop="dropFileHandler"
+ >
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 v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler">
<div
v-else
class="flex flex-col items-start justify-center"
@change="handleChange"
@dragover="dragOverHandler"
@drop="dropFileHandler"
>
Tools
GitHub Check: lint (18.x)

[warning] 10-10:
'class' should be on a new line


[warning] 10-10:
'@change' should be on a new line


[warning] 10-10:
'@dragover' should be on a new line


[warning] 10-10:
'@drop' should be on a new line

Comment on lines 77 to 80
get() {
return props.modelValue
},
set (val) {
set(val) {
Copy link

Choose a reason for hiding this comment

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

Add missing spaces before function parentheses.

There should be a space before the function parentheses for consistency and readability.

- get() {
+ get () {
- set(val) {
+ set (val) {
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
get() {
return props.modelValue
},
set (val) {
set(val) {
get () {
return props.modelValue
},
set (val) {
Tools
GitHub Check: lint (18.x)

[failure] 77-77:
Missing space before function parentheses


[failure] 80-80:
Missing space before function parentheses

:accept="accept"
@change="handleChange"
>
<input :class="fileInpClasses" :multiple="multiple" type="file" :accept="accept" @change="handleChange" />
Copy link

Choose a reason for hiding this comment

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

Format the input element attributes.

The attributes of the <input> element should be on separate lines for better readability and to conform to the project's style guide.

- <input :class="fileInpClasses" :multiple="multiple" type="file" :accept="accept" @change="handleChange" />
+ <input 
+  :class="fileInpClasses" 
+  :multiple="multiple" 
+  type="file" 
+  :accept="accept" 
+  @change="handleChange" 
+ />
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
<input :class="fileInpClasses" :multiple="multiple" type="file" :accept="accept" @change="handleChange" />
<input
:class="fileInpClasses"
:multiple="multiple"
type="file"
:accept="accept"
@change="handleChange"
/>
Tools
GitHub Check: lint (18.x)

[warning] 6-6:
Disallow self-closing on HTML void elements ()


[warning] 6-6:
':multiple' should be on a new line


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


[warning] 6-6:
':accept' should be on a new line


[warning] 6-6:
'@change' should be on a new line

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: 0

Outside diff range, codebase verification and nitpick comments (6)
src/components/FwbFileInput/FwbFileInput.vue (6)

6-6: Fix the input element formatting and self-closing tag.

The input element should not be self-closing, and its attributes should be on separate lines for better readability.

- <input :class="fileInpClasses" :multiple="multiple" type="file" :accept="accept" @change="handleChange" />
+ <input 
+  :class="fileInpClasses" 
+  :multiple="multiple" 
+  type="file" 
+  :accept="accept" 
+  @change="handleChange" 
+ >
Tools
GitHub Check: lint (18.x)

[warning] 6-6:
Disallow self-closing on HTML void elements ()


[warning] 6-6:
':multiple' should be on a new line


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


[warning] 6-6:
':accept' should be on a new line


[warning] 6-6:
'@change' should be on a new line


10-10: Fix the div element formatting.

The attributes of the div element should be on separate lines for better readability.

- <div v-else class="flex flex-col items-start justify-center" @change="handleChange" @dragover="dragOverHandler" @drop="dropFileHandler">
+ <div 
+  v-else 
+  class="flex flex-col items-start justify-center" 
+  @change="handleChange" 
+  @dragover="dragOverHandler" 
+  @drop="dropFileHandler"
+ >
Tools
GitHub Check: lint (18.x)

[warning] 10-10:
'class' should be on a new line


[warning] 10-10:
'@change' should be on a new line


[warning] 10-10:
'@dragover' should be on a new line


[warning] 10-10:
'@drop' should be on a new line


11-11: Fix the span element formatting.

The attributes of the span element should be on separate lines for better readability.

- <span v-if="label !== ''" :class="labelClasses">{{ label }}</span>
+ <span 
+  v-if="label !== ''" 
+  :class="labelClasses"
+ >
+  {{ label }}
+ </span>
Tools
GitHub Check: lint (18.x)

[warning] 11-11:
':class' should be on a new line


14-14: Format the svg element attributes.

For consistency, the attributes of the svg element should be on separate lines.

- <svg aria-hidden="true" class="w-8 h-8 text-gray-500 dark:text-gray-400" fill="none" viewBox="0 0 20 16" xmlns="http://www.w3.org/2000/svg">
+ <svg 
+  aria-hidden="true" 
+  class="w-8 h-8 text-gray-500 dark:text-gray-400" 
+  fill="none" 
+  viewBox="0 0 20 16" 
+  xmlns="http://www.w3.org/2000/svg"
+ >

32-32: Fix the hidden input element formatting and self-closing tag.

The hidden input element should not be self-closing, and its attributes should be on separate lines for better readability.

- <input :multiple="multiple" type="file" :accept="accept" class="hidden" />
+ <input 
+  :multiple="multiple" 
+  type="file" 
+  :accept="accept" 
+  class="hidden" 
+ >

119-119: Format the destructuring of class variables.

For consistency, the destructuring of class variables should be on separate lines.

- const { fileInpClasses, labelClasses, dropzoneLabelClasses, dropzoneWrapClasses, dropzoneTextClasses } = useFileInputClasses(props.size)
+ const { 
+  fileInpClasses, 
+  labelClasses, 
+  dropzoneLabelClasses, 
+  dropzoneWrapClasses, 
+  dropzoneTextClasses 
+ } = useFileInputClasses(props.size)
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 78ac82d and 08ca958.

Files selected for processing (1)
  • src/components/FwbFileInput/FwbFileInput.vue (4 hunks)
Additional context used
GitHub Check: lint (18.x)
src/components/FwbFileInput/FwbFileInput.vue

[warning] 6-6:
Disallow self-closing on HTML void elements ()


[warning] 6-6:
':multiple' should be on a new line


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


[warning] 6-6:
':accept' should be on a new line


[warning] 6-6:
'@change' should be on a new line


[warning] 10-10:
'class' should be on a new line


[warning] 10-10:
'@change' should be on a new line


[warning] 10-10:
'@dragover' should be on a new line


[warning] 10-10:
'@drop' should be on a new line


[warning] 11-11:
':class' should be on a new line

@ogzcode
Copy link
Contributor Author

ogzcode commented Aug 2, 2024

@Sqrcz
now you can control it.

@Sqrcz
Copy link
Collaborator

Sqrcz commented Aug 2, 2024

Ok, thank you.

@Sqrcz Sqrcz self-assigned this Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 enhancement New feature or request ✨ good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants