Skip to content

New Theming #868

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

Merged
Merged

Conversation

YoussefHenna
Copy link
Collaborator

@YoussefHenna YoussefHenna commented Apr 16, 2024

  • This is a large PR, but the changes in example, packages/core, packages/maps, and packages/native are just updating old theme references to the new theme references.
  • The important changes and new theming logic exist in a new package packages/theme
  • Changes based on https://www.notion.so/teamdraftbit/Refactor-Themes-e7ceeae7644e4366b7ee029ab92b67c9
  • Initially only supports colors, later we plan on supporting fonts and other other attributes.
  • Adds the concept of color palettes
    • Which are just objects that hold color values. These colors are then referenced in themes. The idea here is that we'll provide a set of default color palettes for users to use to easily create themes. Similair to tailwind's palettes https://tailwindcss.com/docs/customizing-colors
    • This logic will mostly be handled on the builder side, not here. Here is mostly just validation
  • Adds the concept of breakpoints
    • This is just another object where any key can be set to a number that represents a specific device width breakpoint. On the builder side, we'll probably have these static and set to the same breakpoints we use in other places.
    • With breakpoint keys set, a theme value can have a different value per breakpoint. Does not make much sense with colors, but will be useful down the line when we add other stuff to themes (spacing, roundness, etc).
  • The same idea used for breakpoints is platform-specific theme values. For the same theme value, you can have different values per platform.
  • In the end, a theme object is exposed
    • Similar to the one we already had with minor differences (Ex: theme.colors.primary is now theme.colors.branding.primary). We'll need a migration for this.
    • Usage is simple, but I'm using object proxies when exposing the theme in order to be able to handle the case of breakpoints and platforms and return the correct value. (Ex: theme.colors.branding.someValue can return a different value for ios and android)
  • Also added a way to change the theme at any point in the app
  • This will only be merged once builder is updated to use the new theme
untitled.webm

Copy link

linear bot commented Apr 16, 2024

@YoussefHenna YoussefHenna changed the base branch from master to 49 April 21, 2024 11:32
Copy link

github-actions bot commented May 7, 2024

Published version: @draftbit/[email protected]

@YoussefHenna YoussefHenna marked this pull request as ready for review May 7, 2024 11:51
needs
needs previously requested changes May 7, 2024
Copy link
Contributor

@needs needs 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 awesome work! A few minor comments and questions, but no blockers!

Co-authored-by: needs <[email protected]>
Copy link

github-actions bot commented May 9, 2024

Published version: @draftbit/[email protected]

Copy link

Published version: @draftbit/[email protected]

Copy link

Published version: @draftbit/[email protected]

Copy link

github-actions bot commented Jun 2, 2024

Published version: @draftbit/[email protected]

@YoussefHenna YoussefHenna dismissed needs’s stale review June 2, 2024 14:27

Addressed changes

Copy link

github-actions bot commented Jun 2, 2024

Published version: @draftbit/[email protected]

Copy link

github-actions bot commented Jun 3, 2024

Published version: @draftbit/[email protected]

Copy link

Published version: @draftbit/[email protected]

@YoussefHenna YoussefHenna merged commit 09c6d39 into 49 Jun 30, 2024
1 check passed
@YoussefHenna YoussefHenna deleted the youssef/p-4845-initial-theming-implementation-on-jigsaw branch June 30, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants