The content block is a component built initially for the UoL homepage but likely to be extended into other components. Currently this is being used on the new homepage concept in the task banner, and likely to be extended in to Student Stories and other homepage components. It’s purpose is to ensure typography and styling consistency.
The component is simple and only has one mandatory field, and several optional ones as listed below.
Items appear in the following order within the content block.
optional text field
mandatory field, consists of two parameters.
optional date field (text field, use format dd/mm/yyyy)
optional text field for body content
optional field which displays as a standard link, consists of two parameters:
optional field which displays as a link with animated arrow, consists of two parameters:
uses @uol-button).
The following configuration shows all possible elements which can appear in this component.
'context': {
'name': "all",
'label': "all",
'context': {
'topic': 'Optional topic',
'heading': {
'level': '2',
'title': 'Mandatory title'
},
'date': '01/01/2000',
'copy': 'Optional body copy',
'link': {
'url': '#',
'title': 'Optional text link'
},
'arrowLink': {
'url': '#',
'title': 'Optional text link with arrow'
},
'button': {
'style': 'default',
'type': 'submit',
'content': 'Optional CTA button'
},
}
}
<div {% if id %}id="{{ id }}"{% endif %} class="uol-content-block">
{% if topic %}<p class="uol-content-block__topic">{{topic}}</p>{% endif %}
{% set headingTag = 'h' + heading.level if heading.level else 'h3' %}
<{{headingTag}} class="uol-content-block__heading">{{heading.title}}</{{ headingTag }}>
{% if date %}<p class="uol-content-block__date">{{date}}</p>{% endif %}
{% if copy %}<p class="uol-content-block__copy">{{copy}}</p>{% endif %}
{% if link %}<p><a href="{{link.url}}" class="uol-content-block__link">{{link.title}}</a></p>{% endif %}
{% if arrowLink %}<p><a href="{{arrowLink.url}}" class="uol-content-block__arrow-link uol-arrow-link">{{arrowLink.title}}</a></p>{% endif %}
{% if button %}{% render '@uol-button', button %}{% endif %}
</div>
<div class="uol-content-block">
<h2 class="uol-content-block__heading">Mandatory title</h2>
</div>
// adding comment line to initiate dev build again
.uol-content-block {
* {
margin: 0 0 $spacing-4;
}
h1 {@extend .uol-typography-heading-1;}
h2 {@extend .uol-typography-heading-2;}
h3 {@extend .uol-typography-heading-3;}
h4 {@extend .uol-typography-heading-4;}
&__topic {
@extend .uol-typography-paragraph-small;
margin-bottom: $spacing-2;
}
&__date {
@extend .uol-typography-paragraph-small;
}
&__copy {
@extend .uol-typography-paragraph;
}
&__link {
@extend .uol-typography-paragraph;
@include link_focus();
font-weight: 600;
display: block;
}
&__arrow-link {
@extend .uol-typography-paragraph;
@include link_focus();
font-weight: 600;
display: block;
}
.uol-button {
margin-top: $spacing-2;
}
}
{
"heading": {
"level": "2",
"title": "Mandatory title"
}
}