update chat

This commit is contained in:
_Bastler 2021-07-20 21:17:54 +02:00
parent c9b3835f99
commit 28583ad9c0
4 changed files with 12 additions and 47 deletions

View File

@ -29,7 +29,7 @@
<svelte:window on:keydown={onKeyDown}/> <svelte:window on:keydown={onKeyDown}/>
<aside class="chatWindow" transition:fly="{{ x: -1000, duration: 500 }}"> <aside class="chatWindow nes-container is-rounded is-dark" transition:fly="{{ x: -1000, duration: 500 }}">
<p class="close-icon" on:click={closeChat}>&times</p> <p class="close-icon" on:click={closeChat}>&times</p>
<section class="messagesList" bind:this={listDom}> <section class="messagesList" bind:this={listDom}>
<ul> <ul>
@ -60,7 +60,6 @@
padding:6px; padding:6px;
overflow-wrap: break-word; overflow-wrap: break-word;
max-width: 100%; max-width: 100%;
background: gray;
display: inline-block; display: inline-block;
} }
@ -73,16 +72,12 @@
height: 100vh; height: 100vh;
width:30vw; width:30vw;
min-width: 350px; min-width: 350px;
background: rgb(5, 31, 51, 0.9);
color: whitesmoke; color: whitesmoke;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin: 0;
padding: 10px; padding: 10px;
border-bottom-right-radius: 16px;
border-top-right-radius: 16px;
.messagesList { .messagesList {
margin-top: 35px; margin-top: 35px;
overflow-y: auto; overflow-y: auto;

View File

@ -35,21 +35,18 @@
{:else if message.type === ChatMessageTypes.me} {:else if message.type === ChatMessageTypes.me}
<h4>Me: <span class="date">({renderDate(message.date)})</span></h4> <h4>Me: <span class="date">({renderDate(message.date)})</span></h4>
{#each texts as text} {#each texts as text}
<div><p class="my-text">{@html urlifyText(text)}</p></div> <div><p class="my-text nes-balloon from-left is-dark">{@html urlifyText(text)}</p></div>
{/each} {/each}
{:else} {:else}
<h4><ChatPlayerName player={author} line={line}></ChatPlayerName>: <span class="date">({renderDate(message.date)})</span></h4> <h4><ChatPlayerName player={author} line={line}></ChatPlayerName>: <span class="date">({renderDate(message.date)})</span></h4>
{#each texts as text} {#each texts as text}
<div><p class="other-text">{@html urlifyText(text)}</p></div> <div><p class="other-text nes-balloon from-right is-dark">{@html urlifyText(text)}</p></div>
{/each} {/each}
{/if} {/if}
</div> </div>
</div> </div>
<style lang="scss"> <style lang="scss">
h4, p {
font-family: Lato;
}
div.chatElement { div.chatElement {
display: flex; display: flex;
margin-bottom: 20px; margin-bottom: 20px;
@ -64,18 +61,14 @@
} }
div > p { div > p {
border-radius: 8px;
margin-bottom: 10px;
padding:6px;
overflow-wrap: break-word; overflow-wrap: break-word;
max-width: 100%; max-width: 100%;
display: inline-block; display: inline-block;
&.other-text { min-width: 75px;
background: gray; padding: 5px;
}
&.my-text { &.other-text {
background: #6489ff; float: right;
} }
} }
} }

View File

@ -18,8 +18,8 @@
</script> </script>
<form on:submit|preventDefault={saveMessage}> <form on:submit|preventDefault={saveMessage}>
<input type="text" bind:value={newMessageText} placeholder="Enter your message..." on:focus={onFocus} on:blur={onBlur} > <input class="nes-input is-dark" type="text" bind:value={newMessageText} placeholder="Enter your message..." on:focus={onFocus} on:blur={onBlur} >
<button type="submit"> <button class="nes-btn is-dark" type="submit">
<img src="/static/images/send.png" alt="Send" width="20"> <img src="/static/images/send.png" alt="Send" width="20">
</button> </button>
</form> </form>
@ -29,28 +29,5 @@
display: flex; display: flex;
padding-left: 4px; padding-left: 4px;
padding-right: 4px; padding-right: 4px;
input {
flex: auto;
background-color: #254560;
color: white;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
border: none;
font-size: 22px;
font-family: Lato;
padding-left: 6px;
min-width: 0; //Needed so that the input doesn't overflow the container in firefox
outline: none;
}
button {
background-color: #254560;
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
border: none;
border-left: solid white 1px;
font-size: 16px;
}
} }
</style> </style>

View File

@ -6,5 +6,5 @@
} }
*{ *{
font-family: "twemoji","Press Start 2P",monospace; font-family: "Press Start 2P",monospace;
} }