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

@txdfe/at-text-avatar

v1.0.0

Published

AT业务组件 - 文字头像(默认根据文字首字符作为头像内容)

Downloads

38

Readme

at-text-avatar


简介

根据文字生成头像,类似钉钉、gitlab首页效果

使用示例

萨波

import TextAvatar from '@txdfe/at-text-avatar';

class Demo extends React.Component {
  render() {
    return (
      <TextAvatar
        image={user.avatar_url}
        text={user.nickname || user.name}
      />
    );
  }
}

ReactDOM.render(<Demo />, mountNode);

API

| 参数 | 类型 | 可选值 | 默认值 | 是否必填 | 说明 | | :--- | :--- | :--- | :--- | :--- | :--- | | text | String | 无 | 无 | 是 | 用作头像的文字,默认截取第一个字符作为头像(可通过sliceFrom和sliceLength调整) | | image | String | 无 | 无 | 否 | 图片地址。当传入此参数时,组件将优先使用此参数将头像渲染成图片,为空时才使用text参数渲染成文字 | | size | String | xl, large, medium, small, xs | medium | 否 | 有5种可选尺寸,大小依次为:24px、28px、36px、48px,64px 默认尺寸为medium | | radius | String | 无 | 100% | 否 | 显示头像的圆角度数,默认值为100% | | cover | Boolean | true,false | false | 否 | 头像圆角为4px,fontSize为20px,fontWeight为500 | | sliceFrom | String | head, end | head | 否 | 截取文字的方向,默认从词首开始截取,如『萨波』将截取『萨』 | | sliceLength | Number | 无 | 1 | 否 | 截取文字的长度,默认截取1个字符。不建议截取超过2个字符 | | href | String | 无 | 无 | 否 | 传这个参数时,头像将变成一个a标签,点击跳转的链接为传入的值 | | isTargetBlank | Bool | true, false | true | 否 | 指定a标签是否新标签页打开(需要与href参数一起使用) | | className | String | 无 | 无 | 否 | 添加到组件上的className | | needAddedText | Boolean | true,false | false | 否 | 是否需要在头像后面展示 text |