2023-01-03 09:26:08 +01:00
|
|
|
<script>
|
2023-10-22 09:47:13 +01:00
|
|
|
import { goto } from '$app/navigation';
|
2023-08-03 19:31:59 +01:00
|
|
|
import { browser } from '$app/environment';
|
2023-08-02 19:35:27 +01:00
|
|
|
import NotificationIcon from 'carbon-icons-svelte/lib/Notification.svelte';
|
|
|
|
|
import Moon from 'carbon-icons-svelte/lib/Moon.svelte';
|
|
|
|
|
import Sun from 'carbon-icons-svelte/lib/Sun.svelte';
|
2023-09-04 19:48:13 +00:00
|
|
|
import Menu from 'carbon-icons-svelte/lib/Menu.svelte';
|
|
|
|
|
import Close from 'carbon-icons-svelte/lib/Close.svelte';
|
2023-10-22 09:47:13 +01:00
|
|
|
import ArrowLeft from 'carbon-icons-svelte/lib/ArrowLeft.svelte';
|
2023-05-05 20:19:45 +00:00
|
|
|
|
2023-08-02 19:35:27 +01:00
|
|
|
import IconButton from '$lib/components/IconButton/index.svelte';
|
2024-02-01 20:18:03 +01:00
|
|
|
import { globalStore } from '$lib/utils/store/app';
|
2023-08-05 04:44:32 +01:00
|
|
|
import { currentOrgPath } from '$lib/utils/store/org';
|
2023-09-07 10:47:25 +00:00
|
|
|
import { toggleBodyByMode } from '$lib/utils/functions/app';
|
2023-11-01 09:45:40 +00:00
|
|
|
import { sideBar } from '../Org/store';
|
2023-01-03 09:26:08 +01:00
|
|
|
|
2023-08-05 04:44:32 +01:00
|
|
|
export let title = '';
|
2023-01-03 09:26:08 +01:00
|
|
|
export let navClass = '';
|
2023-08-05 04:44:32 +01:00
|
|
|
export let isCoursePage = false;
|
2023-05-05 20:19:45 +00:00
|
|
|
|
2023-09-04 19:48:13 +00:00
|
|
|
const toggleSidebar = () => {
|
2023-11-01 09:45:40 +00:00
|
|
|
$sideBar.hidden = !$sideBar.hidden;
|
2023-10-03 14:51:02 +00:00
|
|
|
};
|
|
|
|
|
|
2023-08-20 19:08:48 +00:00
|
|
|
function toggleDarkMode() {
|
2024-02-01 20:18:03 +01:00
|
|
|
$globalStore.isDark = !$globalStore.isDark;
|
2023-05-05 20:19:45 +00:00
|
|
|
|
2024-02-01 20:18:03 +01:00
|
|
|
toggleBodyByMode($globalStore.isDark);
|
2023-08-03 19:31:59 +01:00
|
|
|
|
|
|
|
|
if (browser) {
|
2024-02-01 20:18:03 +01:00
|
|
|
localStorage.setItem('mode', $globalStore.isDark ? 'dark' : '');
|
2023-08-03 19:31:59 +01:00
|
|
|
}
|
2023-05-05 20:19:45 +00:00
|
|
|
}
|
2023-08-05 04:44:32 +01:00
|
|
|
|
2024-02-01 20:18:03 +01:00
|
|
|
$: coursesPath = $globalStore.isOrgSite
|
2023-10-22 09:47:13 +01:00
|
|
|
? '/lms/mylearning'
|
|
|
|
|
: isCoursePage
|
2024-01-25 17:08:40 +01:00
|
|
|
? `${$currentOrgPath}/courses`
|
|
|
|
|
: $currentOrgPath;
|
2023-01-03 09:26:08 +01:00
|
|
|
</script>
|
|
|
|
|
|
2023-08-20 19:08:48 +00:00
|
|
|
<nav
|
2023-09-12 11:31:20 +00:00
|
|
|
class="{navClass} flex w-full p-1 md:px-6 bg-primary-700 transition delay-150 duration-300 ease-in-out h-[48px]"
|
2023-08-20 19:08:48 +00:00
|
|
|
>
|
2023-01-03 09:26:08 +01:00
|
|
|
<ul class="flex w-full items-center">
|
2023-08-05 07:47:17 +01:00
|
|
|
<div class="flex items-center text-white">
|
2023-09-12 11:31:20 +00:00
|
|
|
<li class="md:hidden">
|
2023-11-01 09:45:40 +00:00
|
|
|
<IconButton
|
|
|
|
|
onClick={() => {
|
|
|
|
|
toggleSidebar();
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{#if $sideBar.hidden}
|
2023-09-12 11:31:20 +00:00
|
|
|
<Menu size={16} class=" text-white" />
|
|
|
|
|
{:else}
|
|
|
|
|
<Close size={16} class=" text-white" />
|
|
|
|
|
{/if}
|
|
|
|
|
</IconButton>
|
|
|
|
|
</li>
|
|
|
|
|
|
2023-08-05 07:47:17 +01:00
|
|
|
{#if isCoursePage}
|
2023-10-04 08:18:33 +01:00
|
|
|
<li class="hidden md:block">
|
2023-11-01 09:45:40 +00:00
|
|
|
<IconButton
|
|
|
|
|
onClick={() => {
|
|
|
|
|
toggleSidebar();
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-10-04 08:18:33 +01:00
|
|
|
<Menu size={16} class=" text-white" />
|
|
|
|
|
</IconButton>
|
|
|
|
|
</li>
|
2023-10-22 09:47:13 +01:00
|
|
|
<li class="hidden md:block">
|
|
|
|
|
<IconButton onClick={() => goto(coursesPath)}>
|
|
|
|
|
<ArrowLeft size={16} class="text-white" />
|
|
|
|
|
</IconButton>
|
|
|
|
|
</li>
|
2023-08-05 07:47:17 +01:00
|
|
|
{/if}
|
2023-08-05 04:44:32 +01:00
|
|
|
<a
|
2023-09-28 11:45:50 +01:00
|
|
|
href={coursesPath}
|
2023-08-05 04:44:32 +01:00
|
|
|
title="Go to {isCoursePage ? 'Courses' : 'ClassroomIO Home'}"
|
|
|
|
|
id="logo"
|
2023-10-22 09:47:13 +01:00
|
|
|
class="text-lg line-clamp-1"
|
2023-08-05 04:44:32 +01:00
|
|
|
>
|
|
|
|
|
{isCoursePage ? title : 'ClassroomIO'}
|
2023-01-03 09:26:08 +01:00
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<span class="flex-grow" />
|
|
|
|
|
|
|
|
|
|
<li>
|
2023-08-02 19:35:27 +01:00
|
|
|
<NotificationIcon size={20} class="text-white mr-2" />
|
2023-01-03 09:26:08 +01:00
|
|
|
</li>
|
2023-05-05 20:19:45 +00:00
|
|
|
<li>
|
2023-08-20 19:08:48 +00:00
|
|
|
<IconButton size="small" onClick={toggleDarkMode}>
|
2024-02-01 20:18:03 +01:00
|
|
|
{#if $globalStore.isDark}
|
2023-08-02 19:35:27 +01:00
|
|
|
<Sun size={16} class="text-white" />
|
2023-05-05 20:19:45 +00:00
|
|
|
{:else}
|
2023-08-02 19:35:27 +01:00
|
|
|
<Moon size={16} class="text-white" />
|
2023-05-05 20:19:45 +00:00
|
|
|
{/if}
|
|
|
|
|
</IconButton>
|
|
|
|
|
</li>
|
2023-09-04 19:48:13 +00:00
|
|
|
|
2023-05-02 23:55:26 +00:00
|
|
|
<li />
|
2023-01-03 09:26:08 +01:00
|
|
|
</ul>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
ul {
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* clearfix */
|
|
|
|
|
ul::after {
|
|
|
|
|
content: '';
|
|
|
|
|
display: block;
|
|
|
|
|
clear: both;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* li.new-question {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
a {
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
color: #fff;
|
|
|
|
|
font-weight: 700;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media only screen and (max-width: 1002px) {
|
|
|
|
|
nav.hide {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
ul {
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
a {
|
|
|
|
|
padding: 0 0.5em;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|