Use flex to keep the input box at the bottom

This commit is contained in:
Franck Royer 2021-04-26 17:33:12 +10:00
parent 2d3cc73569
commit a27080fc34
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
2 changed files with 19 additions and 28 deletions

View File

@ -1,4 +1,3 @@
import { Paper } from '@material-ui/core';
import { multiaddr } from 'multiaddr';
import PeerId from 'peer-id';
import React, { useEffect, useState } from 'react';
@ -155,18 +154,14 @@ export default function App() {
};
return (
<div className="App">
<div className="chat-room">
<WakuContext.Provider value={{ waku: stateWaku }}>
<Paper>
<Room
nick={nick}
lines={stateMessages}
commandHandler={commandHandler}
/>
</Paper>
</WakuContext.Provider>
</div>
<div className="chat-app">
<WakuContext.Provider value={{ waku: stateWaku }}>
<Room
nick={nick}
lines={stateMessages}
commandHandler={commandHandler}
/>
</WakuContext.Provider>
</div>
);
}

View File

@ -1,4 +1,4 @@
import { Box, Grid, List, ListItem, ListItemText } from '@material-ui/core';
import { List, ListItem, ListItemText } from '@material-ui/core';
import React, { useState } from 'react';
import { ChatMessage } from 'waku-chat/chat_message';
import { WakuMessage } from 'waku/waku_message';
@ -38,24 +38,20 @@ export default function Room(props: Props) {
};
return (
<Grid container spacing={2}>
<Grid item xs={12}>
<Box
height={800}
maxHeight={800}
style={{ flex: 1, maxHeight: '100%', overflow: 'scroll' }}
>
<Lines messages={props.lines} />
</Box>
</Grid>
<Grid item xs={12}>
<div
className="chat-container"
style={{ height: '100vh', display: 'flex', flexDirection: 'column' }}
>
<div className="chat-list" style={{ flexGrow: 1, overflow: 'scroll' }}>
<Lines messages={props.lines} />
</div>
<div className="chat-input" style={{ flexGrow: 0, height: '120px' }}>
<MessageInput
messageHandler={messageHandler}
sendMessage={sendMessage}
/>
</Grid>
</Grid>
</div>
</div>
);
}