Skip to content

Fix/time period button styling#8

Merged
jdy8739 merged 2 commits intomainfrom
fix/time-period-button-styling
Dec 25, 2025
Merged

Fix/time period button styling#8
jdy8739 merged 2 commits intomainfrom
fix/time-period-button-styling

Conversation

@jdy8739
Copy link
Copy Markdown
Owner

@jdy8739 jdy8739 commented Dec 25, 2025

No description provided.

- Replace custom button styling with outline Button component
- Add clear primary border and text color for active state
- Apply consistent styling across story and goals sections
- Improve visual feedback for selected time period
- Add CSS variables for info, warning, and destructive colors
- Implement explicit color classes for all semantic states
- Increase feedback button gradient opacity (20%/5% → 40%/20%)
- Add thicker colored borders (border → border-2) for active state
- Upgrade shadow effect (shadow-md → shadow-lg) for better depth
- Use switch-case pattern to ensure Tailwind detects all color classes
- Simplify button focus styles by removing ring offset
@jdy8739 jdy8739 merged commit 64917b2 into main Dec 25, 2025
1 check passed
@jdy8739 jdy8739 deleted the fix/time-period-button-styling branch December 25, 2025 11:27
@claude
Copy link
Copy Markdown

claude bot commented Dec 25, 2025

Code Review - PR #8: Fix/time period button styling

Summary

This PR successfully consolidates button styling by replacing custom button implementations with the reusable Button component and adds missing CSS variable definitions for semantic state colors (info, warning, destructive). The changes improve consistency and maintainability.

Positive Aspects

  1. Consistency Improvement: Replacing custom buttons with the Button component in goals-section.tsx and story-generator.tsx ensures a consistent look and feel across the app
  2. Semantic CSS Variables: Adding info, warning, and destructive variables aligns with the CLAUDE.md theme rules requiring semantic CSS variables
  3. Reduced Code Duplication: The harshness selector refactor eliminates redundant color definitions by using CSS variables with utility classes

Code Quality Issues

1. Removed Focus Ring Accessibility (Critical)

File: components/atoms/button.tsx:20

Issue: Removing focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-background eliminates keyboard navigation visual feedback, breaking WCAG 2.1 accessibility standards.

Impact: Users navigating with keyboards (Tab key) won't see which button has focus, creating a poor UX for accessibility users.

Recommendation: Restore the focus ring classes in button.tsx baseClasses

2. Inconsistent Border Width in Story Generator

File: features/story/components/story-generator.tsx:351

The harshness selector buttons use border-2 while the period selector buttons use the default border width (1px via variant=outline).

Recommendation: For visual consistency, either use border-2 in both selectors, or remove border-2 from harshness buttons to match the default

3. Inline Conditional Functions Could Be Extracted

File: features/story/components/story-generator.tsx:313-342

The getActiveClasses() and getIconClasses() functions are defined inside the .map() callback, creating new function instances on every render. Performance impact is minimal for 4 buttons, but goes against React best practices.

Security Concerns

No security issues identified. The changes are purely presentational and don't affect authentication, data validation, CSRF protection, or input sanitization.

Test Coverage

Concern: No tests were added or modified in this PR.

Recommendations:

  1. Add visual regression tests (Storybook snapshots) for the Button component variants
  2. Test keyboard navigation focus states (especially after restoring focus ring)
  3. Add accessibility tests to verify focus indicators

Action Items

Must Fix (Blocking):

  • Restore focus ring classes in button.tsx for accessibility compliance

Should Fix (Recommended):

  • Ensure consistent border widths between harshness and period selectors
  • Add basic accessibility tests for keyboard navigation

Nice to Have:

  • Extract inline conditional functions to improve code readability
  • Audit codebase for hardcoded semantic colors and migrate to CSS variables

Overall Assessment

Rating: Approve with Changes Required

This PR makes good progress on UI consistency, but the removal of focus rings is a critical accessibility regression that must be addressed before merging. Once the focus ring is restored, this will be a solid improvement to the codebase.

Alignment with CLAUDE.md: Follows CSS variable rules, arrow function syntax, and component reuse patterns.

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.

1 participant