Skip to content

Commit

Permalink
Merge pull request #188 from boostcamp-2020/refactor/message-editor-s…
Browse files Browse the repository at this point in the history
…tyle

Refactor: modify message editor style to include images
  • Loading branch information
bell-won authored Dec 17, 2020
2 parents 2c69079 + 1774b0e commit e25cc6b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 21 deletions.
1 change: 0 additions & 1 deletion frontend/src/container/ChatRoom/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const ChatRoom = ({ width }) => {
[messages],
)


useEffect(() => {
setMessages([])
isLoading.current = false
Expand Down
30 changes: 23 additions & 7 deletions frontend/src/container/MessageEditor/MessageEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@ function MessageEditor({ sendMessage, placeholder }) {

return (
<MessageEditorContainer>
<Input
placeholder={placeholder}
handleChange={handleInput}
handleKey={handleKey}
value={message}
/>
{isRender && renderPreview()}
<EditorArea>
<Input
placeholder={placeholder}
handleChange={handleInput}
handleKey={handleKey}
value={message}
type="messageEditor"
/>
{isRender && renderPreview()}
</EditorArea>
<StyledDiv>
<FileUploader file={file} setFile={setFile} />
<Button handleClick={sendMessageHanle} disabled={!isSend}>
Expand All @@ -83,4 +86,17 @@ const StyledDiv = styled.div`
float: right;
margin-top: 5px;
`
const EditorArea = styled.div`
&:focus-within {
box-shadow: 0 0 0 1px rgba(18, 100, 163, 1),
0 0 0 5px rgba(29, 155, 209, 0.3);
border-radius: 4px;
border-color: transparent;
}
&:focus-within > div {
display: block;
}
border: 1px solid ${COLOR.TRANSPARENT_GRAY};
border-radius: 4px;
`
export default MessageEditor
33 changes: 20 additions & 13 deletions frontend/src/presenter/Input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ function Input({
handleKey,
value,
maxLength,
type = 'default',
}) {
return (
<StyledInputWrapper tabIndex="-1">
<StyledInputWrapper tabIndex="-1" type={type}>
{children}
<StyledInput
placeholder={placeholder}
Expand All @@ -26,18 +27,23 @@ function Input({
)
}
const StyledInputWrapper = styled.div`
&:focus-within {
outline: none;
box-shadow: 0 0 0 1px rgba(18, 100, 163, 1),
0 0 0 5px rgba(29, 155, 209, 0.3);
border-radius: 4px;
border-color: transparent;
}
&:focus-within > div {
display: block;
}
border: 1px solid ${COLOR.TRANSPARENT_GRAY};
border-radius: 4px;
${({ type }) => {
if (type === 'default')
return `
&:focus-within {
box-shadow: 0 0 0 1px rgba(18, 100, 163, 1),
0 0 0 5px rgba(29, 155, 209, 0.3);
border-radius: 4px;
border-color: transparent;
}
&:focus-within > div {
display: block;
}
border: 1px solid ${COLOR.TRANSPARENT_GRAY};
border-radius: 4px;
`
}}
outline: none;
justify-content: space-between;
display: flex;
padding: 5px;
Expand All @@ -57,6 +63,7 @@ const StyledInput = styled.input`
width: 100%;
border: none;
outline: none;
background-color: inherit;
`

export default Input

0 comments on commit e25cc6b

Please sign in to comment.