react-icons/md#MdAccountCircle JavaScript Examples
The following examples show how to use
react-icons/md#MdAccountCircle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserHeader.js From plataforma-sabia with MIT License | 6 votes |
UserHeader = () => {
const { colors } = useTheme();
const { user } = useAuth();
const { t } = useTranslation(['common']);
const [ref, isDropDownVisible, setIsDropDownVisible] = useVisibleComponent();
const userFirstName = user.full_name && user.full_name.split(' ')[0];
const router = useRouter();
const toggleVisible = () => setIsDropDownVisible((prev) => !prev);
const handleToggleDropDown = (e) => {
e.preventDefault();
if (!user?.email) {
router.push(internalPages.signIn);
} else {
toggleVisible();
}
};
return (
<LoginBox ref={ref}>
<UserButton type="button" onClick={handleToggleDropDown} data-cy="user-dropdown-button">
<MdAccountCircle color={colors.secondary} />
<span>{userFirstName || t('common:login')}</span>
</UserButton>
<UserProfileDropDown visible={isDropDownVisible} toggleVisible={toggleVisible} />
</LoginBox>
);
}