Skip to content

Commit

Permalink
feat: split settings button from a profile component
Browse files Browse the repository at this point in the history
  • Loading branch information
PleahMaCaka committed Oct 30, 2023
1 parent d0e18de commit bbe137b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 25 deletions.
27 changes: 2 additions & 25 deletions src/lib/components/sidebar/Profile.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<script lang="ts">
import { stateStore } from "$lib/stores/StateStore"
import Icon from "@iconify/svelte"
import SettingsButton from "$lib/components/sidebar/SettingsButton.svelte"
export let name = "Guest"
export let profilePic = "/guest.png"
function openSettings() {
$stateStore.showSettings = true
}
</script>


Expand All @@ -19,11 +13,7 @@
</span>
<span class="side-profile-name">{name}</span>
</a>
<button class="side-profile-opt" on:click={openSettings}>
<i class="vertical-center">
<Icon icon="iwwa:option-horizontal" />
</i>
</button>
<SettingsButton />
</div>

<style>
Expand Down Expand Up @@ -69,17 +59,4 @@
font-size: 16px;
color: white;
}
.side-profile-opt {
position: absolute;
z-index: 999;
background-color: transparent;
border: none;
cursor: pointer;
top: 50%;
right: 5%;
transform: translate(0, -50%);
color: white;
font-size: 24px;
}
</style>
27 changes: 27 additions & 0 deletions src/lib/components/sidebar/SettingsButton.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<script>
import Icon from "@iconify/svelte"
import { stateStore } from "$lib/stores/StateStore"
function openSettings() {
$stateStore.showSettings = true
}
</script>

<div class={$$props.class}>
<button class="side-profile-opt" on:click={openSettings}>
<i class="vertical-center">
<Icon icon="iwwa:option-horizontal" />
</i>
</button>
</div>

<style>
.side-profile-opt {
background-color: transparent;
border: none;
cursor: pointer;
color: white;
font-size: 1.6rem;
margin: 4px;
}
</style>

0 comments on commit bbe137b

Please sign in to comment.