wip style according to pages

This commit is contained in:
simplonco
2023-01-15 19:16:06 +01:00
parent acd480e332
commit 164581b655
3 changed files with 64 additions and 12 deletions

View File

@@ -5,31 +5,56 @@
import { location } from 'svelte-spa-router'; import { location } from 'svelte-spa-router';
let color = "transparent"; let style =
{
lines_width: "1px",
lines_color: "black",
bg_color: "bisque",
}
console.log("location:",$location); console.log("location:",$location);
if ($location !== '/') if ($location !== '/')
init_socket(); init_socket();
function change_color(loc) function change_style(loc)
{ {
console.log("change color, location:", loc); console.log("change color, location:", loc);
if (loc.startsWith("/game")) if (loc.startsWith("/game"))
console.log("in change"); {
style.lines_width = "2px";
style.lines_color = "white";
style.bg_color = "#222425";
}
if (loc.startsWith("/spectator")) if (loc.startsWith("/spectator"))
console.log("in change"); {
style.lines_width = "1px";
style.lines_color = "black";
style.bg_color = "bisque";
}
if (loc.startsWith("/ranking")) if (loc.startsWith("/ranking"))
console.log("in change"); {
style.lines_width = "1px";
style.lines_color = "black";
style.bg_color = "bisque";
}
if (loc.startsWith("/profile")) if (loc.startsWith("/profile"))
console.log("in change"); {
style.lines_width = "1px";
style.lines_color = "black";
style.bg_color = "bisque";
}
} }
$: change_color($location); $: change_style($location);
</script> </script>
{#if $location !== '/'} {#if $location !== '/'}
<!--
<Layouts color={color} /> <Layouts color={color} />
-->
<Layouts --lines_width={style.lines_width} --lines_color={style.lines_color} --bg_color={style.bg_color} />
{/if} {/if}
<style></style> <style></style>

View File

@@ -6,7 +6,10 @@
</script> </script>
<!--
<div class="{$layout} chat_box" style="background-color: {color};"> <div class="{$layout} chat_box" style="background-color: {color};">
-->
<div class="{$layout} chat_box">
<slot></slot> <slot></slot>
</div> </div>
@@ -22,7 +25,8 @@
padding: 0px; padding: 0px;
width: auto; width: auto;
height: auto; height: auto;
border: 1px solid black; border: var(--lines_width) solid var(--lines_color);
background-color: var(--bg_color);
z-index: 1; z-index: 1;
} }
@@ -34,6 +38,14 @@
*/ */
/* gobal variables styles
--lines_width
--lines_color
--bg_color
*/
/* Hide scrollbar /* Hide scrollbar
*/ */
.chat_box :global(*) { .chat_box :global(*) {
@@ -67,6 +79,7 @@
.chat_box :global(.grid_box p) { .chat_box :global(.grid_box p) {
padding: 10px; padding: 10px;
font-size: 15px; font-size: 15px;
color: var(--lines_color);
} }
@@ -110,7 +123,7 @@
/* __border_top /* __border_top
*/ */
.chat_box :global(.__border_top) { .chat_box :global(.__border_top) {
border-top: 1px solid black; border-top: var(--lines_width) solid var(--lines_color);
} }

View File

@@ -2,6 +2,7 @@
import { layout, current_room, settings_user } from './Store_chat'; import { layout, current_room, settings_user } from './Store_chat';
import { get_is_admin } from './Request_rooms'; import { get_is_admin } from './Request_rooms';
import { to_print } from './Utils_chat';
import Button from './Element_button.svelte'; import Button from './Element_button.svelte';
import { push } from "svelte-spa-router"; import { push } from "svelte-spa-router";
import { invited_username } from '../store_invitation'; import { invited_username } from '../store_invitation';
@@ -16,10 +17,23 @@
function game_invitation() function game_invitation()
{ {
to_print("in game_invitation");
const username = $settings_user; const username = $settings_user;
invited_username.set(username); invited_username.set(username);
push("/game"); push("/game");
} }
function view_profile()
{
to_print("in view_profile");
}
function make_admin()
{
to_print("in make_admin");
}
function mute_user()
{
to_print("in mute_user");
}
</script> </script>
@@ -50,7 +64,7 @@
<!-- panel_user --> <!-- panel_user -->
<div class="panel panel_user __border_top"> <div class="panel panel_user __border_top">
<p class="__center">user options :</p> <p class="__center">user options :</p>
<Button> <Button on:click={view_profile}>
view profile view profile
</Button> </Button>
<Button on:click={game_invitation}> <Button on:click={game_invitation}>
@@ -58,10 +72,10 @@
</Button> </Button>
{#if back === "room_set"} {#if back === "room_set"}
<Button> <Button on:click={make_admin}>
make admin make admin
</Button> </Button>
<Button> <Button on:click={mute_user}>
{mute} {mute}
</Button> </Button>
{/if} {/if}