@material-ui/icons APIs
- ExpandMore
- Delete
- Close
- Visibility
- VisibilityOff
- Check
- Add
- Edit
- Search
- ExpandLess
- Settings
- Person
- Info
- Clear
- ExitToApp
- ArrowDropDown
- Home
- GitHub
- Warning
- ArrowBack
- SearchOutlined
- Done
- LocationOn
- PlayArrow
- Apps
- Brightness4
- Brightness7
- Description
- KeyboardArrowDown
- KeyboardArrowLeft
- KeyboardArrowRight
- MoreVert
- LocationCity
- Map
- Image
- AccountCircle
- InfoOutlined
- Create
- Block
- Replay
- AddCircle
- HomeRounded
- GetApp
- ChevronLeft
- ChevronRight
- CloudDownload
- CheckCircleOutline
- Send
- LockOpen
- Cancel
- NavigateNext
- AccountBox
- DragIndicator
- FavoriteBorderOutlined
- AccessTime
- DoneAll
- CheckCircle
- CropFree
- LockOutlined
- Undo
- Dashboard
- People
- PhotoLibrary
- HomeOutlined
- Group
- ArrowDropUp
- Remove
- ArrowUpward
- Save
- ArrowForward
- AttachFile
- Headset
- SignalCellularAlt
- ArrowForwardIos
- PlayCircleFilled
- AccessAlarm
- Adjust
- BarChart
- CloseRounded
- PlayArrowOutlined
- ImageRounded
- MenuBookRounded
- RefreshRounded
- HourglassEmptyOutlined
- Announcement
- Ballot
- QuestionAnswerOutlined
- CloudUpload
- SkipNext
- ArrowRightAlt
- MoreHoriz
- FileCopy
- MenuBook
- Language
- AlternateEmail
- FolderOpen
- Lock
- Pets
- AddCircleRounded
- ExploreRounded
- WbSunnyRounded
- Brightness2Rounded
- DonutLargeRounded
- AssistantRounded
- AccountCircleRounded
- ExitToAppRounded
- VpnKey
- MailOutline
- Smartphone
- DeleteForever
- LanguageOutlined
- Colorize
- SignalCellularConnectedNoInternet2Bar
- SignalCellularConnectedNoInternet0Bar
- SignalCellular4Bar
- DeleteOutline
- NewReleases
- LocalOffer
- Assessment
- Place
- TrendingDown
- ShoppingCart
- Stop
- RotateLeft
- Menu
- Flag
- Forum
- GroupSharp
- InsertEmoticon
- NotificationsActive
- PhoneIphone
- AllInbox
- Comment
- Photo
- PlaylistAddCheck
- CloudUploadRounded
- ExpandMoreOutlined
- History
- PersonOutlineOutlined
- ArrowForwardIosRounded
- ArrowBackIosRounded
- AssignmentOutlined
- VerticalAlignCenterOutlined
- CalendarTodayOutlined
- Error
- PlaylistPlay
- MusicNoteTwoTone
- Portrait
- ExploreOutlined
- DeleteRounded
- EditRounded
- SaveRounded
- CreateNewFolder
- MeetingRoom
- MenuOpenRounded
- MenuRounded
- DateRange
- CallEnd
- Assignment
- KeyboardBackspace
- BluetoothSearching
- CameraAlt
- PlaylistAdd
- Favorite
- Bluetooth
- OpenInBrowser
- Loop
- FileCopyOutlined
- NavigateBefore
- MergeType
- Dvr
- PersonOutline
- PlayCircleFilledWhiteOutlined
- StoreMallDirectoryOutlined
- SupervisedUserCircleOutlined
- MonetizationOn
- OpenInNew
- ArrowDownward
- AddBox
- FilterList
- FirstPage
- LastPage
- ViewColumn
- Notifications
- DriveEta
- LocalTaxi
- Redo
- AccountTree
- TextFields
- SaveAlt
- ThumbDown
- ThumbUp
- LocalPhone
- VolumeUp
- VolumeDown
- Translate
- AddCircleOutlined
- RemoveCircleOutlined
- Router
- RemoveRedEye
- Chat
- Mood
- Mic
OtherRelated APIs
- react#useState
- react#useEffect
- react#useContext
- react-redux#useDispatch
- react-redux#useSelector
- @material-ui/core#MenuItem
- react-router#useHistory
- react-i18next#useTranslation
- @material-ui/icons#Settings
- @material-ui/icons#Person
- @material-ui/icons#PersonOutlineOutlined
- @apollo/client#useMutation
- connected-react-router#push
@material-ui/icons#History JavaScript Examples
The following examples show how to use
@material-ui/icons#History.
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: header-profile.js From horondi_client_fe with MIT License | 4 votes |
HeaderProfile = ({ fromSideBar, setIsMenuOpen }) => {
const { userData } = useSelector(({ User }) => ({
userData: User.userData
}));
const [, setLightMode] = useContext(ThemeContext);
const [anchorEl, setAnchorEl] = useState(null);
const { t } = useTranslation();
const dispatch = useDispatch();
const styles = useStyles({ fromSideBar });
const history = useHistory();
const configsUser = {
currency: getFromLocalStorage('currency'),
language: i18n.language,
theme: getFromLocalStorage('theme')
};
const { firstName, lastName, email } = userData || {};
const [saveConfigs] = useMutation(saveUserConfigs, {
variables: {
user: {
firstName,
lastName,
email,
configs: configsUser
},
id: userData?._id
}
});
const handleKeyDown = (e) => {
e.persist();
return !(e.type === 'keydown' && e.key !== 'Enter');
};
const handleClick = (e) => {
handleKeyDown(e) && setAnchorEl(e.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
useEffect(() => {
if (userData && userData.configs) {
const { theme, language, currency } = userData.configs;
setLightMode(theme === 'light');
setToLocalStorage('theme', theme);
i18n.changeLanguage(language);
setToLocalStorage(LANGUAGE, language);
setToLocalStorage('currency', currency);
dispatch(changeCurrency(currency));
}
}, [userData]);
const handleLogIn = () => {
setIsMenuOpen(false);
const pathName = history.location.pathname;
const returnPath =
(pathName === pathToRegister || pathName === pathToLogin ? pathToMain : pathName) +
history.location.search;
sessionStorage.setItem(RETURN_PAGE, returnPath);
handleRedirect(pathToLogin);
};
const handleLogout = async () => {
setAnchorEl(null);
await saveConfigs();
dispatch(logoutUser());
};
const handleRedirect = (link) => {
dispatch(push(link));
setAnchorEl(null);
};
const PROFILE_DATA = [
{
value: t('headerProfile.profile'),
icon: <Settings />,
clickHandler: () => {
setIsMenuOpen(false);
return handleRedirect(pathToProfile);
}
},
{
value: t('headerProfile.orderHistory'),
icon: <History />,
clickHandler: () => {
setIsMenuOpen(false);
return handleRedirect(pathToOrderHistory);
}
},
{
value: t('headerProfile.myCertificates'),
icon: <GiftCertificatesIcon viewBox='0 -3 24 24' />,
clickHandler: () => {
setIsMenuOpen(false);
return handleRedirect(pathToMyCertificates);
}
},
{
value: t('common.logOut'),
icon: <ExitToAppIcon />,
clickHandler: () => {
setIsMenuOpen(false);
return handleLogout();
}
}
];
const mappedProfileList = PROFILE_DATA.map(({ value, icon, clickHandler }) => (
<MenuItem key={value} onClick={clickHandler} disableGutters data-testid='menuItem'>
{icon}
{value}
</MenuItem>
));
return (
<div className={styles.profile} data-cy='profile'>
{userData ? (
<Person onClick={handleClick} onKeyDown={handleClick} tabIndex={0} data-testid='iconIn' />
) : (
<PersonOutlineOutlined
onClick={handleLogIn}
onKeyDown={handleLogIn}
tabIndex={0}
data-cy='iconOut'
/>
)}
<Menu
data-testid='menu'
className={styles.list}
anchorEl={anchorEl}
keepMounted
elevation={0}
getContentAnchorEl={null}
anchorOrigin={{
horizontal: 'right',
vertical: 'bottom'
}}
transformOrigin={{
horizontal: 'left',
vertical: 'top'
}}
open={Boolean(anchorEl)}
onClose={handleClose}
>
{mappedProfileList}
</Menu>
</div>
);
}