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 font family overrides from typography module to Hero component #155

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

Conversation

wdawson
Copy link

@wdawson wdawson commented Jul 7, 2023

Problem

Alpine leverages the @nuxt-themes/typography module, which defines the available schema.

My understanding, based on how articles are rendered, is that the font.display is meant for headers. However, this token does not get applied to the title on the Hero component. Additionally, the description only receives this font-family style because it is a list. If you remove the list items, it also doesn't get overridden by the token, probably also because it doesn't have an element that the typography module picks up.

Solution

This is probably because there isn't an h1 element created as part of the Hero title. Perhaps that should be fixed, however, I noticed that someone could theoretically have a list as the title, where an h1 wouldn't be relevant.

Therefore I decided to add some fontFamily css to Hero.vue so that anything that is put in the content is appropriately tagged.

Please let me know if there's a different solution that would be better. I'm happy to learn more about this ecosystem 😄

Validation

Here is a screenshot of the playground after making the following changes to .starters/default/tokens.config.ts:

import { defineTheme } from 'pinceau'

export default defineTheme({ 
  typography: {
    font: {
      display: '{font.mono}',
      body: '{font.mono}',
    }
  }
})

Screenshot 2023-07-07 at 16 19 04

You can clearly see the monospace fonts now instead of the default sans-serif.

TODO

  • determine whether to update the version in package.json as part of this PR (I didn't see it in the contributing guidelines).

Other Notes

The same sort of thing is happening in Article headers, though in that case there is an h1 element that is added. I filed an issue with the typography repo to start: nuxt-themes/typography#65

Also in this PR

  • README.md update for the latest playground location.

@codesandbox
Copy link

codesandbox bot commented Jul 7, 2023

This branch is running in CodeSandbox. Use the links below to review this PR faster.


CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders | Preview

@vercel
Copy link

vercel bot commented Jul 7, 2023

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

Name Status Preview Updated (UTC)
alpine ✅ Ready (Inspect) Visit Preview Jul 7, 2023 11:40pm

@wdawson wdawson changed the title Feat/hero title font Add font family overrides from typography module to Hero component Jul 7, 2023
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.

1 participant