@mikezimm/fps-library-v2
Version:
Library of reusable typescript/javascript functions, interfaces and constants
38 lines • 2.91 kB
JavaScript
import * as React from 'react';
import { Icon, } from '@fluentui/react/lib/Icon';
import { GuestsIconName, SiteAdminIconName, } from './Interfaces/StandardPersonIconNames';
export function getAdminIcon(iconSize, iconLeftPad, iconTextSize) {
const AdminIcon = React.createElement("div", { style: { fontSize: iconSize, color: 'darkgreen', paddingLeft: iconLeftPad, paddingRight: 10, whiteSpace: 'nowrap' } },
React.createElement(Icon, { iconName: SiteAdminIconName, title: 'Site Admin' }),
React.createElement("span", { style: { fontSize: iconTextSize, paddingLeft: '7px' } }, "Admin"));
return AdminIcon;
}
export function getGuestIcon(iconSize, iconLeftPad, iconTextSize) {
const GuestIcon = React.createElement("div", { style: { fontSize: iconSize, color: 'saddlebrown', paddingLeft: iconLeftPad, paddingRight: 4, whiteSpace: 'nowrap' } },
React.createElement(Icon, { iconName: GuestsIconName, title: 'Guest User' }),
React.createElement("span", { style: { fontSize: iconTextSize, paddingLeft: '7px' } }, "Guest"));
return GuestIcon;
}
/**
*
PrincipalType
https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-csom/ee541430%28v=office.15%29
Member name Description
None Enumeration whose value specifies no principal type. Value = 0.
User Enumeration whose value specifies a user as the principal type. Value = 1.
DistributionList Enumeration whose value specifies a distribution list as the principal type. Value = 2.
SecurityGroup Enumeration whose value specifies a security group as the principal type. Value = 4.
SharePointGroup Enumeration whose value specifies a group (2) as the principal type. Value = 8.
All Enumeration whose value specifies all principal types. Value = 15.
*/
export function getPrincipalTypeIcon(userProperties, iconSize, iconLeftPad, iconTextSize) {
const { PrincipalType, } = userProperties;
const typeName = PrincipalType === 8 ? 'SPO Group' : PrincipalType === 4 ? 'AD Group' : PrincipalType === 2 ? 'Distrubution Group' : PrincipalType === 1 ? 'User' : '';
const typeIconName = PrincipalType === 8 ? 'Group' : PrincipalType === 4 ? 'SecurityGroup' : PrincipalType === 2 ? 'MessageFriendRequest' : PrincipalType === 1 ? 'ReminderPerson' : '';
const typeIconColor = PrincipalType === 8 ? 'black' : PrincipalType === 4 ? 'black' : PrincipalType === 2 ? 'black' : PrincipalType === 1 ? 'black' : '';
const GuestIcon = React.createElement("div", { style: { fontSize: iconSize, color: typeIconColor, paddingLeft: iconLeftPad, paddingRight: 4, whiteSpace: 'nowrap' } },
React.createElement(Icon, { iconName: typeIconName, title: typeName }),
React.createElement("span", { style: { fontSize: iconTextSize, paddingLeft: '7px' } }, typeName));
return GuestIcon;
}
//# sourceMappingURL=PersonaIcons.js.map