-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from osoc24/38-ama-create-header-component
Header Component
- Loading branch information
Showing
12 changed files
with
292 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
"packageManager": "[email protected]+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903", | ||
"dependencies": { | ||
"@inrupt/solid-client-authn-browser": "^2.2.4", | ||
"@phosphor-icons/vue": "^2.2.1", | ||
"loama-controller": "link:../controller", | ||
"vite-svg-loader": "^5.1.0", | ||
"vue": "^3.4.29", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<button :class="classList"> | ||
<component :v-if="leftIcon" :is="leftIcon" :size="24"/> | ||
<span><slot></slot></span> | ||
<component :v-if="rightIcon" :is="rightIcon" :size="24"/> | ||
</button> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue'; | ||
const props = withDefaults(defineProps<{ | ||
/** | ||
* The icon to display on the left side of the button. Should be a Phosphor icon from the `@phosphor-icons/vue` package. | ||
*/ | ||
leftIcon?: Object, | ||
/** | ||
* The icon to display on the right side of the button. Should be a Phosphor icon from the `@phosphor-icons/vue` package. | ||
*/ | ||
rightIcon?: Object, | ||
/** | ||
* The variant of the button; defaults to primary. | ||
*/ | ||
variant?: "primary" | "secondary" | ||
}>(), { | ||
variant: "primary" | ||
}) | ||
const classList = computed(() => { | ||
return { | ||
primary: props.variant === "primary", | ||
secondary: props.variant === "secondary" | ||
} | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
button { | ||
display: flex; | ||
flex-flow: row nowrap; | ||
align-items: center; | ||
font-size: 1rem; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: normal; | ||
padding: var(--base-unit); | ||
gap: var(--base-unit); | ||
border-radius: var(--base-corner); | ||
height: fit-content; | ||
border: none; | ||
} | ||
.primary { | ||
background-color: var(--solid-purple); | ||
color: var(--off-white); | ||
} | ||
.secondary { | ||
background-color: var(--solid-white); | ||
color: var(--off-black); | ||
border: 0.25rem solid var(--solid-purple); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<template> | ||
<header> | ||
<div class="wordmark"> | ||
<Loama /> | ||
<span>Loama</span> | ||
</div> | ||
<nav> | ||
<slot></slot> | ||
<LoButton :rightIcon="PhShareFat" class="share">Share access</LoButton> | ||
</nav> | ||
<img :src="pfpSrc" alt="User profile picture" @click="toggleContextMenu" /> | ||
<Suspense> | ||
<HeaderContextMenu class="menu" :class="{ hidden: isContextMenuHidden }" @click="toggleContextMenu" /> | ||
<template #fallback> | ||
Loading context menu... | ||
</template> | ||
</Suspense> | ||
</header> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref } from 'vue'; | ||
import Loama from '../../assets/loama.svg' | ||
import LoButton from '../LoButton.vue' | ||
import HeaderContextMenu from './HeaderContextMenu.vue' | ||
import { PhShareFat } from '@phosphor-icons/vue'; | ||
defineProps<{ | ||
pfpSrc: string, | ||
}>() | ||
const isContextMenuHidden = ref(true) | ||
function toggleContextMenu() { | ||
isContextMenuHidden.value = !isContextMenuHidden.value | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
header, | ||
.wordmark, | ||
nav { | ||
display: flex; | ||
flex-flow: row nowrap; | ||
} | ||
.wordmark, | ||
img { | ||
margin-bottom: calc(var(--base-unit)); | ||
} | ||
header, | ||
img { | ||
border: 0.25rem solid var(--solid-purple); | ||
} | ||
header { | ||
width: 100%; | ||
gap: calc(var(--base-unit)*5); | ||
border-radius: 0 0 var(--base-corner) var(--base-corner); | ||
border-bottom: 0.5rem solid var(--solid-purple); | ||
border-top: 0; | ||
padding: calc(var(--base-unit)*3) calc(var(--base-unit)*6) 0 calc(var(--base-unit)*3); | ||
} | ||
.wordmark>span { | ||
font-family: "JetBrains Mono"; | ||
font-size: calc(var(--base-unit)*6); | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: normal; | ||
color: var(--solid-purple); | ||
text-transform: uppercase; | ||
} | ||
nav { | ||
flex-grow: 1; | ||
align-items: end; | ||
} | ||
.share { | ||
align-self: center; | ||
margin-left: auto; | ||
} | ||
svg { | ||
width: calc(var(--base-unit)*8); | ||
height: calc(var(--base-unit)*8); | ||
} | ||
img { | ||
border-radius: 100%; | ||
width: calc(var(--base-unit)*8); | ||
} | ||
.hidden { | ||
display: none; | ||
} | ||
.menu { | ||
position: absolute; | ||
right: var(--base-unit); | ||
top: calc(var(--base-unit)*14); | ||
min-width: fit-content; | ||
min-height: fit-content; | ||
max-width: 25vw; | ||
max-height: 50vw; | ||
} | ||
</style> |
Oops, something went wrong.