2.0.20 • Published 2 years ago

avatar-chip v2.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

This package is based on Material 4, which is OUTDATED!!! Not recommending using it..

React avatar-chip based on the Chip component of "material-ui" and "@multiavatar/multiavatar" package

Note: previous version 2.0.13 was Buggy, fixed in later version

aCapture


import dependencies

import React from "react"
import { AvatarChip, AvatarLogo, TwoLineLabel } from "./AvatarChip";

default avatar is based on personName if "src" is not provided,
default label is based on personName, if "label" is not provided default avatar size: "2.6rem", "2.6rem", "2.6rem", "2.6rem", "2.6rem", default labelSize: "2rem", "2rem", "2rem", "2rem", "2rem",

<AvatarChip
    size={["5.2rem", "3.9rem", "2.6rem", "1.8rem"]}  //avatar size array for different screen width 
    labelSize={["4rem", "3rem", "2rem", "1.5rem"]}   //label size array for different screen width 
    personName={"bob"}
   
 />

just avatar, no label

<AvatarChip
    size={["4rem", "3rem", "2rem", "1.5rem"]} 
    personName={"mike"}
    onClick={function () { alert("hello mike") }}
    avatarProps={{ onClick: function (e) { e.stopPropagation(); alert("hi") } }}
    src="https://picsum.photos/200/300" 
    labelOn={false}
    lift={9}  // shadow level
 />

just label, no avatar

 <AvatarChip
    labelSize={["4rem", "3rem", "2rem", "1.5rem"]}
    personName={"mike"}
    bgColor="pink"
    onClick={function () { alert("hello mike") }}
    avatarProps={{ onClick: function (e) { e.stopPropagation(); alert("hi") } }}
    src="https://picsum.photos/200/300"
    logoOn={false}

  />

Avatar with hover tip

  <AvatarChip
    size={["1rem", "2rem", "3rem", "4rem", "5rem"]}  //avatarSize
    personName={"毛fdsdsdsdsdsd帅"}
    bgColor="skyblue"
    style={{ color: "blue" }}
    onClick={function () { alert("clicked") }}
    avatarProps={{ onClick: function (e) { e.stopPropagation(); alert("hi") } }}
    src="https://picsum.photos/200/300"
    label={
      <TwoLineLabel lineTop="06355 马小帅" lineDown="银行总行法律合规部" />
    }
    logoOn={true}  
    onDelete={function () { }}
    hoverContent={
      <>
        <AvatarChip
          size={["1rem", "2rem", "3rem", "4rem", "5rem"]}  //avatarSize
          personName={"毛fdsdsdsdsdsd帅"}
          style={{ backgroundColor: "skyblue", color: "blue" }}
          onClick={function () { alert("clicked") }}
          avatarProps={{ onClick: function (e) { e.stopPropagation(); alert("hi") } }}
          // src="https://picsum.photos/200/300"
          label={
            <TwoLineLabel lineTop="06355 马小帅" lineDown="银行总行法律合规部" />
          }
        />

      </>
    }
  />

Demo

https://vibrant-liskov-396f96.netlify.app/

GitHub https://github.com/cr7cr8/avatar-chip.git

git push -f origin master npm version patch npm publish

2.0.19

2 years ago

2.0.20

2 years ago

2.0.16

3 years ago

2.0.14

3 years ago

2.0.17

3 years ago

2.0.18

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.13

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.11

3 years ago

2.0.7

3 years ago

2.0.12

3 years ago

2.0.6

3 years ago

2.0.9

3 years ago

2.0.10

3 years ago

2.0.8

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago