mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added initial profile dialog
This commit is contained in:
parent
f6baedc4cd
commit
618c2e3275
28 changed files with 315 additions and 58 deletions
27
src/containers/profile/ProfileInfo/index.tsx
Normal file
27
src/containers/profile/ProfileInfo/index.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import React, { FC } from 'react';
|
||||
import { IUser } from '~/redux/auth/types';
|
||||
import styles from './styles.scss';
|
||||
import { Grid } from '~/components/containers/Grid';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
import { Placeholder } from '~/components/placeholders/Placeholder';
|
||||
|
||||
interface IProps {
|
||||
user?: IUser;
|
||||
is_loading?: boolean;
|
||||
}
|
||||
|
||||
const ProfileInfo: FC<IProps> = ({ user, is_loading = false }) => (
|
||||
<Group className={styles.wrap} horizontal>
|
||||
<div className={styles.avatar} />
|
||||
|
||||
<Group className={styles.field}>
|
||||
<div className={styles.name}>{is_loading ? <Placeholder width="80%" /> : 'User Name'}</div>
|
||||
|
||||
<div className={styles.desription}>
|
||||
{is_loading ? <Placeholder /> : 'Some description here'}
|
||||
</div>
|
||||
</Group>
|
||||
</Group>
|
||||
);
|
||||
|
||||
export { ProfileInfo };
|
28
src/containers/profile/ProfileInfo/styles.scss
Normal file
28
src/containers/profile/ProfileInfo/styles.scss
Normal file
|
@ -0,0 +1,28 @@
|
|||
.wrap {
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start !important;
|
||||
// min-height: 64px;
|
||||
padding: $gap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
@include outer_shadow();
|
||||
|
||||
border-radius: $radius;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
background: $content_bg;
|
||||
position: absolute;
|
||||
top: -60px;
|
||||
left: $gap;
|
||||
}
|
||||
|
||||
.field {
|
||||
padding-left: 140px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.name {
|
||||
font: $font_24_bold;
|
||||
}
|
58
src/containers/profile/ProfileLayout/index.tsx
Normal file
58
src/containers/profile/ProfileLayout/index.tsx
Normal file
|
@ -0,0 +1,58 @@
|
|||
import React, { FC, useEffect, useState } from 'react';
|
||||
import { useRouteMatch, withRouter, RouteComponentProps } from 'react-router';
|
||||
import styles from './styles.scss';
|
||||
import { NodeNoComments } from '~/components/node/NodeNoComments';
|
||||
import { Grid } from '~/components/containers/Grid';
|
||||
import { CommentForm } from '~/components/node/CommentForm';
|
||||
import { ProfileInfo } from '../ProfileInfo';
|
||||
import * as NODE_ACTIONS from '~/redux/node/actions';
|
||||
import { connect } from 'react-redux';
|
||||
import { IUser } from '~/redux/auth/types';
|
||||
import { Group } from '~/components/containers/Group';
|
||||
|
||||
const mapStateToProps = () => ({});
|
||||
const mapDispatchToProps = {
|
||||
nodeSetCoverImage: NODE_ACTIONS.nodeSetCoverImage,
|
||||
};
|
||||
|
||||
type IProps = RouteComponentProps & typeof mapDispatchToProps & {};
|
||||
|
||||
const ProfileLayoutUnconnected: FC<IProps> = ({ history, nodeSetCoverImage }) => {
|
||||
const {
|
||||
params: { username },
|
||||
} = useRouteMatch<{ username: string }>();
|
||||
const [user, setUser] = useState<IUser>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (user) setUser(null);
|
||||
}, [username]);
|
||||
|
||||
useEffect(() => {
|
||||
if (user && user.id && user.cover) {
|
||||
nodeSetCoverImage(user.cover);
|
||||
return () => nodeSetCoverImage(null);
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
return (
|
||||
<Group className={styles.wrap} horizontal>
|
||||
<div className={styles.column}>
|
||||
<ProfileInfo user={user} />
|
||||
</div>
|
||||
|
||||
<Grid className={styles.content}>
|
||||
<div className={styles.comments}>
|
||||
<CommentForm id={0} />
|
||||
<NodeNoComments is_loading={false} />
|
||||
</div>
|
||||
</Grid>
|
||||
</Group>
|
||||
);
|
||||
};
|
||||
|
||||
const ProfileLayout = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(ProfileLayoutUnconnected));
|
||||
|
||||
export { ProfileLayout };
|
27
src/containers/profile/ProfileLayout/styles.scss
Normal file
27
src/containers/profile/ProfileLayout/styles.scss
Normal file
|
@ -0,0 +1,27 @@
|
|||
.wrap {
|
||||
display: flex;
|
||||
align-items: flex-start !important;
|
||||
justify-content: flex-start !important;
|
||||
flex-direction: row;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 3;
|
||||
// flex: 0 1 $limited_width;
|
||||
// padding: $gap;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.column {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.info {
|
||||
}
|
||||
|
||||
.comments {
|
||||
background: $node_bg;
|
||||
border-radius: $radius;
|
||||
padding: $gap;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue