@yakad/ui 1.3.152 → 1.3.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Avatar/Avatar.d.ts +6 -0
- package/dist/Avatar/Avatar.js +23 -0
- package/dist/Avatar/Avatar.module.css +31 -0
- package/dist/WithOverlay/WithOverlay.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { forwardRef } from "react";
|
|
14
|
+
import classNames from "classnames";
|
|
15
|
+
import styles from "./Avatar.module.css";
|
|
16
|
+
import { Symbol } from "@yakad/symbols";
|
|
17
|
+
export const Avatar = forwardRef(function Avatar(_a, ref) {
|
|
18
|
+
var { src, className } = _a, restProps = __rest(_a, ["src", "className"]);
|
|
19
|
+
const joinedClassNames = classNames(styles.profileContainer, className);
|
|
20
|
+
const backgroundImage = src ? `url(${src})` : `url("./default-avatar.svg")`;
|
|
21
|
+
return (_jsx("div", Object.assign({ ref: ref }, restProps, { className: joinedClassNames, style: { backgroundImage }, children: _jsx("div", { className: styles.editOverlay, children: _jsx(Symbol, { icon: "edit" }) }) })));
|
|
22
|
+
});
|
|
23
|
+
export default Avatar;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.profileContainer {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 60px;
|
|
4
|
+
height: 60px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
border-radius: 50%;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
background-size: cover;
|
|
12
|
+
background-position: center;
|
|
13
|
+
transition: all 0.3s ease;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
.editOverlay {
|
|
18
|
+
position: absolute;
|
|
19
|
+
inset: 0;
|
|
20
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
opacity: 0;
|
|
25
|
+
transition: opacity 0.3s ease;
|
|
26
|
+
color: white;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.profileContainer:hover .editOverlay {
|
|
30
|
+
opacity: 1;
|
|
31
|
+
}
|
|
@@ -29,7 +29,7 @@ export const WithOverlay = forwardRef(function WithOverlay(_a, forwardedRef) {
|
|
|
29
29
|
};
|
|
30
30
|
}, [showOverlay]);
|
|
31
31
|
// Teleport Overlay to portalRoot or body
|
|
32
|
-
const portalRoot = document.getElementsByClassName("portalRoot")[0] || document
|
|
32
|
+
const portalRoot = document.getElementsByClassName("portalRoot")[0] || document;
|
|
33
33
|
const teleport = overlay &&
|
|
34
34
|
portalRoot &&
|
|
35
35
|
createPortal(cloneElement(overlay, {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED