Skip to content

Conversation

Adamj1232
Copy link
Contributor

@Adamj1232 Adamj1232 commented Mar 17, 2023

Description

Notion card with stats and pictures

  • Removing Sofia semi-bold: 53kb from baseline
  • Sofia -> Inter variable: 83kb from baseline minus Sofia semi-bold
  • Custom font or use web font: 228b from default with Inter

Option to define a font through either the new theme property --w3o-font-family or the legacy css font var --onboard-font-family-normal

Or set useWebFont to true and use the default fallback sans-serif font by setting

Screen Shot 2023-03-17 at 2 47 07 PM

Screen Shot 2023-03-17 at 2 55 50 PM

Inter_finalStats

Type changes:

Add '--w3o-font-family' Theme prop:

type ThemingMap = { '--w3o-background-color'?: string '--w3o-font-family'?: string '--w3o-foreground-color'?: string '--w3o-text-color'?: string '--w3o-border-color'?: string '--w3o-action-color'?: string '--w3o-border-radius'?: string }

Add useWebFont boolean prop to init options:

interface InitOptions { ..... /**  * Defaults to False - use to reduce load time  * If set to true the Inter font will not be imported and  * instead the default 'sans-serif' font will be used  * To define the font used see `--w3o-font-family` prop within  * the Theme initialization object or set as css variable  */ useWebFont?: boolean }

Checklist

  • Increment the version field in package.json of the package you have made changes in following semantic versioning and using alpha release tagging
  • Check the box that allows repo maintainers to update this PR
  • Test locally to make sure this feature/fix works
  • Run yarn check-all to confirm there are not any associated errors
  • Confirm this PR passes Circle CI checks
  • Add or update relevant information in the documentation
@Adamj1232 Adamj1232 requested a review from gesquinca March 17, 2023 21:29
@vercel
Copy link

vercel bot commented Mar 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
web3-onboard-docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 24, 2023 at 5:16PM (UTC)
@Adamj1232 Adamj1232 marked this pull request as ready for review March 20, 2023 20:04
@Adamj1232 Adamj1232 changed the title Feature - New and Dynamic loading fonts Feature - New Font Usage (Inter) and Dynamic Font Handling Mar 20, 2023
Copy link
Contributor

@lnbc1QWFyb24 lnbc1QWFyb24 left a comment

Choose a reason for hiding this comment

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

Just a console log to be removed and a question around the check if a font has been defined.

Also where is the dynamic loading occurring? It all looks like it is imported regardless of configuration from what I can tell?

Adamj1232 and others added 2 commits March 20, 2023 15:47
@Adamj1232
Copy link
Contributor Author

Refactored and moved to the CDN approach as recommended.
Dynamic importing can be seen in a few places, within Core it is now here

Copy link
Contributor

@lnbc1QWFyb24 lnbc1QWFyb24 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!

Copy link
Contributor

@leightkt leightkt left a comment

Choose a reason for hiding this comment

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

Tested in the demo with useWebFont: true and passing custom font via --w3o-font-family

@Adamj1232 Adamj1232 merged commit e760d2b into develop Mar 24, 2023
@Adamj1232 Adamj1232 deleted the feature/dynamic_fonts branch March 24, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants