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

[Paywalls V2] Allow overriding of font size on paywall #4651

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

joshdholtz
Copy link
Member

Motivation

Allow overriding of font sizes per paywall

Description

New fontSizeOverride on PaywallComopnentsData

  • This is the same level the base paywall is on
  • Allows overriding of all font size names (heading_xxl, heading_xl, body_l, etc)
Screenshot 2025-01-12 at 6 21 05 AM

@joshdholtz joshdholtz changed the base branch from main to paywalls-v2/ui-config-colors-light-and-dark January 12, 2025 12:21
@joshdholtz joshdholtz marked this pull request as ready for review January 12, 2025 12:22
@joshdholtz joshdholtz force-pushed the paywalls-v2/ui-config-colors-light-and-dark branch from cb94a09 to 5c70b03 Compare January 13, 2025 11:43
@joshdholtz joshdholtz force-pushed the paywalls-v2/overriding-font-sizes branch from 0254a82 to de08a5f Compare January 13, 2025 11:45
Base automatically changed from paywalls-v2/ui-config-colors-light-and-dark to main January 13, 2025 12:23
@joshdholtz joshdholtz force-pushed the paywalls-v2/overriding-font-sizes branch from de08a5f to f5f4ed8 Compare January 13, 2025 12:39
@joshdholtz joshdholtz requested review from a team January 13, 2025 12:39
Copy link
Member

@JayShortway JayShortway 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 good! I'm just a little afraid we're backing ourselves into a corner here.

Comment on lines +58 to +67
case .headingXXL: fontSize = fontSizeOverrides?.headingXXL.asCGFloat ?? 40
case .headingXL: fontSize = fontSizeOverrides?.headingXL.asCGFloat ?? 34
case .headingL: fontSize = fontSizeOverrides?.headingL.asCGFloat ?? 28
case .headingM: fontSize = fontSizeOverrides?.headingM.asCGFloat ?? 24
case .headingS: fontSize = fontSizeOverrides?.headingS.asCGFloat ?? 20
case .headingXS: fontSize = fontSizeOverrides?.headingXS.asCGFloat ?? 16
case .bodyXL: fontSize = fontSizeOverrides?.bodyXL.asCGFloat ?? 18
case .bodyL: fontSize = fontSizeOverrides?.bodyL.asCGFloat ?? 17
case .bodyM: fontSize = fontSizeOverrides?.bodyM.asCGFloat ?? 15
case .bodyS: fontSize = fontSizeOverrides?.bodyS.asCGFloat ?? 13
Copy link
Member

Choose a reason for hiding this comment

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

I'd still like to discuss the backend just sending the font size as a number (e.g. 40 instead of heading_xxl) in the text component.

{
-   "font_size": "heading_xxl",
+   "font_size": 40,
    "type": "text"
}

The dashboard can still have font size names of course. The SDK just doesn't need to know about them.

Benefits I see:

  • avoids the complexity added in this PR
  • allows us to make changes to the list of font size names without needing SDK updates
  • allows us to fine-tune font sizes (even between platforms) without needing SDK updates

I've added an item to our weekly today 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants