Skip to content

Instantly share code, notes, and snippets.

@PuruVJ
Last active September 3, 2020 08:46
Show Gist options
  • Save PuruVJ/2bee075bff64c6a3c224527101bfb63d to your computer and use it in GitHub Desktop.
Save PuruVJ/2bee075bff64c6a3c224527101bfb63d to your computer and use it in GitHub Desktop.
import { h } from "@stencil/core";
import { IUser } from "../interfaces/user.interface";
export const UserAvatar = ({ user, size = 36 }: {user: IUser, size: number}) => {
const {name, luminosity, name} = user;
const [r, g, b] = themeColor
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 100"
width={size}
height={size}
>
<circle
cx="50"
cy="50"
r="50"
fill={`rgb(${r}, ${g}, ${b})`}
></circle>
<text
x="50"
y="54"
text-anchor="middle"
dominant-baseline="middle"
// pointerEvents:
style={{
fill: luminosity === "dark" ? "white" : "black",
fontSize: "60",
"pointer-events": "none",
"user-select": "none"
}}
// font-size="50"
>
{name.split("")[0]}
</text>
</svg>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment