The vf-hero component is to be used as a visual queue and page header. The vf-hero can take a kicker, heading, sub-heading, text content, and a 'call to action' link as needed.
Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.
Using include
You'll need to pass a context object from your code or Yaml file (exampe), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_heading_href": "JavaScript:Void(0);",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
Using render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.
{% render '@vf-hero', {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_heading_href": "JavaScript:Void(0);",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
} %}
HTML
<sectionclass="vf-hero | vf-u-fullbleed"style="--vf-hero--bg-image-size: auto 28.5rem "><divclass="vf-hero__content | vf-box | vf-stack vf-stack--400 "><pclass="vf-hero__kicker"><ahref="JavaScript:Void(0);">VF Hamburg</a> | Structural Biology</p><h2class="vf-hero__heading"><aclass="vf-hero__heading_link"href="JavaScript:Void(0);"> About the Hentze group!
</a></h2><pclass="vf-hero__subheading">an example of some ancillary text</p><pclass="vf-hero__text">
The Hentze group combines biochemical and <ahref="JavaScript:Void(0);">systems–level approaches</a> to investigate the connections between <ahref="JavaScript:Void(0);">gene expression</a> and <ahref="JavaScript:Void(0);">cell metabolism</a>, and their roles in human disease.
</p><aclass="vf-hero__link"href="JavaScript:Void(0);">Learn more<svgwidth="24"height="24"xmlns="http://www.w3.org/2000/svg"><pathd="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z"fill=""fill-rule="nonzero"></path></svg></a></div></section>
Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.
Using include
You'll need to pass a context object from your code or Yaml file (exampe), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image": "url('https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/vf-hero-intense.png');"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
Using render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.
{% render '@vf-hero', {
"component-type": "container",
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_text": [
"The Hentze group combines biochemical and <a href=\"JavaScript:Void(0);\">systems–level approaches</a> to investigate the connections between <a href=\"JavaScript:Void(0);\">gene expression</a> and <a href=\"JavaScript:Void(0);\">cell metabolism</a>, and their roles in human disease."
],
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image": "url('https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/vf-hero-intense.png');"
} %}
HTML
<sectionclass="vf-hero | vf-u-fullbleed"style="--vf-hero--bg-image: url('https://acxngcvroo.cloudimg.io/v7/https://www.embl.org/files/wp-content/uploads/vf-hero-intense.png'); "><divclass="vf-hero__content | vf-box | vf-stack vf-stack--400 "><pclass="vf-hero__kicker"><ahref="JavaScript:Void(0);">VF Hamburg</a> | Structural Biology</p><h2class="vf-hero__heading">
About the Hentze group!
</h2><pclass="vf-hero__subheading">an example of some ancillary text</p><pclass="vf-hero__text">
The Hentze group combines biochemical and <ahref="JavaScript:Void(0);">systems–level approaches</a> to investigate the connections between <ahref="JavaScript:Void(0);">gene expression</a> and <ahref="JavaScript:Void(0);">cell metabolism</a>, and their roles in human disease.
</p><aclass="vf-hero__link"href="JavaScript:Void(0);">Learn more<svgwidth="24"height="24"xmlns="http://www.w3.org/2000/svg"><pathd="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z"fill=""fill-rule="nonzero"></path></svg></a></div></section>
Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.
Using include
You'll need to pass a context object from your code or Yaml file (exampe), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"spacing": 800,
"vf_hero_heading": "About the Hentze group!",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
Using render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.
Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.
Using include
You'll need to pass a context object from your code or Yaml file (exampe), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"spacing": 1200,
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
Using render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.
{% render '@vf-hero', {
"component-type": "container",
"spacing": 1200,
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
} %}
HTML
<sectionclass="vf-hero vf-hero--1200 | vf-u-fullbleed"style="--vf-hero--bg-image-size: auto 28.5rem "><divclass="vf-hero__content | vf-box | vf-stack vf-stack--400 "><h2class="vf-hero__heading">
About the Hentze group!
</h2><pclass="vf-hero__subheading">an example of some ancillary text</p><aclass="vf-hero__link"href="JavaScript:Void(0);">Learn more<svgwidth="24"height="24"xmlns="http://www.w3.org/2000/svg"><pathd="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z"fill=""fill-rule="nonzero"></path></svg></a></div></section>
Depending on your environment you'll want to use render or include. As a rule of thumb: server-side use include, precompiled browser use render. If you're using vf-eleventy you should use include.
Using include
You'll need to pass a context object from your code or Yaml file (exampe), as well as the path to the Nunjucks template. Nunjucks' include is an abstraction of render and provides some additional portability.
{% set context fromYourYamlFile %}
- or -
{% set context = {
"component-type": "container",
"spacing": 1600,
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
}
%}
{% include "../path_to/vf-hero/vf-hero.njk" %}
Using render
This approach is best for bare-bones Nunjucks environments, such as precompiled templates with the Nunjucks slim runtime where include is not be available.
{% render '@vf-hero', {
"component-type": "container",
"spacing": 1600,
"vf_hero_kicker": "<a href=\"JavaScript:Void(0);\">VF Hamburg</a> | Structural Biology",
"vf_hero_heading": "About the Hentze group!",
"vf_hero_subheading": "an example of some ancillary text",
"vf_hero_link_text": "Learn more",
"vf_hero_link_href": "JavaScript:Void(0);",
"vf_hero_image_size": "auto 28.5rem"
} %}
HTML
<sectionclass="vf-hero vf-hero--1600 | vf-u-fullbleed"style="--vf-hero--bg-image-size: auto 28.5rem "><divclass="vf-hero__content | vf-box | vf-stack vf-stack--400 "><pclass="vf-hero__kicker"><ahref="JavaScript:Void(0);">VF Hamburg</a> | Structural Biology</p><h2class="vf-hero__heading">
About the Hentze group!
</h2><pclass="vf-hero__subheading">an example of some ancillary text</p><aclass="vf-hero__link"href="JavaScript:Void(0);">Learn more<svgwidth="24"height="24"xmlns="http://www.w3.org/2000/svg"><pathd="M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0C5.376.008.008 5.376 0 12zm13.707-5.209l4.5 4.5a1 1 0 010 1.414l-4.5 4.5a1 1 0 01-1.414-1.414l2.366-2.367a.25.25 0 00-.177-.424H6a1 1 0 010-2h8.482a.25.25 0 00.177-.427l-2.366-2.368a1 1 0 011.414-1.414z"fill=""fill-rule="nonzero"></path></svg></a></div></section>
Usage
By default the vf-hero makes use of the roundels bacground image. To keep the raw struture of the HTML and CSS the same this is applied using a CSS custom property.
The vf-hero can take an image (provided by Design) which should be uploaded to the files site and applied using the custom property available (--vf-hero--bg-image).
IE 11 will get the background colour and the roundels image, it will not paint a different background image if added. This is progressive enhancement.
Content
Content name
Usage
.yml key
Heading
To be used for the heading of the page.
vf_hero_heading
Heading HREF
To be used as a 'return to home' link for the micro site.
vf_hero_heading_href
Subheading
Optional content to be used along with the Heading for a terse explainer.
vf_hero_subheading
Kicker
Optional content that helps define the context of overall content of the page.
vf_hero_kicker
Text
Optional content that can help explain the page content in a brief paragraph.
vf_hero_text
Link Text
The text for the hero 'call to action' link. Only works if there is associated Link HREF.
vf_hero_link_text
Link HREF
The url that the Link Text would be pointing to and opens in the same browser tab. This only works if there is associated Link Text
vf_hero_link_href
Content name
.yml key
CSS classname
Kicker
vf_hero_kicker
vf-hero__kicker
Heading
vf_hero_heading
vf-hero__heading
Heading HREF
vf_hero_heading_href
vf-hero__heading_link
Subheading
vf_hero_subheading
vf-hero__subheading
Text
vf_hero_text
vf-hero__text
Link Text
vf_hero_link_text
vf-hero__link
Link HREF
vf_hero_link_href
n/a
CSS Custom Properties
--vf-hero--bg-image — this is for the url for the background image. It can either be added, inline if you're writing the HTML, using the .yml data source of vf_hero_image, or by other needs (a input or upload in WordPress, for example).
---vf-hero--bg-image-size — this is to determine the sizing of the background image. As group sites are using the roundel image it needs specific dimensions so that it works. These dimensions are auto 28.5rem. We use a fallback here as background images in vf-hero should be full bleed by default so the fall back in the CSS is for cover — var(---vf-hero--bg-image-size, cover).
Installation info
This repository is distributed with npm. After installing npm, you can install vf-hero with this command.
$ yarn add --dev @visual-framework/vf-hero
Sass/CSS
The style files included are written in Sass. If you're using a VF-core project, you can import it like this: