Skip to content

New feature for Counter Project: Add dark mode toggle, improve UI layout, and enhance accessibility - #84

Open
Jose-Renny wants to merge 3 commits into
sahandghavidel:mainfrom
Jose-Renny:main
Open

Jose-Renny wants to merge 3 commits into
sahandghavidel:mainfrom
Jose-Renny:main

Conversation

@Jose-Renny

Copy link
Copy Markdown

Summary:

This PR enhances the Counter Project by improving the UI design, adding a dark/light theme toggle, and introducing accessibility improvements

Changes Made:

  • Added dark mode toggle button
  • Implemented theme switching using CSS class toggling
  • Improved layout with centered card-style container
  • Added smooth visual transitions
  • Improved accessibility using ARIA atributes:
    - aria-live for counter updates
    - aria-labels for buttons
  • Loaded JavaScript using defer for better performance
  • Refactored JavaScript using an updateUI() function

Motivation:

These updates modernize the interface and improve usability and accessibility while maintaining the original functionality

Testing:

  • Increase, descrease, and reset button work correctly
  • Counter color updates based on value
  • Dark mode toggles correctly
  • Layout remains responsive

Here is the screeshots for comparing

Before:

before

After:

after

After (dark theme):

after (dark theme)
Wrapped counter elements in a centered 'container-box for a card-like layout
Added ARIA attributes: 'aria-live for counter updates and 'aria-label' for buttons
Updated Font Awesome icon classes from 'fa' to 'fas'
Added a dark mode toggle button for improved user experience
Cleaned up spacing and structure for readability
- Created a card style container with padding, rounded corners, and shadow
- Centered main content vertically and horizontally
- Added spacing between buttons for a clearer layout
- Implemented dark mode styles for body and container
- Added smooth transitions for background, text color, and counter updates
- Adjusted typography sizes for better visual hierarchy
- Moved counter update logicintoa reusable 'updateUI()' function
- Updated counter text color based on value and dark mode state
- Added event listener for dark mode toggle with immediate UI refresh
- Simplified clickhandling using modern ES6 syntax and arrow functions
- Improved readability and maintainability by centralizing logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant