Create Avatar component
This commit is contained in:
23
webui/src/common/components/Avatar/Avatar.jsx
Normal file
23
webui/src/common/components/Avatar/Avatar.jsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import './styles.sass';
|
||||||
|
|
||||||
|
export const Avatar = ({
|
||||||
|
children,
|
||||||
|
size = 'md',
|
||||||
|
variant = 'default',
|
||||||
|
className = '',
|
||||||
|
...rest
|
||||||
|
}) => {
|
||||||
|
const avatarClasses = [
|
||||||
|
'avatar',
|
||||||
|
`avatar--${size}`,
|
||||||
|
`avatar--${variant}`,
|
||||||
|
className
|
||||||
|
].filter(Boolean).join(' ');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={avatarClasses} {...rest}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
1
webui/src/common/components/Avatar/index.js
Normal file
1
webui/src/common/components/Avatar/index.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { Avatar as default } from './Avatar.jsx';
|
35
webui/src/common/components/Avatar/styles.sass
Normal file
35
webui/src/common/components/Avatar/styles.sass
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
.avatar
|
||||||
|
background: var(--bg-elev)
|
||||||
|
border: 1px solid var(--border)
|
||||||
|
border-radius: 50%
|
||||||
|
display: flex
|
||||||
|
align-items: center
|
||||||
|
justify-content: center
|
||||||
|
color: var(--text-dim)
|
||||||
|
flex-shrink: 0
|
||||||
|
|
||||||
|
&--sm
|
||||||
|
width: 32px
|
||||||
|
height: 32px
|
||||||
|
|
||||||
|
&--md
|
||||||
|
width: 48px
|
||||||
|
height: 48px
|
||||||
|
|
||||||
|
&--lg
|
||||||
|
width: 64px
|
||||||
|
height: 64px
|
||||||
|
|
||||||
|
&--xl
|
||||||
|
width: 80px
|
||||||
|
height: 80px
|
||||||
|
|
||||||
|
&--primary
|
||||||
|
background: var(--accent)
|
||||||
|
color: white
|
||||||
|
border-color: var(--accent)
|
||||||
|
|
||||||
|
&--success
|
||||||
|
background: #16a34a
|
||||||
|
color: white
|
||||||
|
border-color: #16a34a
|
Reference in New Issue
Block a user