Skip to content

Commit

Permalink
✨ Added channel message input
Browse files Browse the repository at this point in the history
  • Loading branch information
ZickZenni committed Sep 5, 2024
1 parent 052a001 commit 592d423
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/renderer/pages/Guild/Channel/Channel.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
flex-direction: column-reverse;
overflow-y: auto;
width: 100%;
height: calc(100% - 40px);
height: calc(100% - 100px);
gap: 8px;
padding: var(--channel-page-messages-padding);
}
Expand Down Expand Up @@ -84,3 +84,16 @@
.channel_page__message_timestamp {
color: gray;
}

.channel_page__message_input {
width: calc(100% - 40px - 16px);
height: 30px;
padding: 8px;
margin: 7px 20px;
font-size: medium;
filter: drop-shadow(0px 3px 1px #00000020);
background: var(--background);
color: white;
border: none;
border: var(--border) var(--border-size) solid;
}
16 changes: 16 additions & 0 deletions src/renderer/pages/Guild/Channel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ export default function ChannelPage() {

if (channelId.length === 0 || channel === null) return null;

const handleMessageInput = (e: any) => {
if (e.key !== 'Enter') return;
const { value } = e.target;

if (value === '') return;

channel?.createMessage({
content: value,
});
};

return (
<div className="channel_page__container">
<div className="channel_page__header">
Expand Down Expand Up @@ -81,6 +92,11 @@ export default function ChannelPage() {
);
})}
</div>
<input
className="channel_page__message_input"
type="text"
onKeyDown={handleMessageInput}
/>
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/renderer/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ body {
font-weight: 400;
font-style: normal;
overflow: hidden;
color-scheme: dark;
}

a,
Expand Down

0 comments on commit 592d423

Please sign in to comment.