@axa-ch/footer-small

中文文档
7.0.11发布于 2023/03/06Copyright 2019 AXA Versicherungen AGCommonJS近 30 天下载 2867

The footer-small component for the AXA Pattern Library

此软件包已被标记为弃用

Please use the new scope @axa-ch-webhub-cloud

原始使用文档
文档目录8 节
  1. Properties
  2. dynamic
  3. [React exclusive] onLanguageClick
  4. [React exclusive] onDisclaimerClick
  5. Examples
  6. React
  7. Pure HTML pages
  8. How-To

Footer - Small

This is the small version of the footer. This footer belongs to the very bottom of the webpage.

Properties

dynamic

Add this boolean attribute if you want to have control over what happens if a user clicks one of the language- or disclaimer-items.

[React exclusive] onLanguageClick

Add a callback method that should run as soon as a language link gets clicked.

[React exclusive] onDisclaimerClick

Add a callback method that should run as soon as a disclaimer link gets clicked.

Examples

React

import React, { createElement, useState } from 'react';
import createAXAFooterSmallReact from '@axa-ch/footer-small/lib/index.react';

const AXAFooterSmallReact = createAXAFooterSmallReact(createElement);

const DemoFooterSmall = () => {
  const [activeLanguage, setActiveLanguageIndex] = useState('-');

  const [disclaimerChange, setDisclaimerIndex] = useState('-');

  const handleAXAFooterLanguageClicked = (language) => {
    setActiveLanguageIndex(language);
  };

  const handleAXAFooterDisclaimerClicked = (disclaimer) => {
    setDisclaimerIndex(disclaimer);
  };

  return (
    <div>
      <p>Language - Index Clicked: {activeLanguage}</p>
      <p>Disclaimer - Index Clicked: {disclaimerChange}</p>
      <AXAFooterSmallReact
        onLanguageClick={handleAXAFooterLanguageClicked}
        onDisclaimerClick={handleAXAFooterDisclaimerClicked}
        dynamic
      >
        <a
          slot="language-item"
          className="m-footer-small__link--active"
          href="https://axa.ch/de/privatkunden.html"
        >
          DE
        </a>
        <a slot="language-item" href="https://axa.ch/fr/particuliers.html">
          FR
        </a>
        <a slot="language-item" href="https://axa.ch/it/clienti-privati.html">
          IT
        </a>
        <a slot="language-item" href="https://axa.ch/en/private-customers.html">
          EN
        </a>
        <a
          slot="disclaimer-item"
          href="https://axa.ch/en/information/terms-of-use.html"
        >
          Terms of use
        </a>
        <a
          slot="disclaimer-item"
          href="https://axa.ch/en/information/data-protection.html"
        >
          Data protection
        </a>
        <span slot="copyright">&copy; 2019 AXA Insurance Ltd.</span>
      </AXAFooterSmallReact>
    </div>
  );
};

Pure HTML pages

Static approach

If you want a footer with static links, that will automatically route to wherever the href attributes are pointing:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Your awesome title</title>
  </head>
  <body>
    <axa-footer-small>
      <a
        slot="language-item"
        href="https://axa.ch/de/privatkunden.html"
        class="m-footer-small__link--active"
      >
        DE
      </a>
      <a slot="language-item" href="https://axa.ch/fr/particuliers.html">
        FR
      </a>
      <a slot="language-item" href="https://axa.ch/it/clienti-privati.html">
        IT
      </a>
      <a slot="language-item" href="https://axa.ch/en/private-customers.html">
        EN
      </a>
      <a
        slot="disclaimer-item"
        href="https://axa.ch/en/information/terms-of-use.html"
      >
        Terms of use
      </a>
      <a
        slot="disclaimer-item"
        href="https://axa.ch/en/information/data-protection.html"
      >
        Data protection
      </a>
      <span slot="copyright">&copy; 2019 AXA Insurance Ltd.</span>
    </axa-footer-small>

    <script src="node_modules/@axa-ch/footer-small/dist/index.js"></script>
  </body>
</html>

dynamic approach

This approach will not redirect the user automatically, if he/she clicks on a link, but instead fire an event. If you want to listen for such events, pass in the additional dynamic boolean attribute and set your listeners like this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Your awesome title</title>
  </head>
  <body>
    <script>
      const wrapper = document.createElement('div');
      const activeLanguage = document.createElement('p');
      activeLanguage.id = 'active-language';
      activeLanguage.innerText = `Language - Index Clicked: ${selectedLanguageKey}`;
      const clickedDisclaimer = document.createElement('p');
      clickedDisclaimer.id = 'clicked-disclaimer';
      clickedDisclaimer.innerText = `Disclaimer - Index Clicked: -`;

      const footerSmall = document.createElement('axa-footer-small');
      footerSmall.dynamic = true;

      const deLanguageLink = document.createElement('a');
      deLanguageLink.slot = 'language-item';
      deLanguageLink.href = 'https://axa.ch/de/privatkunden.html';
      deLanguageLink.classList.add('m-footer-small__link--active');
      deLanguageLink.textContent = 'DE';

      const frLanguageLink = document.createElement('a');
      frLanguageLink.slot = 'language-item';
      frLanguageLink.href = 'https://axa.ch/de/privatkunden.html';
      frLanguageLink.textContent = 'FR';

      const itLanguageLink = document.createElement('a');
      itLanguageLink.slot = 'language-item';
      itLanguageLink.href = 'https://axa.ch/de/privatkunden.html';
      itLanguageLink.textContent = 'IT';

      const enLanguageLink = document.createElement('a');
      enLanguageLink.slot = 'language-item';
      enLanguageLink.href = 'https://axa.ch/de/privatkunden.html';
      enLanguageLink.textContent = 'EN';

      const termsOfUseLink = document.createElement('a');
      termsOfUseLink.slot = 'disclaimer-item';
      termsOfUseLink.href = 'https://axa.ch/en/information/terms-of-use.html';
      termsOfUseLink.textContent = 'Terms of use';

      const dataProtectionLink = document.createElement('a');
      dataProtectionLink.slot = 'disclaimer-item';
      dataProtectionLink.href =
        'https://axa.ch/en/information/data-protection.html';
      dataProtectionLink.textContent = 'Data protection';

      const copyRightText = document.createElement('span');
      copyRightText.slot = 'copyright';
      copyRightText.textContent = '&copy; 2019 AXA Insurance Ltd.';

      footerSmall.appendChild(deLanguageLink);
      footerSmall.appendChild(frLanguageLink);
      footerSmall.appendChild(itLanguageLink);
      footerSmall.appendChild(enLanguageLink);
      footerSmall.appendChild(termsOfUseLink);
      footerSmall.appendChild(dataProtectionLink);
      footerSmall.appendChild(copyRightText);

      wrapper.appendChild(activeLanguage);
      wrapper.appendChild(clickedDisclaimer);
      wrapper.appendChild(footerSmall);

      footerSmall.addEventListener('axa-language-click', (languageEvent) => {
        const languageResult = document.getElementById('active-language');
        languageResult.innerText = `Language - Index Clicked: ${languageEvent.detail}`;
      });

      footerSmall.addEventListener(
        'axa-disclaimer-click',
        (disclaimerEvent) => {
          const clickedDisclaimers =
            document.getElementById('clicked-disclaimer');
          clickedDisclaimers.innerText = `Disclaimer - Index Clicked: ${disclaimerEvent.detail}`;
        }
      );

      document.querySelector('body').appendChild(wrapper);
    </script>

    <script src="node_modules/@axa-ch/footer-small/dist/index.js"></script>
  </body>
</html>

How-To

Highlight a language (mark it as active)?

Set the class .m-footer-small__link--active to the language item children, that you want to highlight. Example:

<a slot="language-item" href="https://axa.ch/de/privatkunden.html" class="m-footer-small__link--active">

版本与发布记录

@axa-ch/footer-small 共发布 88 个版本,首次发布于 2019/04/26;过去 12 个月发布了 0 个版本。

版本发布日期距今
7.0.11latest2023/03/063 年前
7.0.102023/02/133 年前
7.0.92022/11/163 年前
7.0.82022/09/304 年前
7.0.72022/09/204 年前
7.0.62022/09/144 年前

关于 @axa-ch/footer-small 的常见问题

@axa-ch/footer-small 是什么?

The footer-small component for the AXA Pattern Library注意:该包已被作者标记为弃用——Please use the new scope @axa-ch-webhub-cloud

如何安装 @axa-ch/footer-small?

在项目目录运行 npm install @axa-ch/footer-small,或使用 pnpm add / yarn add / bun add。

@axa-ch/footer-small 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/axa-ch__footer-small 是否存在。

@axa-ch/footer-small 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@axa-ch/footer-small 可以商用吗?

@axa-ch/footer-small 使用 Copyright 2019 AXA Versicherungen AG 许可。声明的许可为 Copyright 2019 AXA Versicherungen AG,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@axa-ch/footer-small 的下载量有多少?

根据 npm 官方下载统计,@axa-ch/footer-small 在 2026/10/08 – 2026/11/06 这 30 天内被下载 2,867 次,日均约 96 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@axa-ch/footer-small 还在维护吗?

最新版本 7.0.11 发布于 2023/03/06(3 年前);至今共发布 88 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/04/26。作者已将其标记为弃用,新项目建议寻找替代方案。