Add font family overrides from typography module to Hero component #155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toHero.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
:You can clearly see the monospace fonts now instead of the default sans-serif.
TODO
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#65Also in this PR