-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce `active` property for navItems in shares navigation The `active` property that's being used in the template was simply missing in the navItems. Added it and used the chance to switch over to composition API for the new SharesNavigation component. Use $gettext in template directly Not needed to define it in setup function Finalize SharesNavigation component && adjust tests
- Loading branch information
1 parent
c67c1ac
commit 2854ebf
Showing
22 changed files
with
310 additions
and
106 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Enhancement: Shares overview | ||
|
||
We've merged the three shares navigation items into one central "Shares" item, | ||
with a toggle to switch between the three different kinds of shares (incoming, outgoing, links). | ||
|
||
https://github.com/owncloud/web/issues/6440 | ||
https://github.com/owncloud/web/pull/6512 |
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
85 changes: 85 additions & 0 deletions
85
packages/web-app-files/src/components/AppBar/SharesNavigation.vue
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,85 @@ | ||
<template> | ||
<nav id="shares-navigation" class="oc-py-s" :aria-label="$gettext('Shares pages navigation')"> | ||
<oc-list class="oc-flex oc-visible@s"> | ||
<li v-for="navItem in navItems" :key="`shares-navigation-desktop-${navItem.to}`"> | ||
<oc-button | ||
type="router-link" | ||
class="oc-mr-s" | ||
appearance="raw" | ||
:variation="navItem.active ? 'primary' : 'passive'" | ||
:to="navItem.to" | ||
> | ||
<span v-text="navItem.text" /> | ||
</oc-button> | ||
</li> | ||
</oc-list> | ||
<div class="oc-hidden@s"> | ||
<oc-button id="shares_navigation_mobile" appearance="raw" v-text="$gettext('Shares pages')" /> | ||
<oc-drop toggle="#shares_navigation_mobile" mode="click" close-on-click padding-size="small"> | ||
<oc-list> | ||
<li v-for="navItem in navItems" :key="`shares-navigation-mobile-${navItem.to}`"> | ||
<oc-button | ||
type="router-link" | ||
appearance="raw" | ||
:variation="navItem.active ? 'primary' : 'passive'" | ||
:to="navItem.to" | ||
> | ||
<span v-text="navItem.text" /> | ||
</oc-button> | ||
</li> | ||
</oc-list> | ||
</oc-drop> | ||
</div> | ||
</nav> | ||
</template> | ||
|
||
<script> | ||
import { | ||
isLocationSharesActive, | ||
locationSharesViaLink, | ||
locationSharesWithMe, | ||
locationSharesWithOthers | ||
} from '../../router/shares' | ||
import { computed, getCurrentInstance } from '@vue/composition-api' | ||
import { useRouter } from 'web-pkg/src/composables' | ||
export default { | ||
setup() { | ||
const $gettext = getCurrentInstance().proxy.$gettext | ||
const router = useRouter() | ||
const sharesRoutes = [ | ||
locationSharesWithMe, | ||
locationSharesWithOthers, | ||
locationSharesViaLink | ||
].reduce((routes, route) => { | ||
routes[route.name] = router.getRoutes().find((r) => r.name === route.name) | ||
return routes | ||
}, {}) | ||
const navItems = computed(() => [ | ||
{ | ||
to: sharesRoutes[locationSharesWithMe.name].path, | ||
text: $gettext('Shared with me'), | ||
active: isLocationSharesActive(router, 'files-shares-with-me') | ||
}, | ||
{ | ||
to: sharesRoutes[locationSharesWithOthers.name].path, | ||
text: $gettext('Shared with others'), | ||
active: isLocationSharesActive(router, 'files-shares-with-others') | ||
}, | ||
{ | ||
to: sharesRoutes[locationSharesViaLink.name].path, | ||
text: $gettext('Shared via link'), | ||
active: isLocationSharesActive(router, 'files-shares-via-link') | ||
} | ||
]) | ||
return { | ||
navItems | ||
} | ||
} | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
.router-link-active { | ||
text-decoration: underline; | ||
} | ||
</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
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
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
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
Oops, something went wrong.