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

fix-#275: Fixed the redirect icon color to match theme #345

Conversation

Ashu0216
Copy link

@Ashu0216 Ashu0216 commented May 23, 2024

Summary

Fixes for the redirect icon to match the color theme (both light and dark).

##Description

Included appropriate CSS to sync with the theme (dark/ light) to sync the redirect icon color.

Images

image
image

Issue(s) Addressed

Closes #275

Prerequisites

Copy link

vercel bot commented May 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wanderlust ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 7:15pm
wanderlust-backend ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2024 7:15pm

Copy link

Hey @Ashu0216! Thanks for sticking to the guidelines! High five! 🙌🏻

@Ashu0216
Copy link
Author

Hi @krishnaacharyaa .
I really enjoyed working on this issue. It was my first time working with SVGs, and I definitely learned a lot in the process.

Kindly review the PR and let me know if any changes are needed.

Copy link
Owner

@krishnaacharyaa krishnaacharyaa left a comment

Choose a reason for hiding this comment

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

Thank you for PR, kindly address the review comments

@@ -1,5 +1,5 @@
import { useNavigate } from 'react-router-dom';
import linkIcon from '@/assets/svg/link.svg';
// import linkIcon from '@/assets/svg/link.svg';
import Post from '@/types/post-type';
Copy link
Owner

Choose a reason for hiding this comment

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

Kindly remove the comments, never have code comments in the PR

Copy link
Author

Choose a reason for hiding this comment

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

Will remove the comments

Copy link
Owner

Choose a reason for hiding this comment

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

You have not yet removed @Ashu0216

@@ -24,7 +24,14 @@ export default function LatestPostCard({
<CategoryPill key={`${category}-${index}`} category={category} />
))}
</div>
<img src={linkIcon} alt={post.title} className="h-3 w-3" />
{/* <img src={linkIcon} alt={post.title} className="h-3 w-3" /> */}
<svg
Copy link
Owner

Choose a reason for hiding this comment

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

Same here

Copy link
Author

Choose a reason for hiding this comment

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

Will remove the comments

Copy link
Owner

Choose a reason for hiding this comment

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

same

<img src={linkIcon} alt={post.title} className="h-3 w-3" />
{/* <img src={linkIcon} alt={post.title} className="h-3 w-3" /> */}
<svg
xmlns="http://www.w3.org/2000/svg"
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of embedding this as a svg, create file and import from there, like the existing linkIcon.
Ideally rename the existing linkIcon to link-light-icon and have a new one link-dark-icon

Copy link
Author

Choose a reason for hiding this comment

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

  1. I did try having it in assets itself, but the classes that I added on the svg were not reflecting the color on UI. I also did try to change the img styling but didnt seem to work .So I referred the tailwind Doc and therefore did it this way.
    Here is the method I followed : SVGstyling.

  2. Yes, ideally it should be two different SVGs (one for light and another for dark theme). But then this would involve lifting up the state from Toggle > Header > Home page and then passing it down till LatestPostCard. Hence I thought instead of unncessary passing of state we could use svg properties to deal with this.

Copy link
Author

Choose a reason for hiding this comment

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

I can give containing SVG in assests and use it like the previous embedded linkIcon one more try.

Copy link
Owner

Choose a reason for hiding this comment

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

We don't prefer embedding and about the 2nd point
Just use this hook useThemeClass from utils

And conditionally rendor light and dark svg

Copy link
Author

Choose a reason for hiding this comment

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

Hi @krishnaacharyaa , I tried adopting this approach, added two separate svgs and conditionally rendered them using the useThemeClass.
But there is an issue in this, the theme is not updated dynamically when the theme-toggle-button updates the theme. As a solution , I would propose that we can use ThemeContext which would define the theme for the entire app. And accordingly modify the theme-toggle component ti use the method of ThemeContext to update the theme which can then be accessed by any children component.

Copy link
Owner

Choose a reason for hiding this comment

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

We can't use context api, as it renders every component beneath, we can use zustand state management instead, if you can stick to the contributing guidelines and do nice refactoring @Ashu0216

Copy link
Author

Choose a reason for hiding this comment

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

Sure, will try to utilize zutsand, and will keep you updated of the progress @krishnaacharyaa

