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

Add public api for project wardrobe (not being merged to master) #4760

Merged
merged 6 commits into from
Apr 5, 2022

Conversation

skyler-stripe
Copy link
Contributor

@skyler-stripe skyler-stripe commented Mar 24, 2022

Summary

Note above that this will not be merged to the master branch. This is for the beta.

  • Rename PaymentsThemeConfig to PaymentsThemeDefaults, add all variables to data classes under it.
  • XML elements now look at config.appearance rather than the singleton from ui core
  • Add public api under review.
  • Make PaymentsTheme have mutable variables.

Motivation

  • I want to get this out early (even while the api is under review) to get feedback on my approach while the api evolves.

A bit of explanation

So we have a few layers of colors, shapes, and typography. Because we have some variables that are not a part of the public appearance API we need to have two groups of variables. I wanted to lay out what each represent and why we need them.

PaymentsTheme.kt

PaymentsColors, PaymentsShapes, and PaymentsTypography represent all of the styling we have, both public and internal. PaymentsThemeDefaults holds all of the default values for all stylings we have, it is the single source of truth for all default colors, shapes, and typography. PaymentsComposeColors and PaymentsComposeShapes map the previously mentioned data classes to MaterialTheme values along with functions to translate between the two. PaymentsTheme is analogous to MaterialTheme in that it has a composable function version and singleton. This format allows us to match patterns and replace MaterialTheme

PaymentSheet.kt

The new values in Appearance are the variables that we allow merchants to mutate. They all match 1 to 1 with a variable inside of PaymentsThemeDefaults but not all variables are present because some we keep internal. This is an object we expect merchants to manipulate.

Testing

  • Added tests
  • Modified tests
  • Manually verified

@skyler-stripe skyler-stripe changed the title [Don't merge to master] Add public api for project wardrobe [Don't merge to master] [WIP] Add public api for project wardrobe Mar 24, 2022
@github-actions
Copy link
Contributor

Diffuse output:

@skyler-stripe skyler-stripe changed the title [Don't merge to master] [WIP] Add public api for project wardrobe [Don't merge to master] Add public api for project wardrobe Mar 25, 2022
@skyler-stripe skyler-stripe changed the base branch from master to payment_sheet_appearance_beta_1 April 5, 2022 00:20
@skyler-stripe skyler-stripe changed the title [Don't merge to master] Add public api for project wardrobe Add public api for project wardrobe Apr 5, 2022
@skyler-stripe skyler-stripe changed the title Add public api for project wardrobe Add public api for project wardrobe (not being merged to master) Apr 5, 2022
Copy link
Contributor

@jameswoo-stripe jameswoo-stripe left a comment

Choose a reason for hiding this comment

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

code looks fine to me

@skyler-stripe skyler-stripe merged commit 7a5d7b6 into payment_sheet_appearance_beta_1 Apr 5, 2022
@skyler-stripe skyler-stripe deleted the appearenceApi branch April 5, 2022 19:41
skyler-stripe added a commit that referenced this pull request May 17, 2022
* Add public api for project wardrobe (not being merged to master) (#4760)

* add public api for project wardrobe

* attempt #2

* change from floats to TextUnits for default typography

* forgot typography

* api dump

* [Not being merged to master] Add public api for primary button (#4888)

* Add public api for primary button

* apidump

* add nullables to make construction easier

* update docs

* Create Appearance Playground (#4897)

* add screenshot tests for apperance work (#4939)

* add primary button rules to playground (#4935)

* Add project wardrobe configs to init events (#4967)

* Add project wardrobe configs to init events

* shorten config field to save url size

* Dogfood feedback for Appearance APIs (#4996)

* address dogfooding comments

* api dump
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.

4 participants