tweak player rows to work better on mobile devices

This commit is contained in:
Oliver-Akins 2021-12-17 01:41:54 -06:00
parent 52c6866817
commit dc15f29401

View file

@ -10,12 +10,7 @@ function exitPlayer() {};
function changeColour() {}; function changeColour() {};
function canLeave() { let canLeave = $myName == $hostName || name == $myName;
if ($myName == $hostName) {
return true;
};
return name == $myName;
}
</script> </script>
<div class="player" style="--colour: {colour};"> <div class="player" style="--colour: {colour};">
@ -41,14 +36,19 @@ function canLeave() {
<!-- The player's name --> <!-- The player's name -->
<div class="player-name"> <div class="player-name">
<span class="name">
{name} {name}
</span>
{#if $myName == name} {#if $myName == name}
(You) <span class="player-indicator">
You
</span>
{/if} {/if}
</div> </div>
<!-- Whether or not to show the kick Player button in the row --> <!-- Whether or not to show the kick Player button in the row -->
{#if canLeave()} {#if canLeave}
<SciFiButton <SciFiButton
background="#ff0000" background="#ff0000"
handler={exitPlayer} handler={exitPlayer}
@ -64,6 +64,8 @@ function canLeave() {
</div> </div>
<style lang="scss"> <style lang="scss">
@import "../styles/mixins";
.player { .player {
height: 70px; height: 70px;
display: flex; display: flex;
@ -72,6 +74,7 @@ function canLeave() {
background: rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.1);
border-radius: 10px; border-radius: 10px;
margin: 10px; margin: 10px;
max-width: 95%;
> div.player-colour { > div.player-colour {
margin: 10px; margin: 10px;
@ -84,6 +87,23 @@ function canLeave() {
> .player-name { > .player-name {
flex-grow: 1; flex-grow: 1;
display: flex;
align-items: center;
.name {
flex-grow: 1;
}
}
.player-indicator {
border-radius: 5px;
background-color: #00aa00;
color: black;
padding: 5px 7px;
}
@include medium {
max-width: 47%;
} }
} }
</style> </style>