Skip to main content

Hero Area (minimal) Ready

This template shows how to build a simple responsive view that utilizes a minimal Hero Area component. Please note that the example below does not represent a real use case.

Hint: Press F on your keyboard to view both templates and components in fullscreen and ESC to exit the fullscreen mode. You can also open the template in a new browser window.


Open in new window
<!DOCTYPE html>
<html class="duet-sticky-footer" lang="fi">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>LähiTapiola</title>
<link rel="stylesheet" href="https://cdn.duetds.com/api/fonts/3.0.51/lib/localtapiola.css" integrity="sha384-5JYmtSD7nykpUvSmTW1CHMoBDkBZUpUmG0vuh+NUVtZag3F75Kr7+/JU3J7JV6Wq" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.duetds.com/api/css/4.0.45/lib/duet.min.css" integrity="sha384-UoMJnpXiN8f7fKVnTzfKfyi7LzQlApQ+WTS9O3PXlYr6CO9yzou4glfsHV747f3v" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdn.duetds.com/api/tokens/4.0.59/lib/tokens.custom-properties.css" integrity="sha384-AexjbYNj18dJLZR54wNVU44b/akdDc+tpbLIWhAnzjMAbwFSli2DHpSP+7NCK+Xw" crossorigin="anonymous" />
<script type="module" src="https://cdn.duetds.com/api/components/8.7.1/lib/duet/duet.esm.js" integrity="sha384-c3hLghWHTPntUxndMlK4myD7d59stA2U0EvBp2rPb3ibtacAwh56geBpq6z7nXLn" crossorigin="anonymous"></script>
<script nomodule src="https://cdn.duetds.com/api/components/8.7.1/lib/duet/duet.js" integrity="sha384-H7RH4Ssj/LmElXa1VCHFSIjvtCSoLXMiPXG/KQZTS9EvYujTo7tWaj0V6/GGkY16" crossorigin="anonymous"></script>
</head>
<body>

<style>
.duet-hero-example-with-margin{
margin-bottom: 16px;
}
</style>
<duet-header language="fi" skip-to-id="#content" contact="Ota yhteyttä" current-href="/vakuutukset/"> </duet-header>
<duet-hero
heading="Ajoneuvovakuutus"
variation="minimal"
class="duet-hero-example-with-margin"
left-align="true"
>


</duet-hero>
<duet-layout margin="none">
<div slot="main">
<duet-card padding="large">
<duet-spacer breakpoint="x-small" size="medium"></duet-spacer>
<duet-heading level="h2">Pääpalsta</duet-heading>
<duet-paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
<duet-link url="#">ullamco laboris nisi ut aliquip</duet-link>
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim
id est laborum.
</duet-paragraph>
<duet-paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.
</duet-paragraph>
<duet-heading level="h3">Otsikko 3</duet-heading>
<duet-paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
</duet-paragraph>
<duet-heading level="h4">Otsikko 4</duet-heading>
<duet-paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua.
</duet-paragraph>
<duet-heading level="h5">Otsikko 5</duet-heading>
<duet-paragraph>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.
</duet-paragraph>
<duet-heading level="h6">Otsikko 6</duet-heading>
<duet-paragraph> Lorem ipsum dolor sit amet, consectetur adipiscing elit. </duet-paragraph>
</duet-card>
</div>
<div slot="sidebar">
<duet-card padding="large" heading="Sivupalsta">
Sivupalstaa voidaan käyttää pääsisältöön liittyvän tiedon näyttämiseen tai vaihtoehtoisesti nostamaan esiin
aiheeseen liittyvää muuta sisältöä.
</duet-card>
</div>
</duet-layout>
<duet-footer logo-href="#" language="fi"></duet-footer>
<script>
// Save references to components we want to adjust below
var header = document.querySelector("duet-header")
var footer = document.querySelector("duet-footer")

// Set the contact menu items
header.contactItems = [
{ label: "Lähetä viesti", href: "/viestit/laheta" },
{ label: "Avaa chat", href: "/chat/" },
{ label: "Yhteystiedot", href: "/yhteystiedot/" },
]

// Set the language menu items
header.languageItems = [
{ label: "Suomeksi", country: "fi", href: "/?lang=fi" },
{ label: "På Svenska", country: "sv", href: "/?lang=sv" },
{ label: "In English", country: "en", href: "/?lang=en" },
]

// Set label and href for session link
header.session = {
label: "Kirjaudu ulos",
href: "/?logout",
type: "logout",
}

// Set label and href for user profile link
header.user = {
label: "Laura",
href: "/?userId=1234",
}

// prevent header links causing a navigation
function preventDefault(e) {
e.detail.originalEvent.preventDefault()
}

header.addEventListener("duetSessionClick", preventDefault)
header.addEventListener("duetUserClick", preventDefault)
header.addEventListener("duetLanguageSelect", preventDefault)
header.addEventListener("duetLogoClick", preventDefault)
header.addEventListener("duetContactClick", preventDefault)
header.addEventListener("duetItemClick", preventDefault)

// Set the main links in footer
footer.items = [
{ label: "Hae korvausta", href: "#", icon: "navigation-make-claim" },
{ label: "Osta vakuutus", href: "#", icon: "action-buy-insurance" },
{ label: "Yhteystiedot", href: "#", icon: "form-tel" },
]

// Set the help menu items in footer
footer.menu = [
{ label: "Turvallisuus ja käyttöehdot", href: "#" },
{ label: "Evästeet", href: "#" },
{ label: "Henkilötietojen käsittely", href: "#" },
]

// Select the above hero area
var hero = document.querySelector("duet-hero")

// Set the back button
hero.back = {
label: "Takaisin",
href: "#",
id: "back-button",
analyticsId: "custom-analytics-id",
}

// Set the action links
hero.actions = [
{ label: "Ilmoita vahingosta", href: "#", icon: "navigation-make-claim" },
{ label: "Päivitä vakuutusta", href: "#", icon: "action-edit-2" },
{ label: "Tee rekisteröintimuutos", href: "#", icon: "messaging-terms", external: true },
]

// Listen for click events in the back button inside hero area
hero.addEventListener("duetClick", function (e) {
if (e.detail.data.id === "back-button") {
e.detail.originalEvent.preventDefault()
console.log("Click detected in hero area back button:", e.detail)
}
})

</script>
</body>
</html>

Integration

To install this template’s dependencies into your project, run:

npm install @duetds/components
npm install @duetds/css
npm install @duetds/fonts

For further guidelines, please see each package’s documentation.



Tutorials

Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:

Tutorials

Building Layouts

Tutorials

Using CLI Tools

Tutorials

Creating Custom Patterns

Tutorials

Server Side Rendering

Tutorials

Sharing Prototypes

Tutorials

Usage With Markdown


Troubleshooting

If you experience any issues while using a template, please head over to the Support page for more guidelines and help.