CoreComponents: Add Levels for "headers" #5812
Closed
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.
Using the "headers" function of the CoreComponents always creates h1 headers. That's a bit limiting.
This pull request introduces the new attribute "level" for the header function which is used to determine what heading level should be shown. There are officially 6 levels, the default is always h1 (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements).
Here is how it looks:
And here is the code to check it out yourself:
At the momemt, running
mix test
results in serveral warnings that all look like this:It would be great if someone with more Elixir/Phoenix knowledge could have a look at this, because I don't really understand the issue. The attribute "level" has been defined, the type info and default value have been added. Accessing it via "@Level" doesn't differ from accessing @Class, for example. A pointer into the right direction would be helpful, I'm of course willing to add the necessary changes to fix these warnings.