cre8magic β Magic Values, Classes and More
Almost all design work is done using very few changes to the HTML. The only thing we usually must do, is:
- set some
id
properties - set some
class
properties - often based on the context (so the pane may needpane-is-empty
) - set some values - such as
data-bs-toggle
cre8magic makes this happen using these parts:
- The theme.json which has all the configurations
- The Magic Settings which will parse the json and provide the parts we need
- Various Desiger helpers which will do some magic and add context
- The Magic Tokens which will replace things such as
[Page.Id]
if it was used in class strings - Simple helper methods such as
Classes(name)
,Value(name)
orId(name)
on all the Magic Razor base classes like the MagicMenu, MagicBreadcrumbs or MagicContainer
How to Use
Basically all your controls must usually do is write HTML along these lines:
@inherits MagicContainer
<!-- some code parts skipped for brevity -->
<div id='@Id("container")' class='@Classes("container")'>
<div class="container">
<Oqtane.Themes.Controls.ModuleActions/>
<ModuleInstance/>
</div>
</div>
β¦and of course make sure the values for the above mentioned container
exist in the theme.json.
Everything else just works magically.
Razor API
All the Magic*
Razor controls have the following methods to make like easier:
- Classes(name)
- Value(name)
- Id(name)
A few have some extra methods, such as these:
- The
MagicTheme
also has aPaneClasses(name)
to also add something to change styling if the pane is empty
History
- All created in v0.0.1 2022-10