Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

// Needed for redux-saga es6 generator support
import '@babel/polyfill';
import './web.config';

// Import all the third party stuff
import React from 'react';
Expand Down
96 changes: 96 additions & 0 deletions app/components/DialogImage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React, { Component } from 'react';
import {
withStyles,
Dialog,
CardMedia,
Paper,
CardHeader,
Avatar,
Divider,
IconButton,
InputBase,
Button,
Typography,
} from '@material-ui/core';
import MoreHoriz from '@material-ui/icons/MoreHoriz';
import ava from 'containers/AccountPage/images/3.jpg';

const styles = () => ({
media: {
width: 600,
height: 600,
},
paper: {
height: 600,
width: 335,
zIndex: 100,
},
input: {
padding: '8px 16px',
width: 202,
fontSize: 14,
},
button: {
fontSize: 14,
},
});

class DialogImage extends Component {
render() {
const { classes, closed, handleClose, image, nickname, comments } = this.props;

return (
<Dialog open={closed} onClose={handleClose} style={{ zIndex: 100000 }}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<CardMedia image={image} className={classes.media} />
<Paper className={classes.paper}>
<CardHeader
avatar={
<Avatar
aria-label="Recipe"
className={classes.avatar}
>{nickname[0]}</Avatar>
}
action={
<IconButton
aria-label="Settings"
size="small"
style={{ marginTop: '14px', marginRight: '5px' }}
>
<MoreHoriz />
</IconButton>
}
title={nickname}
/>
<Divider />

{comments
? comments.map(item => (
<Typography variant="body2" style={{margin: '8px 16px'}}>
<span style={{ fontWeight: 600, cursor: 'pointer' }}>
{item.name}
</span>{' '}
{item.comment}
</Typography>
))
: ''}
{comments ? <Divider /> : ""}

<div style={{ display: 'flex', alignItems: 'center' }}>
<InputBase
className={classes.input}
placeholder="Добавить коментарий..."
inputProps={{ 'aria-label': 'Comments' }}
/>
<Button color="primary" className={classes.button}>
Опубликовать
</Button>
</div>
</Paper>
</div>
</Dialog>
);
}
}

export default withStyles(styles)(DialogImage);
184 changes: 174 additions & 10 deletions app/components/Header/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import React, { Component } from 'react';
import { NavLink } from 'react-router-dom';
import { NavLink, withRouter } from 'react-router-dom';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import IconButton from '@material-ui/core/IconButton';
import Typography from '@material-ui/core/Typography';
import SearchInput from 'components/SearchInput';
import jwt from 'jsonwebtoken';
import { withStyles } from '@material-ui/core/styles';
import AccountCircle from '@material-ui/icons/AccountCircle';
import FavoriteBorder from '@material-ui/icons/FavoriteBorder';
import { IconButton } from '@material-ui/core';
import MenuIcon from '@material-ui/icons/Menu';
import Popper from '@material-ui/core/Popper';
import ava from 'containers/AccountPage/images/3.jpg';
import {
Avatar,
Button,
MenuItem,
MenuList,
Grow,
ClickAwayListener,
Paper,
} from '@material-ui/core';

