This document explains how to use the component system for building templates in the DEV Partner Portal application.
The component system allows you to:
/views
/components
/layout # Page layout components (header, footer)
/ui # UI elements (section cards, message boxes)
/forms # Form-related components
/uploadcare # Uploadcare-related components
/templates # Page templates that use components
To include a component in a template, use the following syntax:
{{> components/path/to/component param1="value1" param2="value2"}}
For example:
{{> components/layout/header title="My Page" subtitle="Welcome"}}
You can use conditional logic in your templates with the following syntax:
{{#if condition}} <!-- Content to show if condition is true --> {{#else}} <!-- Content to show if condition is false --> {{/if}}
You can also check for equality:
{{#if type == "success"}} <!-- Content for success type --> {{#else}} <!-- Content for other types --> {{/if}}
Component-specific styles are organized in the following structure:
/public/css
/components # Component-specific styles
section-cards.css
uploadcare-custom.css
forms.css
continue-page.css # Page-specific styles that import component styles
To create a new component:
/views/components/{{paramName}} syntax for parameters that should be replaceable{{#if condition}} for conditional content/public/css/components/<!-- /views/components/ui/alert.html --> <div class="alert alert-{{type}}"> {{#if title}} <h4 class="alert-title">{{title}}</h4> {{/if}} <p class="alert-message">{{message}}</p> </div>
Usage:
{{> components/ui/alert type="warning" title="Attention" message="This is important"}}