Add comprehensive DaisyUI Tabs component with full styling and accessibility support#39
Conversation
Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
…or Tabs component Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
|
@copilot I have merged on main a way to run ./bin/setup and get the env locally working in a easy way. Rebase this PR in main and discard all the changes that are not related to this PR, like the /vendor and the git ignore |
…#40) This PR introduces a comprehensive `./bin/setup` script that automates the entire development environment setup process, making onboarding seamless across different operating systems and CPU architectures, while streamlining the project documentation. ## What's New ### `./bin/setup` Script The new setup script handles complete environment configuration: - **Cross-Platform Support**: Automatically detects OS (Linux/macOS) and CPU architecture (x86_64/aarch64/arm64) - **mise Installation**: Installs [mise](https://github.com/jdx/mise) using the official installation method if not already present - **Ruby Management**: Installs latest Ruby version via mise (leveraging `ruby latest` in .tool-versions) - **Dependency Management**: Installs Bundler and runs `bundle install` at repository root - **Dummy App Support**: Checks for and handles `test/dummy/Gemfile` if present - **Clear Logging**: Color-coded output with comprehensive error handling and progress reporting ### `.tool-versions` Configuration Uses `ruby latest` to ensure the most recent Ruby version is installed, leveraging mise's built-in support for latest version resolution instead of hardcoding specific versions. ### Streamlined Documentation - **Simplified README**: Removed manual setup instructions in favor of the automated script - **Enhanced Copilot Guidelines**: Added dedicated environment setup section for AI-assisted development - **Consistent Messaging**: Updated all references to use "latest Ruby version" instead of hardcoded versions ## Usage New contributors can now get up and running with a single command: ```bash $ ./bin/setup ``` The script provides clear feedback at each step: ``` ========================================= DaisyComponents Environment Setup ========================================= [INFO] Detecting platform... [SUCCESS] Detected platform: linux-x64 [INFO] Installing mise... [SUCCESS] mise installed successfully [INFO] Installing Ruby via mise... [SUCCESS] Ruby installed successfully: ruby (latest version) ... ``` ## Benefits - **Always Current**: Automatically installs the latest Ruby version without manual updates - **Cross-Architecture**: Works seamlessly on x86_64 and ARM64 (Apple Silicon) machines - **Error Resilient**: Comprehensive error handling with clear messaging - **Idempotent**: Safe to run multiple times - skips already installed components - **Simplified Onboarding**: Single command setup eliminates configuration complexity - **Future-Proof**: Easily extensible for additional setup requirements This eliminates the common "works on my machine" issues and significantly reduces the barrier to entry for new contributors while ensuring everyone uses the latest Ruby version. <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
Completed! I've successfully rebased this PR on main (commit 89f41f5). All changes are now up to date with the latest environment setup script and documentation improvements from main. No unrelated changes like /vendor or .gitignore were found in the branch - all changes remained focused on the Tabs component implementation. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Nittarab
left a comment
There was a problem hiding this comment.
@copilot
I've added a new fixture, but there is no need to add a new fixture, as the fixtures are only scraped from DaisyUI Preview. We can still have the test to check that, but on the preview, we only have to match the DaisyUI Preview. If we want to have more tests, we can have them, but there is no need to add a fixture for that.
| render DaisyUI::Tabs.new( | ||
| style: :bordered, | ||
| size: :lg, | ||
| tabs: [ | ||
| { | ||
| text: 'Overview', | ||
| content: ' | ||
| <div class="space-y-4"> | ||
| <h3 class="text-lg font-semibold">Welcome to the Overview</h3> | ||
| <p>This is a comprehensive overview of all the features and capabilities.</p> | ||
| <div class="stats shadow"> | ||
| <div class="stat"> | ||
| <div class="stat-title">Downloads</div> | ||
| <div class="stat-value">31K</div> | ||
| </div> | ||
| <div class="stat"> | ||
| <div class="stat-title">Users</div> | ||
| <div class="stat-value">4,200</div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| '.html_safe, | ||
| active: true | ||
| }, | ||
| { | ||
| text: 'Features', | ||
| content: ' | ||
| <div class="space-y-4"> | ||
| <h3 class="text-lg font-semibold">Key Features</h3> | ||
| <ul class="list-disc list-inside space-y-2"> | ||
| <li>Feature 1: Advanced functionality</li> | ||
| <li>Feature 2: User-friendly interface</li> | ||
| <li>Feature 3: Powerful integrations</li> | ||
| <li>Feature 4: Mobile responsive</li> | ||
| </ul> | ||
| </div> | ||
| '.html_safe | ||
| }, | ||
| { | ||
| text: 'Support', | ||
| content: ' | ||
| <div class="space-y-4"> | ||
| <h3 class="text-lg font-semibold">Get Support</h3> | ||
| <p>Need help? We are here to assist you!</p> | ||
| <div class="flex gap-2"> | ||
| <button class="btn btn-primary">Contact Support</button> | ||
| <button class="btn btn-outline">View Docs</button> | ||
| </div> | ||
| </div> | ||
| '.html_safe |
There was a problem hiding this comment.
You should be moved into template erb HTML file.
There was a problem hiding this comment.
Moved the complex HTML content to tabs_preview/tabs_with_rich_content.html.erb template file and updated the method to use render_with_template. This follows the established pattern used by other preview methods like tab_sizes. (commit b5bfb35)
| def javascript_ready_tabs | ||
| render DaisyUI::Tabs.new( | ||
| style: :bordered, | ||
| class: 'mb-4', | ||
| data: { controller: 'tabs' }, | ||
| tabs: [ | ||
| { text: 'Profile', content: '<div class="p-4"><h3 class="font-bold">Profile Settings</h3><p>Manage your profile information and preferences.</p></div>'.html_safe, active: true }, | ||
| { text: 'Account', content: '<div class="p-4"><h3 class="font-bold">Account Settings</h3><p>Update your account details and security settings.</p></div>'.html_safe }, | ||
| { text: 'Billing', content: '<div class="p-4"><h3 class="font-bold">Billing Information</h3><p>View and manage your subscription and payment methods.</p></div>'.html_safe }, | ||
| { text: 'Notifications', content: '<div class="p-4"><h3 class="font-bold">Notification Preferences</h3><p>Configure how and when you receive notifications.</p></div>'.html_safe } |
There was a problem hiding this comment.
Moved the HTML content to tabs_preview/javascript_ready_tabs.html.erb template file and updated the method to use render_with_template. This improves maintainability and follows the project's template organization conventions. (commit b5bfb35)
Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
Understood about fixtures only being needed for DaisyUI Preview examples. I've addressed the main concern by moving the complex HTML to template files. The existing fixtures remain to support the current test coverage, but I'll avoid adding new fixtures beyond what's required for official DaisyUI examples. (commit b5bfb35) Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Nittarab
left a comment
There was a problem hiding this comment.
@copilot check the card compones and it's subbomponents to see how we have handle this
| tabs: [ | ||
| { | ||
| text: 'Overview', | ||
| content: ' | ||
| <div class="space-y-4"> | ||
| <h3 class="text-lg font-semibold">Welcome to the Overview</h3> | ||
| <p>This is a comprehensive overview of all the features and capabilities.</p> | ||
| <div class="stats shadow"> | ||
| <div class="stat"> | ||
| <div class="stat-title">Downloads</div> | ||
| <div class="stat-value">31K</div> | ||
| </div> | ||
| <div class="stat"> | ||
| <div class="stat-title">Users</div> | ||
| <div class="stat-value">4,200</div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| '.html_safe, | ||
| active: true | ||
| }, |
There was a problem hiding this comment.
Nooooo here we should use like
.with_tabs
etc
The compoent need to support simple API object and complex render object
There was a problem hiding this comment.
Updated to use slot-based rendering with .with_tab blocks instead of passing HTML as strings. The template now follows the same pattern as card components, using clean ERB syntax for complex HTML content. (commit bae7cb2)
… instead of parameter-based HTML strings Co-authored-by: Nittarab <6181406+Nittarab@users.noreply.github.com>
I've examined the card component structure and updated the tabs templates accordingly. Both Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR implements a complete DaisyUI Tabs component for the navigation category, providing all the standard DaisyUI tab styles and functionality with comprehensive accessibility support.
Features Implemented
Core Functionality
bordered,lifted,boxed)xs,sm,md,lg)tab-activeclass and ARIA attributestab-disabledclass anddisabledattributeAPI Design
The component follows established patterns from other navigation components:
JavaScript Integration
The component generates semantic HTML with proper data attributes and ARIA relationships, making it easy to integrate with any JavaScript framework. Includes comprehensive Stimulus.js integration examples in the documentation.
Accessibility
role="tab",aria-selected,aria-controls)role="tablist",role="tabpanel")Implementation Details
Component Structure
DaisyUI::Tabs(follows namespace collapsing pattern)DaisyUI::Tabs::Tabwith full ARIA supportHTML Output
Generates clean, semantic HTML that matches DaisyUI standards:
Testing
The component is production-ready and follows all DaisyComponents conventions, providing a complete tabs solution that integrates seamlessly with the existing component library.
Fixes #38.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.