const styles = () => ({
root: {
Expand All @@ -28,8 +38,28 @@ const styles = () => ({
});

class Header extends Component {
state = {
open: false,
};

handleToggle = () => {
this.setState(state => ({ open: !state.open }));
};

handleClose = event => {
if (this.anchorEl.contains(event.target)) {
return;
}

this.setState({ open: false });
};

render() {
const { classes } = this.props;
const { open } = this.state;

const fromToken = jwt.decode(localStorage.token, { complete: true });

return (
<div className={classes.root}>
<AppBar position="static" color="default" className={classes.appBar}>
Expand All @@ -40,22 +70,156 @@ class Header extends Component {
display: 'flex',
justifyContent: 'space-between',
padding: 0,
zIndex: 1000,
}}
>
<NavLink to="/" className={classes.logo}>
<Typography variant="h5" color="inherit">
Consensus
</Typography>
</NavLink>
<SearchInput />
<NavLink to="/account" style={{ color: '#000' }}>
<AccountCircle fontSize="large" />
</NavLink>
{localStorage.token ? (
<div style={{ display: 'flex', alignItems: 'center' }}>
<NavLink
to={`/account/${fromToken.payload._id}`}
style={{
color: '#000',
textDecoration: 'none',
marginRight: '1rem',
}}
>
<Avatar style={{ backgroundColor: '#212121' }}>
{fromToken.payload.name[0]}
</Avatar>
</NavLink>
<IconButton
buttonRef={node => {
this.anchorEl = node;
}}
aria-owns={open ? 'menu-list-grow' : null}
aria-haspopup="true"
onClick={this.handleToggle}
>
<MenuIcon color="primary" />
</IconButton>
</div>
) : (
<div>
<Button
variant="outlined"
onClick={() => this.props.history.push('/login')}
style={{ marginRight: '1rem' }}
>
Вход и регистрация
</Button>
<IconButton
buttonRef={node => {
this.anchorEl = node;
}}
aria-owns={open ? 'menu-list-grow' : null}
aria-haspopup="true"
onClick={this.handleToggle}
>
<MenuIcon color="primary" />
</IconButton>
</div>
)}

<Popper open={open} anchorEl={this.anchorEl} transition>
{({ TransitionProps, placement }) => (
<Grow
{...TransitionProps}
style={{
transformOrigin:
placement === 'bottom' ? 'center top' : 'center bottom',
}}
>
<Paper>
<ClickAwayListener onClickAway={this.handleClose}>
<MenuList>
<MenuItem style={{ padding: '0' }}>
<NavLink
to="/account/5d05d5d5ee5aaf259cbc4e16"
style={{
color: '#000',
textDecoration: 'none',
width: '100%',
height: '100%',
padding: '8px 16px',
}}
>
Дизайн
</NavLink>
</MenuItem>
<MenuItem style={{ padding: '0' }}>
<NavLink
to="/account/5d05d65a39e79f25a4a17519"
style={{
color: '#000',
textDecoration: 'none',
width: '100%',
height: '100%',
padding: '8px 16px',
}}
>
Брендбук
</NavLink>
</MenuItem>
<MenuItem style={{ padding: '0' }}>
<NavLink
to="/account/5d05d5aeee5aaf259cbc4e15"
style={{
color: '#000',
textDecoration: 'none',
width: '100%',
height: '100%',
padding: '8px 16px',
}}
>
Айдентика
</NavLink>
</MenuItem>
<MenuItem style={{ padding: '0' }}>
<NavLink
to="/account/5d05d62939e79f25a4a17518"
style={{
color: '#000',
textDecoration: 'none',
width: '100%',
height: '100%',
padding: '8px 16px',
}}
>
Логотипирование
</NavLink>
</MenuItem>
<MenuItem style={{ padding: '0' }}>
<NavLink
to="/account/5d09259240e14e4472ffd906"
style={{
color: '#000',
textDecoration: 'none',
width: '100%',
height: '100%',
padding: '8px 16px',
}}
>
Колористика и цветоведение
</NavLink>
</MenuItem>
</MenuList>
</ClickAwayListener>
</Paper>
</Grow>
)}
</Popper>
</Toolbar>
</AppBar>
</div>
);
}
}

export default withStyles(styles)(Header);
const Head = withRouter(Header);

export default withStyles(styles)(Head);
45 changes: 45 additions & 0 deletions app/components/InputText/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React, { Component } from 'react';
import { withStyles, InputBase } from '@material-ui/core';
import { Field } from 'redux-form';

const styles = () => ({
input: {
padding: '8px 16px',
width: '100%',
background: '#fafafa',
marginTop: '8px',
marginBottom: '8px',
borderRadius: '5px',
border: '#efefef 1px solid',
height: '36px',
},
});

const renderTextField = ({ input, placeholder, classes, type }) => (
<InputBase
className={classes.input}
placeholder={placeholder}
type={type || 'text'}
inputProps={{
style: { fontSize: '16px' },
}}
{...input}
onChange={value => input.onChange(value)}
/>
);

class InputText extends Component {
render() {
const { classes, placeholder, name, type } = this.props;
return (
<Field
type={type}
name={name}
classes={classes}
placeholder={placeholder}
component={renderTextField}
/>
);
}
}
export default withStyles(styles)(InputText);
Loading