This commit is contained in:
Николай Полтщук 2022-10-19 17:47:07 +03:00
parent b4e5ca9140
commit d1f50e6d64
2 changed files with 62 additions and 49 deletions

View File

@ -10,6 +10,7 @@ export const HeaderQuiz = ({header}) => {
const dispatch = useDispatch() const dispatch = useDispatch()
const userId = localStorage.getItem('id'); const userId = localStorage.getItem('id');
const userInfo = useSelector(selectUserInfo); const userInfo = useSelector(selectUserInfo);
console.log(userInfo)
useEffect(() => { useEffect(() => {
dispatch(setUserInfo(userId)) dispatch(setUserInfo(userId))
@ -26,21 +27,25 @@ export const HeaderQuiz = ({header}) => {
}, [dispatch]) }, [dispatch])
return ( return (
<div className="header-quiz"> <div>
<div className="header-quiz__container"> { userInfo?.status === 500 ? <div className="error-msg">{userInfo.message}</div> :
{!userInfo ? <h2>Loading...</h2> : <div className="header-quiz">
<> <div className="header-quiz__container">
{header && <h2 className={'header-quiz__title-main'}>Добрый день, {userInfo.fio}</h2>} {!userInfo ? <h2>Loading...</h2> :
<div className="header-quiz__body header-quiz__body_interjacent"> <>
<div className="header-quiz__avatar"> {header && <h2 className={'header-quiz__title-main'}>Добрый день, {userInfo.fio}</h2>}
<img src={userInfo.photo} alt={userInfo.photo}/> <div className="header-quiz__body header-quiz__body_interjacent">
</div> <div className="header-quiz__avatar">
<div className="header-quiz__name-user">{userInfo.fio}</div> <img src={userInfo.photo} alt={userInfo.photo}/>
<div className="header-quiz__title">{userInfo.position_name}</div> </div>
</div> <div className="header-quiz__name-user">{userInfo.fio}</div>
</> <div className="header-quiz__title">{userInfo.position_name}</div>
} </div>
</div> </>
</div> }
</div>
</div>
}
</div>
) )
} }

View File

@ -72,6 +72,14 @@ $maxWidthContainer: 1123;
line-height: math.div(30, 25); line-height: math.div(30, 25);
} }
//============================================= //=============================================
.error-msg {
text-align: center;
font-size: 25px;
color: red;
font-weight: 500;
}
.header-quiz{ .header-quiz{
@include adaptiv-value("padding-top", 48, 30, 1); @include adaptiv-value("padding-top", 48, 30, 1);
@include adaptiv-value("padding-bottom", 85, 30, 1); @include adaptiv-value("padding-bottom", 85, 30, 1);