<template>
  <section id="content">
    <div id="content-header">
      <h1 :class="[loggedInUserDarkModeBoolean ? 'h1-darkmode' : 'h1-lightmode']" id="page-name">Pagename</h1>
    </div>
    <div id="content-body">
      <section :class="[loggedInUserDarkModeBoolean ? 'stuff-darkmode' : 'stuff-lightmode']" id="stuff"></section>
    </div>
  </section>
</template>


<script setup>
import { ref, onMounted, watch } from 'vue';
import { useStore } from 'vuex';
import { computed } from 'vue';

const store = useStore();
const modeChanged = computed(() => store.state.updateDarkMode);

definePageMeta({
  layout: 'default',
  title: 'Test'
})

const loggedInUserDarkModeBoolean = ref('');

const getSession = async () => {
  const loggedInUserDarkModeBool = getItem('logged-in-user-darkMode');
  if (loggedInUserDarkModeBool == 1) {
    loggedInUserDarkModeBoolean.value = true;
  } else {
    loggedInUserDarkModeBoolean.value = false;
  }
}

function getItem(item) {
  if (process.client) {
    return localStorage.getItem(item)
  } else {
    return undefined
  }
}

watch(modeChanged, getSession)

onMounted(async () => {
  await getSession();
});
</script>

<script>
export default {
  name: "Testpage",
}
</script>



<style scoped>
* {
  box-sizing: border-box;
}


#content {
  display: flex;
  flex-direction: column;
  float: left;
  justify-content: stretch;
  align-items: stretch;
  width: 100%;
  flex-grow: 1;
  gap: 0.625rem;
  padding: 0 1.25rem;
}

.h1-darkmode {
  color: #fff;
}

.h1-lightmode {
  color: #000;
}

#content-header {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 3.125rem;
}

#page-name {
  letter-spacing: 5%;
  font: 400 1.5rem/125% Overpass, -apple-system, Roboto, Helvetica,
    sans-serif;
}

#content-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 1.25rem;
  margin-bottom: 0.625rem;
  border-radius: 0.625rem;
}

#stuff {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 1.25rem;
  padding: 1.25rem 1.875rem;
  box-shadow: 0.25rem 0.25rem 0.25rem 0rem rgba(0, 0, 0, 0.25);
  border-radius: 0.625em;
}

.stuff-darkmode {
  background-color: #2C2C2C;
}

.stuff-lightmode {
  background-color: #fff;
}
</style>