Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@teamix/icon

Package Overview
Dependencies
Maintainers
21
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teamix/icon

独立的 teamix 图标组件

latest
npmnpm
Version
1.3.12
Version published
Maintainers
21
Created
Source

teamix 图标组件

@teamix/icon

独立的 teamix 图标组件

API

TeamixIcon

参数名说明必填类型默认值备注
type图标类型string
symbolPrefixiconfont.cn 项目前缀,可从项目信息中查看string'hybridcloud-'优先级高于 Provider、setConfig 设置的 symbolPrefix
size图标尺寸'xxs' | 'xs' | 'small' | 'medium' | 'large' | 'xl' | 'xxl' | 'xxxl' |'inherit''medium'
style设置组件样式React.CSSProperties
className设置组件类名string

注:

  • 还可设置其他 html 元素属性,会透传到最外层的 DOM 结构上

TeamixIcon.setConfig

入参为一个对象

interface IOption {
  symbolPrefix?: string;
  scriptUrl: string | string [];
}

默认内置 TeamixIcon.YUNXIAOTeamixIcon.HYBRIDCLOUD,即

// 云效
TeamixIcon.setConfig(TeamixIcon.YUNXIAO);

// 混合云
TeamixIcon.setConfig(TeamixIcon.HYBRIDCLOUD);

TeamixIcon.Provider

以组件形式通过 react context 进行全局设置:

  <TeamixIcon.Provider config={TeamixIcon.HYBRIDCLOUD}>
    <TeamixIcon type="xxx" />
  </TeamixIcon.Provider>

config 格式同上, 为:

interface IOption {
  symbolPrefix?: string;
  scriptUrl: string | string [];
}
参数名说明必填类型默认值备注
scriptUrliconfont.cn 项目在线生成的 symbol js 地址,为数组时需保证 symbolPrefix 一致string | string[]
symbolPrefixiconfont.cn 项目前缀,可从项目信息中查看string'hybridcloud-'

注:

  • 在使用该组件时,一定要调用 TeamixIcon.setConfig 或者 TeamixIcon.Provider 指定图标源信息
  • TeamixIcon.Provider 优先级高于 TeamixIcon.setConfig
  • TeamixIcon.setConfig 每次调用会增加图标源(重复的不会添加),symbolPrefix 后设置会覆盖前设置的值。如果不想被覆盖,可通过 symbolPrefix 组件属性进行设置
  • TeamixIcon.Provider 遵循就近原则,在组件树中最接近TeamixIcon 的嵌套优先级最高

Keywords

teamix

FAQs

Package last updated on 21 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts