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

Feature: Title and description for tabs #3442

Merged
merged 12 commits into from
Dec 2, 2024

Conversation

Nevelito
Copy link
Contributor

@Nevelito Nevelito commented Nov 19, 2024

Description

  • Refactor tab_groups to have title and description

Fixes #3421

image

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Copy link

codeclimate bot commented Nov 19, 2024

Code Climate has analyzed commit 19ed23c and detected 0 issues on this pull request.

View more on Code Climate.

@Nevelito
Copy link
Contributor Author

I think I mede it as I should, but I do not know what can I put into title and description of tabs. Also I don't know why tab_group_component_spec and tab_swicher_component_spec are empty.

@Paul-Bob Paul-Bob added the Enhancement Not necessarily a feature, but something has improved label Nov 19, 2024
Copy link
Contributor

@Paul-Bob Paul-Bob left a comment

Choose a reason for hiding this comment

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

Looking good already, @Nevelito. Thank you!

Let's make two minor changes:

  1. Use the instance variable directly in the component instead of defining a public reader. Instance variable access is faster than reader access.
  2. In the tab header component, let's add the def render? method, and inside it, define the logic as (@title || @description).present?. This way, we avoid rendering an empty div if there is neither a title nor a description.

Otherwise, it's looking good! 👍

@Nevelito Nevelito requested a review from Paul-Bob November 20, 2024 08:45
Copy link
Contributor

@Paul-Bob Paul-Bob left a comment

Choose a reason for hiding this comment

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

While manually testing this I noticed something, title and description would look nicer outside of the tabs border:

image

And let's try to extract the header section from app/components/avo/panel_component.html.erb and reuse it for tabs instead of creating a new component.

@Nevelito Nevelito requested a review from Paul-Bob November 21, 2024 08:34
Copy link
Contributor

@Paul-Bob Paul-Bob left a comment

Choose a reason for hiding this comment

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

Seems a bit to much to render the whole Avo::PanelComponent when we only want to render the header section. Le'ts create a new component, extract the header section into that component and use the new Avo::PanelHeaderComponent

@Nevelito Nevelito requested a review from Paul-Bob November 22, 2024 16:30
require "rails_helper"

RSpec.describe Avo::PanelHeaderComponent, type: :component do
# it "renders something useful" do
Copy link
Contributor

Choose a reason for hiding this comment

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

should we actually implement this spec?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should. Not sure why it's commented out.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of spec are made like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

Copy link
Contributor

Choose a reason for hiding this comment

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

should we actually implement this spec?

Not really, it was generated while generating the component

I think we should. Not sure why it's commented out.

It was generated during the component generation, we don't implement component tests yet so it can be removed for this PR

Copy link
Contributor

@Paul-Bob Paul-Bob left a comment

Choose a reason for hiding this comment

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

Thank you @Nevelito! It's looking good!

I've made some minor commits to complete this PR and include it in tomorrow's release.

@Paul-Bob Paul-Bob merged commit 5dec5c0 into avo-hq:main Dec 2, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Not necessarily a feature, but something has improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Title and description for tabs
4 participants