Add accent property to CollapsiblePanel component#4488
Add accent property to CollapsiblePanel component#4488IvanIlyichev merged 2 commits intoshesha-io:releases/0.43from
Conversation
- Introduced a new `accent` boolean property to control the visibility of primary colored borders in the CollapsiblePanel. - Updated related components and interfaces to support the new property. - Enhanced settings form to include an option for the `accent` property, improving customization capabilities.
WalkthroughAdds an optional Changes
Sequence Diagram(s)sequenceDiagram
participant Designer as Designer Component
participant Model as Serialized Model
participant Collapsible as CollapsiblePanel
participant Styled as StyledCollapse / Styles
Designer->>Model: read/write `accent` (migration seeds default)
Model-->>Designer: provides `accent` value
Designer->>Collapsible: render with props including `accent`
Collapsible->>Styled: forward `accent` and `panelHeadType`
Styled->>Collapsible: compute borders (top/left) based on `panelHeadType && accent`
Collapsible-->>Designer: rendered panel (borders visible or hidden)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
shesha-reactjs/src/components/panel/index.tsx (1)
45-46: 🧹 Nitpick | 🔵 TrivialPre-existing
anytype onStyledCollapse.The
StyledCollapseis typed asany, which circumvents TypeScript's type checking. While this pre-dates this PR, consider addressing it in a follow-up to align with the coding guideline to eliminateanytypes.
🤖 Fix all issues with AI agents
In `@shesha-reactjs/src/components/panel/index.tsx`:
- Around line 50-51: The border template strings for border-top and border-left
include an extra space between "solid" and the color variable; update the
conditional expressions that build the border value (the styled props using
primaryColor, panelHeadType, and accent) to use "3px solid ${primaryColor}" with
a single space (apply the change in both the border-top and border-left lines)
and re-run lint/format to ensure consistent spacing.
In `@shesha-reactjs/src/designer-components/collapsiblePanel/settingsForm.json`:
- Around line 173-183: The new checkbox object with id
"021adb3d-6fae-450b-afb5-0867e6a30d06" (propertyName "accent") is missing the
"version" property; add "version": 1 to that JSON object to match other
checkboxes in the settings form (use the same numeric version used elsewhere,
e.g., 1) so the schema remains consistent for future migrations and processing.
shesha-reactjs/src/designer-components/collapsiblePanel/settingsForm.json
Show resolved
Hide resolved
- Refined border styling in the StyledCollapse component for better visual consistency. - Added a version field to the settings form for the CollapsiblePanel, enhancing configuration tracking.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
shesha-reactjs/src/components/panel/index.tsx (1)
86-109:⚠️ Potential issue | 🟠 MajorDefault
accentto preserve existing border rendering.
Withaccentundefined, the new gating makes borders disappear for existing callers that don’t pass the prop. That’s a backwards-compatibility UI change. Consider defaultingaccenttotrue(or treatingundefinedastrue).✅ Suggested fix
export const CollapsiblePanel: FC<Omit<ICollapsiblePanelProps, 'radiusLeft' | 'radiusRight'>> = ({ @@ - accent, + accent = true, }) => {
#4487
accentboolean property to control the visibility of primary colored borders in the CollapsiblePanel.accentproperty, improving customization capabilities.Summary by CodeRabbit