className="text-primary h-3 w-3 fill-current dark:text-dark-primary"
viewBox="0 0 515.283 515.283"
>
<path d="M372.149 515.283H85.881c-22.941 0-44.507-8.934-60.727-25.155S.001 452.34.001 429.402V143.134c0-22.94 8.934-44.506 25.154-60.726s37.786-25.154 60.727-25.154h114.507c15.811 0 28.627 12.816 28.627 28.627s-12.816 28.627-28.627 28.627H85.881c-7.647 0-14.835 2.978-20.241 8.384s-8.385 12.595-8.385 20.242v286.268c0 7.647 2.978 14.835 8.385 20.243 5.406 5.405 12.594 8.384 20.241 8.384h286.267c7.647 0 14.835-2.978 20.242-8.386 5.406-5.406 8.384-12.595 8.384-20.242V314.895c0-15.811 12.817-28.626 28.628-28.626s28.628 12.816 28.628 28.626v114.507c0 22.94-8.934 44.505-25.155 60.727-16.221 16.22-37.788 25.154-60.726 25.154zm-171.76-171.762c-7.327 0-14.653-2.794-20.242-8.384-11.179-11.179-11.179-29.306 0-40.485L417.544 57.254H314.896c-15.811 0-28.626-12.816-28.626-28.627S299.085 0 314.896 0h171.761a28.542 28.542 0 0 1 19.997 8.144l.002.002.056.056.017.016.044.044.029.029.032.032.062.062.062.062.031.032.029.029a.62.62 0 0 1 .06.061l.056.057.002.002a28.55 28.55 0 0 1 8.144 19.998v171.761c0 15.811-12.817 28.627-28.628 28.627s-28.626-12.816-28.626-28.627V97.739l-237.4 237.399c-5.585 5.59-12.911 8.383-20.237 8.383z" />
Copy link
Owner

Choose a reason for hiding this comment

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

I see the icon is just replaced, How will it be different based on the theme?

Copy link
Author

Choose a reason for hiding this comment

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

I have added the fill current class to the svg with the colors mentioned for both light and dark theme (referenced the figma desgin for the required colors) that will make the color change whenever the theme changes.

@krishnaacharyaa krishnaacharyaa changed the title fix-#275: Fixed the redirect icon color to match theme fixing-#275: Fixed the redirect icon color to match theme May 23, 2024
Copy link

Umm... did someone forget to read the style guide? Fix that PR title and let's try again! @krishnaacharyaa
Don't worry, it happens to the best of us! Check out our contributor guidelines for more details.

@krishnaacharyaa krishnaacharyaa changed the title fixing-#275: Fixed the redirect icon color to match theme fix-#275: Fixed the redirect icon color to match theme May 23, 2024
Copy link

Hey @krishnaacharyaa! Thanks for sticking to the guidelines! High five! 🙌🏻

Copy link

Hey @krishnaacharyaa! Thanks for sticking to the guidelines! High five! 🙌🏻

1 similar comment
Copy link

Hey @krishnaacharyaa! Thanks for sticking to the guidelines! High five! 🙌🏻

@@ -1,5 +1,5 @@
import { useNavigate } from 'react-router-dom';
import linkIcon from '@/assets/svg/link.svg';
// import linkIcon from '@/assets/svg/link.svg';
import Post from '@/types/post-type';
Copy link
Owner

Choose a reason for hiding this comment

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

You have not yet removed @Ashu0216

@@ -24,7 +24,14 @@ export default function LatestPostCard({
<CategoryPill key={`${category}-${index}`} category={category} />
))}
</div>
<img src={linkIcon} alt={post.title} className="h-3 w-3" />
{/* <img src={linkIcon} alt={post.title} className="h-3 w-3" /> */}
<svg
Copy link
Owner

Choose a reason for hiding this comment

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

same

<img src={linkIcon} alt={post.title} className="h-3 w-3" />
{/* <img src={linkIcon} alt={post.title} className="h-3 w-3" /> */}
<svg
xmlns="http://www.w3.org/2000/svg"
Copy link
Owner

Choose a reason for hiding this comment

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

We don't prefer embedding and about the 2nd point
Just use this hook useThemeClass from utils

And conditionally rendor light and dark svg

@krishnaacharyaa
Copy link
Owner

@Ashu0216 any progress?!

@Ashu0216
Copy link
Author

Ashu0216 commented May 29, 2024

@Ashu0216 any progress?!

Hi @krishnaacharyaa , Apologies for the delay. I have my exams going on right now. Would you please mind giving me this week's time to get back to you with all the changes suggested. I'll try to get it done as soon as possible .Thank you for your patience.

@krishnaacharyaa
Copy link
Owner

Closing as inactive

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.

[BUG] Redirect Icon Color not matches theme.
2 participants