Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Themetoggle and Improve Footer Text Visibility #422

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

AnushkaChouhan25
Copy link
Contributor

@AnushkaChouhan25 AnushkaChouhan25 commented Oct 28, 2024

Fix issue- #411 and #412

Improve Footer Text Visibility in Light Theme and Change the theme toggle button design.

image
image

Summary by CodeRabbit

  • New Features

    • Enhanced footer layout and styling for improved visual presentation.
    • Redesigned theme toggle component with new icons and animations for a more dynamic user experience.
    • Introduced a new slider element in the theme toggle for better interactivity.
    • Implemented dark mode styles for a cohesive visual experience.
  • Bug Fixes

    • Adjusted conditional rendering for logo display based on screen width.
  • Style

    • Updated CSS variables and styles for smoother transitions and modernized design elements.
    • Added a new CSS variable for transition duration to enhance visual feedback.

Copy link

vercel bot commented Oct 28, 2024

@AnushkaChouhan25 is attempting to deploy a commit to the bunty's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

Copy link
Contributor

coderabbitai bot commented Oct 28, 2024

Walkthrough

The changes in this pull request involve updates to three main files: Content.jsx, ThemeToggle.jsx, and index.css. The Content.jsx file sees modifications in layout and styling, particularly for the Section2 component and the NewsletterForm. The ThemeToggle.jsx component undergoes a comprehensive redesign for improved aesthetics and functionality. Additionally, index.css introduces a new CSS variable and dark mode styles. Overall, the changes enhance the visual presentation and responsiveness of the components without altering their core functionalities.

Changes

File Path Change Summary
frontend/src/components/Shared/footer/... Updated Content.jsx for layout and styling changes, including text color adjustments and logo visibility based on screen width.
frontend/src/components/ThemeToggle.jsx Redesigned ThemeToggle.jsx with updated layout, simplified checkbox, new Font Awesome icons, and enhanced interactivity.
frontend/src/index.css Added a CSS variable for transition duration and implemented dark mode styles for the html element.

Possibly related PRs

  • Bug Fix: #386 Copyright Part not visible #389: The changes in this PR involve modifications to the Content.jsx file, specifically enhancing the layout and styling of the Section2 component, which is directly related to the changes made in the main PR that also modifies Content.jsx and impacts the Section2 component's rendering logic and styling.
  • BUG: fix the main page footer non res. #406  #414: This PR also focuses on the Content.jsx file, addressing responsiveness issues in the footer component, which aligns with the main PR's changes that enhance the visual presentation and responsiveness of the footer components.
  • warning removed #24: This PR modifies the Footer component in Footer.jsx, which is related to the changes in the main PR that affect the overall structure and presentation of the footer components.
  • feat #27 added #38: This PR introduces a new StickyFooter component that replaces the original Footer, which is relevant as it relates to the overall footer structure that the main PR also addresses.
  • replaced the sip & play logo with new playcafe logo #85: This PR updates the logo image source in Content.jsx, which is directly related to the changes in the main PR that also involve adjustments to the logo image within the Section2 component.
  • Update CODE_OF_CONDUCT.md #372: This PR introduces dark mode support in various components, including Content.jsx, which is relevant to the main PR's focus on enhancing the visual presentation and responsiveness of the footer components.
  • feat: Dark Mode #379: This PR implements dark mode functionality across the application, which is relevant to the main PR's changes that also involve styling adjustments for light and dark modes in the footer components.

Suggested labels

enhancement, level1, gssoc-ext, documentation

Suggested reviewers

  • RamakrushnaBiswal

🐰 In the footer, colors now gleam,
With icons that dance and a toggle that beams.
Dark mode whispers, light mode sings,
A joyful update, oh what it brings!
Hopping through code, with a cheerful cheer,
A rabbit's delight, for all to endear! 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f9feba2 and 4c842ae.

📒 Files selected for processing (1)
  • frontend/src/components/Shared/footer/Content.jsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/Shared/footer/Content.jsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 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.

Copy link
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: 3

🧹 Outside diff range and nitpick comments (5)
frontend/src/index.css (1)

Line range hint 27-30: Remove commented code.

Consider removing the commented-out scrollbar styles if they're no longer needed. This will improve code maintainability.

frontend/src/components/ThemeToggle.jsx (2)

19-20: Use CSS variable for consistent transition duration.

The component uses a hardcoded duration of 300ms while there's a CSS variable --transition-duration set to 500ms. For consistency, consider using the CSS variable.

-<span className={`block w-16 h-8 bg-gray-300 rounded-full shadow-inner transition duration-300 ease-in-out ${isDarkMode ? 'bg-gray-800' : 'bg-gray-200'}`}></span>
+<span className={`block w-16 h-8 bg-gray-300 rounded-full shadow-inner transition duration-[var(--transition-duration)] ease-in-out ${isDarkMode ? 'bg-gray-800' : 'bg-gray-200'}`}></span>

36-39: Use CSS variable for slider transition.

For consistency with other animations, use the --transition-duration CSS variable.

-className={`absolute w-7 h-7 bg-white rounded-full shadow-lg transition-transform duration-300 ease-in-out transform ${isDarkMode ? 'translate-x-8' : 'translate-x-0'}`}
+className={`absolute w-7 h-7 bg-white rounded-full shadow-lg transition-transform duration-[var(--transition-duration)] ease-in-out transform ${isDarkMode ? 'translate-x-8' : 'translate-x-0'}`}
frontend/src/components/Shared/footer/Content.jsx (2)

Line range hint 19-58: Consider improving the NewsletterForm positioning

The current absolute positioning (absolute top-12 right-60) of the newsletter form could cause layout issues across different screen sizes. Consider using a more flexible layout approach:

- <div className="absolute top-12 right-60 p-2 rounded-md shadow-lg ">
+ <div className="relative p-2 rounded-md shadow-lg">

Also, consider enhancing the email validation:

 <input
   type="email"
   className="p-2 rounded-r-none border-l border-gray-300 focus:outline-none"
   placeholder="Enter your email"
   value={email}
   onChange={(e) => setEmail(e.target.value)}
+  pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"
+  title="Please enter a valid email address"
   required
 />

Line range hint 186-192: Remove commented code

The commented-out Google Translate image section should be removed since it's been replaced with the <Google /> component. This will improve code maintainability.

-        {/* <div className="flex items-center justify-center mt-4">
-          <img
-            src={googleImage}
-            alt="Google Translate"
-            className="w-[2rem] h-[2rem] mr-[65px]"
-          />
-        </div> */}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6d21841 and f9feba2.

📒 Files selected for processing (3)
  • frontend/src/components/Shared/footer/Content.jsx (1 hunks)
  • frontend/src/components/ThemeToggle.jsx (1 hunks)
  • frontend/src/index.css (1 hunks)
🔇 Additional comments (4)
frontend/src/index.css (1)

Line range hint 1-53: Verify footer text visibility in light theme.

While dark mode styles have been added, I don't see specific styles addressing the footer text visibility in light theme, which was one of the PR objectives.

#!/bin/bash
# Search for footer-related styles
rg -i "footer|foot" --type css
frontend/src/components/ThemeToggle.jsx (2)

10-17: LGTM! Follows accessibility best practices.

The implementation uses proper semantic HTML with accessible form controls and screen reader support.


41-44: Verify the need for duplicate icon implementation.

The code renders the same icons twice:

  1. First set at lines 23-34 (moon/sun icons for different modes)
  2. Second set within the circular container (lines 41-44)

This duplication might be unnecessary and could cause confusion. If both sets are intentional for the design, consider:

  1. Adding comments explaining the purpose of each set
  2. Using CSS to hide one set when the other is visible
frontend/src/components/Shared/footer/Content.jsx (1)

92-94: Good improvement in text visibility!

