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

feat: Implemented some Animo colors #54

Merged
merged 9 commits into from
Jan 11, 2023
Merged

feat: Implemented some Animo colors #54

merged 9 commits into from
Jan 11, 2023

Conversation

Tommylans
Copy link
Member

@Tommylans Tommylans commented Dec 23, 2022

closes #55

image
image
image
image
image
image
image
image

@Tommylans Tommylans force-pushed the feature/TBX-62 branch 2 times, most recently from 9f06430 to 3644dab Compare January 4, 2023 11:21
@Tommylans Tommylans marked this pull request as ready for review January 4, 2023 12:57
@Tommylans Tommylans force-pushed the feature/TBX-62 branch 2 times, most recently from 3cf309b to 226c506 Compare January 4, 2023 13:13
Copy link
Member

@berendsliedrecht berendsliedrecht left a comment

Choose a reason for hiding this comment

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

Just one point mainly about how the theme is being used.

I will just comment it here again. We should never really do custom theme stuff within the code outside of the themes file.

Where we define the collars we should names like: backgroundOne, backgroundTwo, primaryOne, primaryTwo, secondaryOne, secondaryTwo, grayscaleOne, grayscaleTwo, info, success, etc.

Each color maps to something different in light and dark mode, with the exception of colors that MUST be the same in light and dark mode (e.g. grayscale).

If we map it like this we can avoid all the manual ternary expressions for the theme and make it a lot easier to create pages that are instantly compatible with light/dark mode.

Comment on lines 10 to 28
const useStyles = createStyles((theme) => ({
primary: {
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoWhite[0] : theme.colors.animoBlack[0],
color: theme.colorScheme === 'dark' ? theme.colors.animoBlack[0] : theme.colors.animoWhite[0],

'&:hover': {
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoWhite[0] : theme.colors.animoBlack[0],
},
},

secondary: {
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoBlack[0] : theme.colors.animoWhite[0],
color: theme.colorScheme === 'dark' ? theme.colors.animoWhite[0] : theme.colors.animoBlack[0],

'&:hover': {
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.animoBlack[1] : theme.colors.animoWhite[1],
},
},
}))
Copy link
Member

Choose a reason for hiding this comment

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

Yeah I am not a fan of this. We have a theme which we can change based on the light / dark mode.

If we use names like theme.colors.backgroundOne / Two / etc we can just change the colours when the theme changes and not like this. We really must avoid this when possible as this will make code quite unreadable and annoying to fix later on.

Copy link
Member Author

Choose a reason for hiding this comment

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

The only thing we can do I think is making named colors without the color name and switch those in the color pallet. I'll look into it tomorrow.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that is what I mean. IMO specifying a color by name should only be done if it is the same color in different themes. And if we do that for all, why do we have themes?

export const StatusBadge = (props: BadgeProps) => {
const { colorScheme } = useMantineTheme()

return <Badge variant={colorScheme === 'dark' ? 'light' : 'outline'} color="blue" {...props} />
Copy link
Member

Choose a reason for hiding this comment

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

Same here. I think we should really, with one or max two exceptions, never check the colorscheme within code here. If we want to display a different icon then I understand but we should just switch colors between light and dark mode and preferably nothing else.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm this one will be a bit harder I think because we are changing the variant and this one isn't really switchable with the global color pallet. But we might be able to create a hook for it to change it between the 2. So maybe a hook that tells that we need more contrast with a specific colorscheme so just a yes or no return.

Copy link
Member

Choose a reason for hiding this comment

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

I don’t mean that we should change the variant based on the theme, I mean that we should NOT toggle anything other than the colors based on the light theme

@Tommylans Tommylans marked this pull request as draft January 6, 2023 16:19
@Tommylans Tommylans marked this pull request as ready for review January 9, 2023 10:10
@berendsliedrecht
Copy link
Member

@janrtvld Could you do a quick check for this PR? You will likely have some better things to say about the design / colors then I do :).

@Tommylans
Copy link
Member Author

I made a lot of changes to the UI and also processed some of the feedback that @janrtvld gave.

The result:
image
image
image
image
image
image
image
image
image
image

Copy link
Member

@berendsliedrecht berendsliedrecht left a comment

Choose a reason for hiding this comment

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

Some very minor things. can be merged after resolution.

@@ -31,7 +31,8 @@ contextBridge.exposeInMainWorld('nodeFetch', async (endpoint, request) => {

const getConfigDirForPlatform = (platform, homeDir, appDataDir) => {
switch (platform) {
case 'linux' || 'darwin':
case 'darwin':
Copy link
Member

Choose a reason for hiding this comment

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

You switched it back 👀 that's fine haha :).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it wasn't working and javascript doesn't support the || operator in a switch or it wasn't working as expected. Darwin didn't work with this switch so idk It's stranngeeee. So when I switched it back it started working again on my macbook.

@berendsliedrecht
Copy link
Member

Can be merged @Tommylans if you want.

@Tommylans Tommylans merged commit c91c4fd into main Jan 11, 2023
@Tommylans Tommylans deleted the feature/TBX-62 branch January 11, 2023 13:58
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.

Abstract Mantine theme to a separate file for easier theme management
2 participants