The vf-intro component is to be used as the main title of a page or section where you need to include some additional text in a larger typeface. The vf-hero can take a heading, lede text, and paragraph(s) of text. It can also include a badge on the heading which can be a link.
vf-eleventy
To use this component in a vf-eleventy
project you will need to set the context for the content to pass through from the nunjucks file associated yaml file and include it.
{% set context = UniqueContextName %}
{% include containers.vf_intro %}
note: due to how nunjucks handles special characters we have remove the @
at sign and need to replace the -
hyphen used for an _
underscore to { include }
a component or container. As shown above instead of writing something like { include containers.@vf-intro }
we need to type { include containers.intro }
You may wish to make use of some of your projects side specific data or content. To do this you will need to set the relevant items of content before you {% include ... %}
the component. Note: If you also declare this content in the .yml
file it will take precedence over the inlined code.
For example. If you wanted to make use of your projects siteConfig
information. You can write out the inclusion of the component in you pages .njk
file like so:
{% set context = UniqueContextName %}
{% set vf_intro_heading = siteConfig.siteInformation.short_description %}
{% include containers.intro %}
The vf-intro
allows for a variety of text.
content type | variable | description |
---|---|---|
text | vf_intro_heading |
|
text | vf_intro_phase |
|
url | vf_intro_heading_href |
|
text | vf_intro_lede |
|
group | vf_intro_text |
|
text | intro_text |
The vf-intro_phase
, vf_intro_heading_href
, vf_intro_lede
, vf_intro_text
, and intro_text
are all optional.
To include intro_text
you will have to nest and indent the content inside/underneath the vf_intro_text
in the .yml
file, like:
vf_intro_text:
- This is an example of intro text paragraph.
- This is an example of a second intro text paragraph.
EMBL’s future directions will be driven by the goal of understanding life in the context of its environment. While the effects of the environment on living systems have been well studied at the level of individual organisms and populations, many of the underlying molecular processes remain obscure.
We now have the tools and technologies to explore these processes, allowing us to understand life in its natural context from the level of molecules to whole ecosystems. This new understanding will be critically important if we are to tackle societal challenges such as environmental degradation and loss of biodiversity, climate change, and threats to human health such as the emergence of new epidemics.
EMBL’s new transversal research themes will enable us to realise this vision of understanding life in context. The transversal research themes will be highly interdisciplinary and will encourage dynamic internal and external collaborations. These themes will enable transformative discoveries by bringing together experts in fields such as ecology, epidemiology, toxicology, zoology, population genetics, engineering, and mathematical theory. There will be strong support for building collaborations within each theme, as well as with the wider scientific community, not only to enable scientific discovery but also to build these themes across the EMBL sites.
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
.
include
You'll need to pass a context object from your code or Yaml file (example), 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",
"id": "an-id-for-anchor",
"vf_intro_heading": "Transversal research themes",
"vf_intro_badge": {
"style": [
"phases"
],
"text": "beta",
"theme": "primary",
"badge_href": "JavaScript:Void(0);"
},
"vf_intro_subheading": "Understanding life in the context of its environment",
"vf_intro_lede": "EMBL’s future directions will be driven by the goal of understanding life in the context of its environment. While the effects of the environment on living systems have been well studied at the level of individual organisms and populations, many of the underlying molecular processes remain obscure.",
"vf_intro_text": [
"We now have the tools and technologies to explore these processes, allowing us to understand life in its natural context from the level of molecules to whole ecosystems. This new understanding will be critically important if we are to tackle societal challenges such as environmental degradation and loss of biodiversity, climate change, and threats to human health such as the emergence of new epidemics.",
"EMBL’s new transversal research themes will enable us to realise this vision of understanding life in context. The transversal research themes will be highly interdisciplinary and will encourage dynamic internal and external collaborations. These themes will enable transformative discoveries by bringing together experts in fields such as ecology, epidemiology, toxicology, zoology, population genetics, engineering, and mathematical theory. There will be strong support for building collaborations within each theme, as well as with the wider scientific community, not only to enable scientific discovery but also to build these themes across the EMBL sites."
]
}
%}
{% include "../path_to/vf-intro/vf-intro.njk" %}
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-intro', {
"component-type": "container",
"id": "an-id-for-anchor",
"vf_intro_heading": "Transversal research themes",
"vf_intro_badge": {
"style": [
"phases"
],
"text": "beta",
"theme": "primary",
"badge_href": "JavaScript:Void(0);"
},
"vf_intro_subheading": "Understanding life in the context of its environment",
"vf_intro_lede": "EMBL’s future directions will be driven by the goal of understanding life in the context of its environment. While the effects of the environment on living systems have been well studied at the level of individual organisms and populations, many of the underlying molecular processes remain obscure.",
"vf_intro_text": [
"We now have the tools and technologies to explore these processes, allowing us to understand life in its natural context from the level of molecules to whole ecosystems. This new understanding will be critically important if we are to tackle societal challenges such as environmental degradation and loss of biodiversity, climate change, and threats to human health such as the emergence of new epidemics.",
"EMBL’s new transversal research themes will enable us to realise this vision of understanding life in context. The transversal research themes will be highly interdisciplinary and will encourage dynamic internal and external collaborations. These themes will enable transformative discoveries by bringing together experts in fields such as ecology, epidemiology, toxicology, zoology, population genetics, engineering, and mathematical theory. There will be strong support for building collaborations within each theme, as well as with the wider scientific community, not only to enable scientific discovery but also to build these themes across the EMBL sites."
]
} %}
<section class="vf-intro" id="an-id-for-anchor">
<div><!-- empty --></div>
<div class="vf-stack">
<h1 class="vf-intro__heading vf-intro__heading--has-tag">Transversal research themes
<a href="JavaScript:Void(0);" class="vf-badge vf-badge--primary vf-badge--phases">beta</a>
</h1>
<h2 class="vf-intro__subheading">Understanding life in the context of its environment</h2>
<p class="vf-lede">EMBL’s future directions will be driven by the goal of understanding life in the context of its environment. While the effects of the environment on living systems have been well studied at the level of individual organisms and populations, many of the underlying molecular processes remain obscure.</p>
<p class="vf-intro__text">We now have the tools and technologies to explore these processes, allowing us to understand life in its natural context from the level of molecules to whole ecosystems. This new understanding will be critically important if we are to tackle societal challenges such as environmental degradation and loss of biodiversity, climate change, and threats to human health such as the emergence of new epidemics.</p>
<p class="vf-intro__text">EMBL’s new transversal research themes will enable us to realise this vision of understanding life in context. The transversal research themes will be highly interdisciplinary and will encourage dynamic internal and external collaborations. These themes will enable transformative discoveries by bringing together experts in fields such as ecology, epidemiology, toxicology, zoology, population genetics, engineering, and mathematical theory. There will be strong support for building collaborations within each theme, as well as with the wider scientific community, not only to enable scientific discovery but also to build these themes across the EMBL sites.</p>
</div>
</section>
This repository is distributed with npm. After installing npm and yarn, you can install with this command.
$ yarn add --dev @visual-framework/vf-intro
The source files included are written in Sass(scss
). You can point your Sass include-path
at your node_modules
directory and import it like this.
@import "@visual-framework/vf-intro/index.scss";
Make sure you import Sass requirements along with the modules. You can use a project boilerplate or the vf-sass-starter
vf-badge--phases
after upstream removal in vf-badge@2.0.0.vf-intro__heading--has-tag .vf-badge
to facilitate assorted widths and multiline headingsid
attribute.render ..
.a
elements that have a .vf-*
classcolumn-gap
as this was missedvf-stack
to layout out the vertical stacking of the content--vf-stack-margin--custom
to align things as requiredembl-grid
and lets vf-intro
roll it's owngap
in embl-grid
so it only worries about the column gapvf-badge
to be customised with it's variantsvf-badge
from demo codevf-lede
work
File system location: components/vf-intro
Find an issue on this page? Propose a change or discuss it.