npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kb-dk/kb-footer

v2.12.0

Published

A footer with kb design and links.

Downloads

5

Readme

kb-footer

kb-footer is a web component which shows KB design footer. Moreover, column items come from kb.dk footer API. In kb design manual, every application has to use exactly the same footer at in kb.dk, except for the first column which can be application specific.

Properties

| Property | Attribute | Description | Type | Default | |:--------:|:---------:|:--------------------------:|:-------------:|:---------:| | language | language | The language of the page. | "da" / "en" | "da" | | cookieId | cookieId | The id for the cookie. | string | "" |

Additional considerations

KB design allows the first column to be overwritten by the application but the other three must be the same as in kb.dk.

  • You can provide a ul element within the kb-footer which will be used as the first column.
  • ul element must have the following line inside <style>kb-footer > ul {display: none;}</style>.
  • ul element must have its id sat toappFooterColumnDA for Danish or appFooterColumnEN for English.
  • If an ul element has its id sat to appFooterColumn, it will be used as the replacement for the missing language.

Local configuratin needed

You need two configuration files in the root folder of this web component. One called .env.dev and one called .env.prod. In those files you need to specify the variables BASEURL and JSONAPIURL taylored to your local and production environment. The variables are needed to fetch non default footer data. Both filenames/locations are already added to .gitignore

Cookie script

To add Cookie script, you need to pass the id of your site from https://cookie-script.com/ as a property to the footer. for example: <kb-footer cookieId="903181bb69e77c4a5adfc4ea71d034xx"></kb-footer> It will insert the cookie script to the page.

if you want to add the option of opening the cookie banner by clicking on Cookie Settings in the footer, then you need to add the following div to the kb-footer:

<kb-footer cookieId="903181bb69e77c4a5adfc4ea71d034xx">
   <div id="csconsentlink" style="display: none;"></div>
</kb-footer>

Examples

  1. Exactly as in kb.dk
<kb-footer></kb-footer> 
  1. Footer with Application specific column
  <kb-footer>
    <ul id="appFooterColumn">
        <style>kb-footer > ul {display: none;}</style>
        <li><a href="#">Om KBs Digitale samlinger</a></li>
        <li><a href="#">Mediestream</a></li>
        <li><a href="#">Danmark Set Fra Lunften</a></li>
    </ul>
  </kb-footer> 
  1. English footer
    <kb-footer language="en"></kb-footer> 
  2. Footer with application specific footer for each language (English and Danish)
    <kb-footer>
       <ul id="appFooterColumnDA" >
          <style>kb-footer > ul {display: none;}</style>
          <li><a href="#">Om KBs Digitale samlinger</a></li>
          <li><a href="#">Mediestream</a></li>
          <li><a href="#">Danmark Set Fra Lunften</a></li>
       </ul>
       <ul id="appFooterColumnEN">
          <style>kb-footer > ul {display: none;}</style>
          <li><a href="#">About Digital collections</a></li>
          <li><a href="#">Danmark from above</a></li>
       </ul>
    </kb-footer>
  3. Change the language dynamically from within your application
    1. HTML
      <label for="language">Language:</label>
      <select id="language">
         <option value="da" selected>Dansk</option>
         <option value="en">English</option>
      </select>
      <kb-footer>
      <ul id="appFooterColumnDA" >
         <style>kb-footer > ul {display: none;}</style>
         <li><a href="#">Om KBs Digitale samlinger</a></li>
         <li><a href="#">Mediestream</a></li>
         <li><a href="#">Danmark Set Fra Lunften</a></li>
      </ul>
      <ul id="appFooterColumnEN">
         <style>kb-footer > ul {display: none;}</style>
         <li><a href="#">About Digital collections</a></li>
         <li><a href="#">Danmark from above</a></li>
      </ul>
      </kb-footer>
    2. Javascript
      <script>
          document.getElementById('language').addEventListener('change', function() {
             let footer = document.querySelector("kb-footer");
             footer.language = this.value;
          });
       </script>