The new text color (#004D43) provides better contrast against the light theme background while maintaining dark mode compatibility. This change effectively addresses the footer text visibility issue mentioned in the PR objectives.

Comment on lines +49 to +53
/* Enable dark mode */
html.dark {
background-color: #1a202c; /* Dark slate background */
color: #f0e7db; /* Light text */
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add transitions for smooth theme switching.

The dark mode colors provide excellent contrast (14:1 ratio) for accessibility. However, consider adding transitions for a smoother theme switch experience.

 html.dark {
+  transition: background-color var(--transition-duration) ease-in-out,
+              color var(--transition-duration) ease-in-out;
   background-color: #1a202c; /* Dark slate background */
   color: #f0e7db; /* Light text */
 }
+
+html {
+  transition: background-color var(--transition-duration) ease-in-out,
+              color var(--transition-duration) ease-in-out;
+}

Committable suggestion was skipped due to low confidence.

Comment on lines +45 to +47
:root {
--transition-duration: 500ms;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Remove unused CSS variable --transition-duration

The --transition-duration CSS variable declared in frontend/src/index.css is not being used anywhere in the codebase. While there are many transition-related properties throughout the application, they all use hardcoded duration values (e.g., 300ms, 500ms) and none reference this variable using var(--transition-duration). Consider either:

  • Removing this unused variable, or
  • Refactoring existing transitions to use this variable for consistent animation timing
🔗 Analysis chain

Verify the usage of --transition-duration variable.

The new CSS variable appears to be intended for theme transition animations, but its usage is not visible in the provided changes.


Let's check if the variable is used in any way, even without the var() syntax, and also look for transition properties in general to understand the context better.


The previous search showed the variable declaration but we need to verify its usage across both CSS and JavaScript files, as it might be used in component styles or dynamic CSS.


Let's do a broader search to ensure we don't miss any usage of this variable, including in JavaScript/TypeScript files where it might be used in template literals or style objects.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of the transition-duration variable
rg "var\(--transition-duration\)" 

Length of output: 126


Script:

#!/bin/bash
# Search for any transition-related properties in CSS files
rg "transition" --type css

# Also search for the exact variable name without var() wrapper
rg "--transition-duration" --type css

Length of output: 627


Script:

#!/bin/bash
# Search for the variable with proper escaping
rg "\-\-transition\-duration" --type css

# Let's also check JavaScript/JSX files for potential usage
rg "transition" --type js --type jsx -A 2

Length of output: 167


Script:

#!/bin/bash
# Search in all files (not just css) to catch any potential usage
rg "\-\-transition\-duration" 

# Search for transition-related properties in all frontend files
fd . frontend -t f -e js -e jsx -e tsx -e css | xargs rg "transition"

Length of output: 9617

Comment on lines +22 to +34
{/* Moon Icon for Light Mode */}
<FaMoon
className={`absolute left-1 w-5 h-5 text-gray-700 transform transition-all duration-300 ${
isDarkMode ? 'opacity-0 scale-0' : 'opacity-100 scale-100'
}`}
/>

{/* Sun Icon for Dark Mode */}
<FaSun
className={`absolute right-1 w-5 h-5 text-gray-100 transform transition-all duration-300 ${
isDarkMode ? 'opacity-100 scale-100' : 'opacity-0 scale-0'
}`}
/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Refactor duplicate icon animation styles.

The sun and moon icons share similar animation logic with hardcoded transition durations. Consider extracting common styles and using the CSS variable.

+const iconBaseStyles = "absolute w-5 h-5 transform transition-all duration-[var(--transition-duration)]";
+const moonIconStyles = `${iconBaseStyles} left-1 text-gray-700`;
+const sunIconStyles = `${iconBaseStyles} right-1 text-gray-100`;

-<FaMoon
-  className={`absolute left-1 w-5 h-5 text-gray-700 transform transition-all duration-300 ${
-    isDarkMode ? 'opacity-0 scale-0' : 'opacity-100 scale-100'
-  }`}
-/>
+<FaMoon
+  className={`${moonIconStyles} ${isDarkMode ? 'opacity-0 scale-0' : 'opacity-100 scale-100'}`}
+/>

-<FaSun
-  className={`absolute right-1 w-5 h-5 text-gray-100 transform transition-all duration-300 ${
-    isDarkMode ? 'opacity-100 scale-100' : 'opacity-0 scale-0'
-  }`}
-/>
+<FaSun
+  className={`${sunIconStyles} ${isDarkMode ? 'opacity-100 scale-100' : 'opacity-0 scale-0'}`}
+/>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{/* Moon Icon for Light Mode */}
<FaMoon
className={`absolute left-1 w-5 h-5 text-gray-700 transform transition-all duration-300 ${
isDarkMode ? 'opacity-0 scale-0' : 'opacity-100 scale-100'
}`}
/>
{/* Sun Icon for Dark Mode */}
<FaSun
className={`absolute right-1 w-5 h-5 text-gray-100 transform transition-all duration-300 ${
isDarkMode ? 'opacity-100 scale-100' : 'opacity-0 scale-0'
}`}
/>
const iconBaseStyles = "absolute w-5 h-5 transform transition-all duration-[var(--transition-duration)]";
const moonIconStyles = `${iconBaseStyles} left-1 text-gray-700`;
const sunIconStyles = `${iconBaseStyles} right-1 text-gray-100`;
{/* Moon Icon for Light Mode */}
<FaMoon
className={`${moonIconStyles} ${isDarkMode ? 'opacity-0 scale-0' : 'opacity-100 scale-100'}`}
/>
{/* Sun Icon for Dark Mode */}
<FaSun
className={`${sunIconStyles} ${isDarkMode ? 'opacity-100 scale-100' : 'opacity-0 scale-0'}`}
/>

@RamakrushnaBiswal
Copy link
Owner

@AnushkaChouhan25 resolve the conflicts

@AnushkaChouhan25
Copy link
Contributor Author

@RamakrushnaBiswal Done

@RamakrushnaBiswal RamakrushnaBiswal merged commit 7aa1cc1 into RamakrushnaBiswal:main Oct 29, 2024
3 of 4 checks passed
@RamakrushnaBiswal RamakrushnaBiswal added level2 for 25 points gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo and removed pending if needed i will assign labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gssoc-ext gssoc-extd program hacktoberfest accepted hacktoberfest-accepted repo level2 for 25 points
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants