Skip to content

Commit

Permalink
Merge pull request #59 from solid/view-your-profile
Browse files Browse the repository at this point in the history
Adds a link to your profile + fixes a photo bug
  • Loading branch information
megoth authored Aug 19, 2019
2 parents d6055e3 + 28e0e56 commit 4b8e970
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/global/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,19 @@ function createUserMenuButton (label: string, onClick: EventListenerOrEventListe
return button
}

function createUserMenuLink (label: string, href: string): HTMLElement {
const link = document.createElement("a")
link.classList.add("header-user-menu__link")
link.href = href
link.innerText = label
return link
}

async function createUserMenu (store: IndexedFormula, user: NamedNode): Promise<HTMLElement> {
const outliner = panes.getOutliner(document)

const loggedInMenuList = document.createElement("ul")
loggedInMenuList.appendChild(createUserMenuItem(createUserMenuLink("Show your profile", user.uri)))
const menuItems = await getMenuItems(outliner)
menuItems.forEach(item => {
loggedInMenuList.appendChild(createUserMenuItem(createUserMenuButton(item.label, () => openDashboardPane(outliner, item.tabName || item.paneName))))
Expand Down
4 changes: 3 additions & 1 deletion src/styles/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ $icon-size: 60px;
$image-margin: 5px;
$image-size: $icon-size - $image-margin * 2;
border-radius: 50%;
background-position: center;
background-repeat: no-repeat;
background-size: $image-size;
background-size: cover;
margin: $image-margin;
height: $image-size;
width: $image-size;
Expand All @@ -87,6 +88,7 @@ $icon-size: 60px;
&__trigger {
background: none;
border: 0;
cursor: pointer;
width: $icon-size;
height: $icon-size;
img {
Expand Down

0 comments on commit 4b8e970

Please sign in to comment.