Intro container

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.

github location npm version

Usage

Use in 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 %}

Content

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.

Variants

Transversal research themes beta

Understanding life in the context of its environment

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.

Nunjucks syntax

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 (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" : [object Object],
"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" %}
                

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-intro', {
  "component-type" : "container",
  "id" : "an-id-for-anchor",
  "vf_intro_heading" : "Transversal research themes",
  "vf_intro_badge" : [object Object],
  "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.,}
%}
                
HTML
<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>
              

Examples

Installation info

This repository is distributed with npm. After installing npm and yarn, you can install with this command.

$ yarn add --dev @visual-framework/vf-intro

Sass/CSS

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

Changelog

Changelog

1.5.0

  • Remove vf-badge--phases after upstream removal in vf-badge@2.0.0
  • https://github.com/visual-framework/vf-core/pull/1546
  • Improve placement of .vf-intro__heading--has-tag .vf-badge to facilitate assorted widths and multiline headings
  • https://github.com/visual-framework/vf-core/pull/1579

1.4.7

  • Fixes CSS to match stylelint rules.
  • https://github.com/visual-framework/vf-core/pull/1405

1.4.6

  • Add support for anchor id attribute.

1.4.5

  • Move the example content into a default variant to stop it printing out when using render ...

1.4.4

  • Fixes a missing vf_intro_subheading vf-intro.njk's context.
  • Fixes README.md invalid example syntax.
  • https://github.com/visual-framework/vf-core/pull/1326

1.4.3

  • Resolve issue of missing import in index.scss
  • https://github.com/visual-framework/vf-core/pull/1306

1.4.2

  • bug: don't apply styling to a elements that have a .vf-* class

1.4.1

  • added column-gap as this was missed

1.4.0

  • adds the option to have a nicer styled 'sub-heading'
  • introduces the use of vf-stack to layout out the vertical stacking of the content
  • use --vf-stack-margin--custom to align things as required
  • removes use of embl-grid and lets vf-intro roll it's own

1.3.2

  • resets the custom property used for gap in embl-grid so it only worries about the column gap

1.3.1

  • updates max-width of component

1.3.0

  • adds ability for vf-badge to be customised with it's variants
  • allows for fallbacks so older versions will still work
  • removes old way of doing vf-badge from demo code
  • makes vf-lede work

1.2.0

  • wraps all content except heading in if statement
  • changes how badges are implemented inside an if statement

1.1.0

  • adds if statement to pass context data through to component
  • improves documentation

1.0.2

  • Simplify grid

1.0.0

  • Initial stable release

Assets



File system location: components/vf-intro

Find an issue on this page? Propose a change or discuss it.