forked from gilmarllen/wpp-clone
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring the componets structure and CSS styles
Support absolute imports
- Loading branch information
1 parent
ffbdb82
commit 86b8b1f
Showing
18 changed files
with
199 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NODE_PATH=src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"javascript.updateImportsOnFileMove.enabled": "always", | ||
"javascript.preferences.importModuleSpecifier": "non-relative", | ||
"[javascriptreact]": { | ||
"editor.defaultFormatter": "vscode.typescript-language-features" | ||
}, | ||
"editor.formatOnSave": false, | ||
"editor.codeActionsOnSave": { | ||
// For ESLint | ||
"source.fixAll.eslint": true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es2016", | ||
"jsx": "preserve", | ||
"baseUrl": "./src" | ||
}, | ||
"exclude": ["node_modules", "**/node_modules/*"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
import React from 'react' | ||
|
||
import { | ||
Grid | ||
} from '@material-ui/core' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import { Grid } from '@material-ui/core' | ||
|
||
import InputSearch from './InputSearch/InputSearch' | ||
import LeftHeader from './LeftHeader/LeftHeader' | ||
import NotificationBanner from './NotificationBanner' | ||
import ContactList from './ContactList/ContactList' | ||
|
||
const LeftContainer = ({ classes, chats, changeCurrent }) => ( | ||
<Grid item className={classes.leftGrid} style={{ width: '30%' }}> | ||
<LeftHeader /> | ||
<NotificationBanner /> | ||
<InputSearch /> | ||
<ContactList chats={chats} changeCurrent={changeCurrent} /> | ||
</Grid> | ||
) | ||
const useStyles = makeStyles({ | ||
grid: { | ||
width: '30%', | ||
height: '100%', | ||
display: 'flex', | ||
'flex-direction': 'column' | ||
} | ||
}) | ||
|
||
const LeftContainer = ({ chats, changeCurrent }) => { | ||
const classes = useStyles() | ||
return ( | ||
<Grid item className={classes.grid}> | ||
<LeftHeader /> | ||
<NotificationBanner /> | ||
<InputSearch /> | ||
<ContactList chats={chats} changeCurrent={changeCurrent} /> | ||
</Grid> | ||
) | ||
} | ||
|
||
export default LeftContainer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react' | ||
import { | ||
Grid, Card, CardContent, | ||
Paper, Typography, CardActions, List, ListItem | ||
} from '@material-ui/core' | ||
|
||
|
||
import backgroundChat from './bg-chat.png' | ||
import InputMessage from './InputMessage' | ||
import RightHeader from './RightHeader/RightHeader' | ||
|
||
const Background = () => ( | ||
<div style={{ | ||
backgroundImage: `url(${backgroundChat})`, | ||
opacity: '0.06', | ||
position: 'absolute', | ||
width: '100%', | ||
height: '100%' | ||
}} | ||
/> | ||
) | ||
|
||
const RightContainer = ({ classes, chat, sendMessage }) => ( | ||
<Grid item id="rightGrid" className={classes.rightGrid} style={{ width: '70%' }}> | ||
<Card className={classes.rightCard}> | ||
<RightHeader chat={chat} style={{ zIndex: '2' }} /> | ||
<Background /> | ||
|
||
<CardContent className={classes.chatArea} style={{ background: '#e5ddd5' }}> | ||
<List> | ||
{chat.messages.map((message) => ( | ||
<ListItem | ||
key={message.id} | ||
className={classes['message-wrapper']} | ||
> | ||
<Paper | ||
className={classes.message} | ||
elevation={1} | ||
> | ||
<Typography className={classes.information} variant="body2"> | ||
{message.m} | ||
</Typography> | ||
</Paper> | ||
</ListItem> | ||
))} | ||
</List> | ||
</CardContent> | ||
<CardActions style={{ background: '#f0f0f0', zIndex: '2', padding: '10px' }}> | ||
<InputMessage sendMessage={sendMessage} /> | ||
</CardActions> | ||
</Card> | ||
</Grid> | ||
) | ||
|
||
export default RightContainer |
42 changes: 42 additions & 0 deletions
42
src/components/RightContainer/RightHeader/RightHeader-Icons.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react' | ||
|
||
import { makeStyles } from '@material-ui/core/styles' | ||
|
||
import MoreVertIcon from '@material-ui/icons/MoreVert' | ||
import SearchIcon from '@material-ui/icons/Search' | ||
import AttachFileIcon from '@material-ui/icons/AttachFile' | ||
|
||
import IconButton from 'custom-components/IconButton' | ||
|
||
const iconMarginStyle = makeStyles({ | ||
root: { | ||
marginLeft: '6px' | ||
} | ||
}) | ||
|
||
const RightHeaderIcons = () => { | ||
const iconMargin = iconMarginStyle() | ||
return ( | ||
<> | ||
<IconButton> | ||
<SearchIcon /> | ||
</IconButton> | ||
<IconButton | ||
classes={iconMargin} | ||
aria-label="attach" | ||
style={{ | ||
transform: 'rotate(50deg)' | ||
}} | ||
> | ||
<AttachFileIcon /> | ||
</IconButton> | ||
<IconButton | ||
classes={iconMargin} | ||
> | ||
<MoreVertIcon /> | ||
</IconButton> | ||
</> | ||
) | ||
} | ||
|
||
export default RightHeaderIcons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
import { | ||
Avatar | ||
} from '@material-ui/core' | ||
|
||
import CardHeader from 'custom-components/CardHeader' | ||
import RightHeaderIcons from './RightHeader-Icons' | ||
|
||
const RightHeader = ({ chat, style }) => ( | ||
<CardHeader | ||
style={style} | ||
avatar={ | ||
<Avatar alt={chat.name} src={chat.image} aria-label="Recipe" /> | ||
} | ||
action={(<RightHeaderIcons />)} | ||
title={chat.name} | ||
/> | ||
) | ||
|
||
export default RightHeader |
File renamed without changes
Oops, something went wrong.