Skip to content

fix:button group menu item height#3129

Merged
James-Baloyi merged 12 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/button-group
Apr 17, 2025
Merged

fix:button group menu item height#3129
James-Baloyi merged 12 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/button-group

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented Apr 7, 2025

Summary by CodeRabbit

  • Style

    • Enhanced button layout and visual presentation through improved alignment and theming.
    • Updated menu appearance with adaptive sizing and refined spacing.
    • Adjusted container styling for greater responsiveness with dynamic height and shadow options.
    • Reformatted style files for improved consistency and readability.
    • Improved hover effects and fixed CSS syntax errors for entity picker components.
  • New Features

    • Expanded customization options for background appearance with additional styling attributes.
    • Reorganized settings panel with updated labels and conditional field visibility for a cleaner configuration experience.
    • Introduced shadow effects for button components to enhance visual depth.
    • Added theme customization for menu item height to improve usability.
    • Added conditional rendering to settings inputs for better interface control.
    • Simplified dropdown data source options by removing URL-based choices.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2025

Walkthrough

This pull request updates multiple components in the project. In the button group configurator, a fragment wrapper is replaced with an Ant Design Flex component, and the configuration object is enhanced with additional background and shadow properties. Meanwhile, in several designer components, the Menu component is wrapped with a theme provider customizing item height, settings inputs are reorganized (renaming "Space Size" to "Gap"), default styles are extended with shadow properties and container height changes, and conditional rendering is introduced based on a model property. Additionally, an import consolidation was performed and CSS style files were reformatted. Minor CSS fixes and token-based theming were added to entity picker styles.

Changes

File(s) Summary
shesha-reactjs/src/components/buttonGroupConfigurator/buttonGroupItem.tsx
shesha-reactjs/src/components/buttonGroupConfigurator/utils.ts
Replaced fragment with Ant Design's Flex container to wrap elements; enhanced background configuration with new attributes and added a shadow property in the initial values.
shesha-reactjs/src/designer-components/button/buttonGroup/buttonGroup.tsx
shesha-reactjs/src/designer-components/button/buttonGroup/settingsForm.ts
shesha-reactjs/src/designer-components/button/buttonGroup/utils.tsx
Extended inline styles with spread of jsStyle; updated Menu component CSS classes; reorganized settings inputs (renaming "Space Size" to "Gap" and moving it under Appearance tab); added shadow properties to default styles; changed container height from '32px' to 'auto'.
shesha-reactjs/src/providers/theme/index.tsx Added theme customization for Menu component's item height via CSS variable in themeConfig.
shesha-reactjs/src/designer-components/button/configurableButton/index.tsx Consolidated the CSSProperties import with the existing React import, maintaining functionality.
shesha-reactjs/src/designer-components/settingsInput/index.tsx Introduced conditional rendering in the Factory function to skip rendering the component when the model.hidden property is true.
shesha-reactjs/src/designer-components/button/buttonGroup/styles/styles.ts Reformatted CSS-in-JS style constants and template literals with consistent two-space indentation and spacing; no logic or style changes.
shesha-reactjs/src/components/entityPicker/styles/styles.ts Added token parameter for theming; fixed CSS hover selector syntax; updated hover border colors to use token primary color with !important; minor whitespace cleanup.
shesha-reactjs/src/designer-components/dropdown/settingsForm.ts Removed "url" option from "dataSourceType" dropdown and eliminated the corresponding conditional input field for "dataSourceUrl". Added a new "ignoredValues" textArea input for specifying values to ignore.

Sequence Diagram(s)

sequenceDiagram
    participant BG as ButtonGroupInner
    participant CP as ConfigProvider
    participant M as Menu

    BG->>CP: Wrap Menu with theme configuration
    CP->>M: Render Menu with itemHeight CSS variable
Loading
sequenceDiagram
    participant SI as SettingsInput.Factory
    participant M as Model

    SI->>M: Evaluate model.hidden
    alt Hidden is true
        SI->>SI: Return null (skip rendering)
    else Hidden is false
        SI->>SI: Render SettingInput with props
    end
Loading

Possibly related PRs

  • Thulasizwe/en/file list #3121: Introduced similar styling enhancements with the justifyContent property in the ButtonGroupItem component, related to the updated theming configurations in this PR.
  • fix: addressed label issues #3161: Modified dropdown settings form inputs including removal of the "url" option, related to the dropdown settings form changes in this PR.

Suggested reviewers

  • James-Baloyi

Poem

I’m a rabbit in the code field, so spry,
Hopping through changes with a twinkle in my eye.
Flex and shadows add a touch of art,
While settings now have a brand new start.
Cheers to clean code in every part!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3682836 and 9a6bd6d.

📒 Files selected for processing (1)
  • shesha-reactjs/src/designer-components/dropdown/settingsForm.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/designer-components/dropdown/settingsForm.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt

🪧 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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@czwe-01 czwe-01 requested a review from James-Baloyi April 7, 2025 05:25
@czwe-01 czwe-01 requested a review from AlexStepantsov April 10, 2025 09:45
Copy link
Copy Markdown
Contributor

@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

🧹 Nitpick comments (2)
shesha-reactjs/src/providers/theme/index.tsx (2)

57-61: Consider using proper TypeScript types instead of any.

While the menu item height customization looks good, using as any is generally considered a code smell as it bypasses TypeScript's type checking. This could lead to potential issues if the API changes.

Consider using a more specific type or checking the Ant Design's theme typing documentation for the correct type for itemHeight.

- itemHeight: 'clamp(40px, 40px, 100%)' as any
+ itemHeight: 'clamp(40px, 40px, 100%)'

If TypeScript still complains about the type, check if there's a more specific type you can use or if there's a reason the string value needs a type conversion.


59-59: Review the CSS clamp function usage.

The current CSS clamp(40px, 40px, 100%) function has the minimum and preferred values set to the same value (40px). This makes the clamp function behave essentially as max(40px, 100%), which could be simplified.

If the intention is to have a fixed 40px height, consider using just 40px. If you want to allow flexibility, make sure the preferred value is different from the minimum.

For example:

- itemHeight: 'clamp(40px, 40px, 100%)' as any
+ itemHeight: '40px' as any

Or if you want flexibility between 40px and container height:

- itemHeight: 'clamp(40px, 40px, 100%)' as any
+ itemHeight: 'clamp(40px, 50px, 100%)' as any
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1a9e9c and 5a313a2.

📒 Files selected for processing (3)
  • shesha-reactjs/src/designer-components/button/buttonGroup/buttonGroup.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/button/buttonGroup/styles/styles.ts (3 hunks)
  • shesha-reactjs/src/providers/theme/index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • shesha-reactjs/src/designer-components/button/buttonGroup/buttonGroup.tsx
  • shesha-reactjs/src/designer-components/button/buttonGroup/styles/styles.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (1)
shesha-reactjs/src/providers/theme/index.tsx (1)

57-61: Good implementation of menu item height customization.

This change appropriately leverages Ant Design's theme customization system to set a consistent height for menu items. This aligns well with the PR objective to fix button group menu item height issues.

The approach of using theme customization rather than direct CSS overrides is cleaner and more maintainable, as it works with Ant Design's component API rather than fighting against it.

@czwe-01 czwe-01 removed the request for review from AlexStepantsov April 17, 2025 06:55
@James-Baloyi James-Baloyi merged commit 651a102 into shesha-io:main Apr 17, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants