@axa-ch/materials

中文文档
16.0.8发布于 2022/09/30Copyright 2019 AXA Versicherungen AG近 30 天下载 5426

The materials component for the AXA Pattern Library

此软件包已被标记为弃用

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

原始使用文档
文档目录15 节
  1. Usage
  2. React
  3. React with Typescript
  4. Styles - Scss Mixins and Variables
  5. Colors
  6. animations
  7. Breakpoints
  8. Typography
  9. Variables
  10. Icon/Image set
  11. Sizes
  12. SVGs
  13. Contribution
  14. Process of adding a new image
  15. Updating materials (UNIX only)

AXA Materials

Materials provides common used icons and images in the SVG format. In addition materials exports styles like colors, helpers, typography and layouts.

Usage

Important: If this component needs to run in Internet Explorer 11, you need to use our polyfill.

npm install @axa-ch/materials
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
import { Arrow_forwardSvg } from '@axa-ch/materials/icons/material-design';

<span>${unsafeHTML(Arrow_forwardSvg)}</span>;

React

import ArrowForwardSvg from '@axa-ch/materials/icons-raw/material-design/arrow-forward.svg';

<ArrowForwardSvg />;

React with Typescript

import { ReactComponent as ArrowForwardSvg } from '@axa-ch/materials/icons-raw/material-design/arrow-forward.svg';

<ArrowForwardSvg />;

You need to use SVGR that takes external SVG files and transforms them into React components with Webpack. It is installed automatically if you use create-pod-app.

If you need to install it manually:

npm install @svgr/webpack --save-dev
{
  test: /\.svg$/,
  use: ['@svgr/webpack'],
}

Styles - Scss Mixins and Variables

Colors

@import '@axa-ch/materials/styles/00-colors.scss';

body {
  background-color: $color-axa-blue;
}

animations

@import '@axa-ch/materials/styles/20-animations.scss';

Breakpoints

@import '@axa-ch/materials/styles/variables.scss';

body {
  // Rules for devices bigger than portrait mobile
  @media (min-width: $breakpoint-xs) {
    margin: 8px;
  }
}

Typography

@import '@axa-ch/materials/styles/typography.scss';

body {
  font-family: $font-family-primary;
}

Variables

@import '@axa-ch/materials/styles/variables.scss';

body {
  margin: $spacing-1;
}

.box {
  box-shadow: $box-shadow-1;
}

Icon/Image set

Sizes

Please note the size classes of icons and images here. Please just use these dimensions.

SVGs

(Complete list is visible here)

icons
AddSvg
ArrowLeftSvg
ArrowRightSvg
AttachFileSvg
CancelSvg
CaretSvg
CheckCircleSvg
ClearSvg
CloudUploadSvg
CollapseSvg
DateInputSvg
DeleteForeverSvg
DocumentSvg
DownloadSvg
EmailSvg
ExpandSvg
FacebookSvg
InfoSvg
InstagramSvg
KeySvg
LinkedinSvg
MobileSvg
MessageSvg
PersonSvg
PhoneSvg
PowerSvg
SearchSvg
TwitterSvg
UploadSvg
XingSvg
YoutubeSvg
images
AxaLogoSvg
AxaLogoOpenSvg
... and many more in subfolders

Contribution

Process of adding a new image

  1. Involve a designer by sending him the new SVG in question, unless the designer already has the file. He will review it and possibly change some things, for example by adjusting inner padding etc. in order to guarantee overall quality.
  2. Remove unnecessary code inside the SVG:
    • a. data-name="Layer 2" # layer info for vector drawing software
    • b. <path fill="#fff" d="M0 0h96v96H0z"/> # outer bounding box filled with white background
    • a. use the internal svgo -invoking script npm run build-images from the materials-folder itself to clean up and optimize the SVGs, then copy the optimized files back from the .tmp folder to images-raw
    • b. alternatively use the online SVG optimizer for the same purpose
  3. Manually review the SVGs produced in the last step: add or edit <path> attributes, setting fill="currentColor" and/or strokes="currentColor" as appropriate. Remove unnecessary attributes.
  4. Run npm run build to generate a js file for each svg file found. The generated files can be found in the images folder.

Updating materials (UNIX only)

All our icons in the "icons" section are the material icons from google (and nothing else). To update the material icons from google (https://github.com/google/material-design-icons/releases), follow these steps.

  1. Remove the contents of the icons-raw folder.
  2. Download the newest version of material icons as a ZIP file to your download folder.
  3. Extract the material icons zip file into the downloads folder.
  4. Rename the extracted folder to material-design-icons.
  5. Open a terminal and cd into the materials root folder (src/components/00-materials/).
  6. Run sh material-importer.sh.
  7. Run a search on only the folder src/components/00-materials/icons-raw and search for <path (whitespace at the end).
  8. Replace all occurences with <path fill="currentColor" (whitespace at the end).
  9. Run a search on only the folder src/components/00-materials/icons-raw and search for <circle (whitespace at the end).
  10. Replace all occurences with <circle fill="currentColor" (whitespace at the end).

Done. This seems to be the fastest and most efficient approach with the current importer script.

版本与发布记录

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

版本发布日期距今
16.0.8latest2022/09/304 年前
16.0.72022/09/204 年前
16.0.62022/09/144 年前
16.0.52022/09/124 年前
16.0.42022/08/314 年前
16.0.32022/07/294 年前

其他发布通道:beta → 10.1.0-beta.2。

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

@axa-ch/materials 是什么?

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

如何安装 @axa-ch/materials?

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

@axa-ch/materials 支持 TypeScript 吗?

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

@axa-ch/materials 可以商用吗?

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

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

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

@axa-ch/materials 还在维护吗?

最新版本 16.0.8 发布于 2022/09/30(4 年前);至今共发布 105 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/04/04。作者已将其标记为弃用,新项目建议寻找替代方案。