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

Updating Changes acc. to #788 #1787

Merged
merged 9 commits into from
Jun 29, 2024
Merged

Updating Changes acc. to #788 #1787

merged 9 commits into from
Jun 29, 2024

Conversation

Hindu-Priya
Copy link
Contributor

@Hindu-Priya Hindu-Priya commented May 5, 2024

Hi there, I have updated colors acc. to the top ones in the new design system styleguide tags, as per the dark mode theme.

@Hindu-Priya Hindu-Priya requested review from a team as code owners May 5, 2024 14:39
Copy link

changeset-bot bot commented May 5, 2024

⚠️ No Changeset found

Latest commit: 5b8e246

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Collaborator

@dbradham dbradham left a comment

Choose a reason for hiding this comment

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

Looks good to me

@@ -8,7 +8,7 @@ const theme = {
},
colors: {
BLUE: '#3A7CA5',
BLUE_100: '#75A3C0',
BLUE_100: '#7A87C7',
Copy link
Member

Choose a reason for hiding this comment

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

changes to BLUE_100, YELLOW_100, ORANGE_100, SUCCESS_100 and this file as a whole need to be reviewed by design team before merging

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks Mohammed.

@Nouri-Anouar can you take a look at the changes here, or let us know if there is someone else who can help? Thanks!

Copy link
Contributor

@Nouri-Anouar Nouri-Anouar May 7, 2024

Choose a reason for hiding this comment

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

@dbradham it appears this file is outdated and does not align with our design system.

Color Pallete

@Enjoy2Live can we have colors from the design tokens here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Enjoy2Live @Nouri-Anouar this seems out of scope for Hindu's change. Neither the old color, nor the color she is updating to are in the current design system you shared here.

CC: @JulieMass

Copy link
Member

@momaqbol momaqbol May 8, 2024

Choose a reason for hiding this comment

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

@dbradham true and for that I'd recommend your team to use tailwind for cases like these because anything related to styled components is considered outdated/deprecated, for the now I think you should use the token Blue-blue-100 as tailwind className.
Example: bg-Blue-blue-100 applies #75A3C0 as background color

@Nouri-Anouar looking at tokens studio I'm still seeing Blue-blue-100 color token while it's not showing in the color pallete you linked, make sure to update either to match the other so we avoid confusions like these.

Copy link
Contributor

@Nouri-Anouar Nouri-Anouar May 11, 2024

Choose a reason for hiding this comment

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

Just to give a bit of context for everyone, the color names have been updated as follows:

  • Light Blue -> Uranus.
  • Blue -> Neptune.
  • Yellow -> Saturn.
  • Orange -> Jupiter.

Additionally, there are additional values compared to this file ranging from 50 to 900. For dark mode, we're utilizing color values of 300, while 500 for light mode (ex: Color: Saturn 500, Mode: Light).

I believe we should use their respective TailwindCSS classes instead @Enjoy2Live?
I opened a PR for this fix #1791

Copy link
Member

Choose a reason for hiding this comment

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

thanks for the PR Anouar, this makes a ton of sense now.

Comment on lines 17 to 31
if (status === 'submitted') {
setTag('submitted');
setTagColor(theme.colors.LIGHT_BLUE_100);
} else if (status == 'applying') {
setTagColor('--light-blue-lightblue-100');
} else if (status === 'applying') {
setTag('in-review');
setTagColor(theme.colors.YELLOW_100);
} else if (status == 'approved') {
setTagColor('--yellow-yellow-100');
} else if (status === 'approved') {
setTag('approved');
setTagColor(theme.colors.SUCCESS_100);
} else if (status == 'archived') {
setTagColor('--success-success-100');
} else if (status === 'archived') {
setTag('archived');
setTagColor(theme.colors.BLUE_100);
setTagColor('--blue-blue-100');
} else {
setTag('workshopping');
setTagColor(theme.colors.ORANGE_100);
setTagColor('--orange-orange-100');
Copy link
Member

@momaqbol momaqbol Jun 7, 2024

Choose a reason for hiding this comment

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

a more maintainable and readable way to handle this is by using a key value pair of [status]: 'tailwind-class'

const tagColor = {
applying: 'bg-yellow-yellow-100'
.
.
.
}


return <myDiv className={tagColor[status]} />

then you won't need most of this logic and useEffect

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @Enjoy2Live, I tried this approach, and I can't seem to access Tailwind CSS colors. Perhaps there is something missing, for not being able to apply Tailwind CSS classes correctly.

Copy link
Member

Choose a reason for hiding this comment

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

Hello @Hindu-Priya , you said you tried this approach but I'm not seeing the commit for your try.

can you please make a commit with my suggestion and push it so I can take a look?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @Enjoy2Live, I just committed my attempt based on your suggestion. Please take a look when you get a chance.

@momaqbol
Copy link
Member

I just merged the PR that should fix the colors to master, let me know if you face issues going forward

@Hindu-Priya Hindu-Priya requested a review from pyxld-kris as a code owner June 20, 2024 03:14
Copy link
Member

@momaqbol momaqbol left a comment

Choose a reason for hiding this comment

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

This is pretty much approved but please go through my requested changes and fix them before merging.

@dbradham it seems like there's duplicated work here, we've had a shared tag component already implemented some time ago. it's going to save you lots of time once you use as changes there are reflected on your app and the rest of the apps.

link to tag component stories
link to tag component file

@@ -1,6 +1,10 @@
import Head from 'next/head';
import '../../../packages/tailwind-constructor/output/core.css';
Copy link
Member

Choose a reason for hiding this comment

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

this is not needed as we're already importing tailwind.css in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Earlier, I encountered an error indicating that CSS should be included globally. This occurred when I didn't use the Tailwind class "bg-LightBlue-lightblue-100" in this manner. In the latest commit, I removed the comments and made minor changes. Thanks!

@@ -1,31 +1,43 @@
import React, { useState } from 'react';
import theme from '@devlaunchers/components/styles/theme';
// import theme from '@devlaunchers/components/styles/theme';
Copy link
Member

Choose a reason for hiding this comment

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

let's remove this instead of commenting

Comment on lines 9 to 15
const tagColor = {
submitted: 'bg-light-blue-lightblue-100',
'in-review': 'bg-yellow-yellow-100',
approved: 'bg-success-success-100',
archieved: 'bg-blue-blue-100',
workshopping: 'bg-orange-orange-100',
};
Copy link
Member

Choose a reason for hiding this comment

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

these should be typed like this:

const tagColor = {
    submitted: 'bg-LightBlue-lightblue-100',
    'in-review': 'bg-Yellow-yellow-100',
    approved: 'bg-Success-success-100',
    archieved: 'bg-Blue-blue-100',
    workshopping: 'bg-Orange-orange-100',
  };

I fixed it in the last commit so you just need to pull

// }
// }, [status]);

return <StatuBox backgroundColor={tagColor[status]}> {status} </StatuBox>;
Copy link
Member

Choose a reason for hiding this comment

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

you should substitute backgroundColor prop with className because that's how tailwind works.

I fixed it in the last commit so you just need to pull

@Hindu-Priya
Copy link
Contributor Author

Hi there, I made all the necessary changes. Please look at the latest commit, when you get a chance.

@dbradham
Copy link
Collaborator

Hi there, I made all the necessary changes. Please look at the latest commit, when you get a chance.

CC: @Enjoy2Live

const [tag, setTag] = useState('');
// const [tagColor, setTagColor] = useState('');
if (status == 'applying') {
status = 'in-review';
Copy link
Member

Choose a reason for hiding this comment

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

@Hindu-Priya
props are immuatable so you can't assign different values to it if I'm not mistaken.

Copy link
Member

Choose a reason for hiding this comment

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

other than that this PR is approved by me

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Enjoy2Live that may be true in TypeScript, but I don't believe the same applies to JavaScript. Source: https://www.reddit.com/r/reactjs/comments/14howx9/why_im_able_to_change_props_value_if_props_are/?rdt=59264

Copy link
Member

Choose a reason for hiding this comment

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

it's not a typescript or javascript thing, it's a react thing.

in react you can't change props this way as props are immutable

Don’t try to “change props”. When you need to respond to the user input (like changing the selected color), you will need to “set state”, which you can learn about in State: A Component’s Memory.

Source: https://react.dev/learn/passing-props-to-a-component#how-props-change-over-time

Copy link
Contributor Author

@Hindu-Priya Hindu-Priya Jun 27, 2024

Choose a reason for hiding this comment

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

@Enjoy2Live, @dbradham
I made a new commit, ensuring props immutability in the component. Thanks!

Copy link
Member

@momaqbol momaqbol left a comment

Choose a reason for hiding this comment

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

Now it's at a much better state but let's make sure we remove this file at some point and import the global tag component to ensure consistency and smaller codebase.

CC @dbradham

Approved!

P.S. this PR is going to master and I'm not sure if it's intended

@dbradham dbradham merged commit 982ce6d into master Jun 29, 2024
2 checks passed
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.

5 participants