| 3481 |
stevensc |
1 |
import React from 'react';
|
|
|
2 |
import { Avatar, Box, Typography } from '@mui/material';
|
|
|
3 |
|
|
|
4 |
import { useMicroLearning, useFetch } from '@hooks';
|
|
|
5 |
|
|
|
6 |
import Spinner from '@components/UI/Spinner';
|
|
|
7 |
import DetailTag from '@microlearning/components/DetailTag';
|
|
|
8 |
|
|
|
9 |
const ProfilePage = () => {
|
|
|
10 |
const { link_profile: linkProfile } = useMicroLearning();
|
|
|
11 |
const { data, isLoading } = useFetch(linkProfile, []);
|
|
|
12 |
|
|
|
13 |
if (isLoading) return <Spinner />;
|
|
|
14 |
|
|
|
15 |
return (
|
|
|
16 |
<>
|
|
|
17 |
<Box textAlign='center'>
|
|
|
18 |
<Avatar
|
|
|
19 |
src={data[0]?.image}
|
|
|
20 |
alt={data[0]?.name}
|
|
|
21 |
sx={{ width: 100, height: 100, margin: '0 auto' }}
|
|
|
22 |
/>
|
|
|
23 |
<Typography variant='h2'>{data[0]?.name}</Typography>
|
|
|
24 |
</Box>
|
|
|
25 |
|
|
|
26 |
<Box display='flex' flexDirection='column' gap={1} width='100%' mt={2}>
|
|
|
27 |
{data[0]?.details?.map(({ uuid, label, value }) => (
|
|
|
28 |
<DetailTag key={uuid} title={label} label={value} />
|
|
|
29 |
))}
|
|
|
30 |
</Box>
|
|
|
31 |
</>
|
|
|
32 |
);
|
|
|
33 |
};
|
|
|
34 |
|
|
|
35 |
export default ProfilePage;
|