@atlaskit/avatar
Version:
An avatar is a visual representation of a user or entity.
68 lines (67 loc) • 3.28 kB
JavaScript
/* presence.tsx generated by @compiled/babel-plugin v0.39.1 */
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { Fragment } from 'react';
import IconWrapper from './internal/icon-wrapper';
var BusyIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("circle", {
fill: "var(--ds-icon-danger, #C9372C)",
cx: "4",
cy: "4",
r: "4"
}), /*#__PURE__*/React.createElement("path", {
fill: "var(--ds-surface-overlay, #FFFFFF)",
d: "M3.3,1.9l2.8,2.8c0.2,0.2,0.2,0.5,0,0.7L5.4,6.1c-0.2,0.2-0.5,0.2-0.7,0L1.9,3.3c-0.2-0.2-0.2-0.5,0-0.7l0.7-0.7C2.8,1.7,3.1,1.7,3.3,1.9z"
}));
var FocusIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("path", {
fill: "var(--ds-icon-discovery, #AF59E1)",
d: "M4,8 C1.790861,8 0,6.209139 0,4 C0,1.790861 1.790861,0 4,0 C6.209139,0 8,1.790861 8,4 C8,6.209139 6.209139,8 4,8 Z M4,6.66666667 C5.47275933,6.66666667 6.66666667,5.47275933 6.66666667,4 C6.66666667,2.52724067 5.47275933,1.33333333 4,1.33333333 C2.52724067,1.33333333 1.33333333,2.52724067 1.33333333,4 C1.33333333,5.47275933 2.52724067,6.66666667 4,6.66666667 Z M4,5.33333333 C3.26362033,5.33333333 2.66666667,4.73637967 2.66666667,4 C2.66666667,3.26362033 3.26362033,2.66666667 4,2.66666667 C4.73637967,2.66666667 5.33333333,3.26362033 5.33333333,4 C5.33333333,4.73637967 4.73637967,5.33333333 4,5.33333333 Z"
}));
var OfflineIndicator = /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("path", {
fill: "var(--ds-text-subtlest, #6B6E76)",
d: "M4,8 C6.209139,8 8,6.209139 8,4 C8,1.790861 6.209139,0 4,0 C1.790861,0 0,1.790861 0,4 C0,6.209139 1.790861,8 4,8 Z M4,6 C5.1045695,6 6,5.1045695 6,4 C6,2.8954305 5.1045695,2 4,2 C2.8954305,2 2,2.8954305 2,4 C2,5.1045695 2.8954305,6 4,6 Z"
}), /*#__PURE__*/React.createElement("path", {
fill: "var(--ds-surface-overlay, #FFFFFF)",
d: "M4,6 C5.1045695,6 6,5.1045695 6,4 C6,2.8954305 5.1045695,2 4,2 C2.8954305,2 2,2.8954305 2,4 C2,5.1045695 2.8954305,6 4,6 Z"
}));
var OnlineIndicator = /*#__PURE__*/React.createElement("circle", {
fill: "var(--ds-icon-success, #6A9A23)",
cx: "4",
cy: "4",
r: "4"
});
function getPresence(presence) {
switch (presence) {
case 'busy':
return BusyIndicator;
case 'focus':
return FocusIndicator;
case 'offline':
return OfflineIndicator;
case 'online':
return OnlineIndicator;
}
}
/**
* __Avatar presence__
*
* A presence shows an avatar’s availability.
*
* - [Examples](https://atlassian.design/components/avatar/avatar-presence/examples)
* - [Code](https://atlassian.design/components/avatar/avatar-presence/code)
* - [Usage](https://atlassian.design/components/avatar/avatar-presence/usage)
*/
var AvatarPresence = function AvatarPresence(_ref) {
var borderColor = _ref.borderColor,
children = _ref.children,
presence = _ref.presence;
return /*#__PURE__*/React.createElement(IconWrapper, {
bgColor: borderColor
}, presence ? /*#__PURE__*/React.createElement("svg", {
height: "100%",
version: "1.1",
viewBox: "0 0 8 8",
width: "100%",
xmlns: "http://www.w3.org/2000/svg"
}, getPresence(presence)) : children);
};
export default AvatarPresence;