Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions css/publicshare.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,3 @@
* from the top padding of the second element). */
padding-bottom: 8px;
}



#talk-sidebar-trigger {
width: 44px;
height: 44px;

background-color: transparent;
border-color: transparent;

opacity: 0.6;
}

#talk-sidebar-trigger:hover,
#talk-sidebar-trigger:focus,
#talk-sidebar-trigger:active {
opacity: 1;
}
73 changes: 73 additions & 0 deletions src/PublicShareSidebarTrigger.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!--
- @copyright Copyright (c) 2022 Daniel Calviño Sánchez <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->

<template>
<div class="button-holder">
<Button type="tertiary-on-primary"
:aria-label="ariaLabel"
@click="$emit('click')">
<template #icon>
<MenuPeople :size="20" />
</template>
</Button>
</div>
</template>

<script>
import Button from '@nextcloud/vue/dist/Components/Button'
import MenuPeople from './components/missingMaterialDesignIcons/MenuPeople.vue'

export default {

name: 'PublicShareSidebarTrigger',

components: {
Button,
MenuPeople,
},

props: {
sidebarState: {
type: Object,
required: true,
},
},

computed: {
ariaLabel() {
if (this.sidebarState.isOpen) {
return t('spreed', 'Close Talk sidebar')
}

return t('spreed', 'Open Talk sidebar')
},
},

}
</script>

<style scoped>
.button-holder {
margin: 2px 5px 2px 2px;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Header contents are vertically centered. Are the vertical margins needed?

Out of curiosity, why 5px instead of 2px for margin-right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The margins where needed otherwise the box shadow was cut off.

For the right sidebar I added 3px on top so the white border of keyboard active doesn't touch the browser as it looked too weird.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The margins where needed otherwise the box shadow was cut off.

I tried removing the margins (or, rather, replacing with margin-right: 3px) and as far as I can tell it was working fine 🤷 That is why I was asking. But maybe it depends on the browser, I do not know.

For the right sidebar I added 3px on top so the white border of keyboard active doesn't touch the browser as it looked too weird.

👍

display: flex;
justify-content: center;
Comment on lines +69 to +70
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed to horizontally center the button? As the div has no explicit width it should have the width of its child elements, so the button should be already centerd in the div. Or am I missing something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied this from the app icons and only then the centering worked as expected.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, I tried removing the rules and as far as I can tell it was working fine. But same as above, maybe it is related to the browser, no idea 🤷

height: 44px !important;
}
</style>
16 changes: 12 additions & 4 deletions src/mainPublicShareSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import Vue from 'vue'
import VueObserveVisibility from 'vue-observe-visibility'
import PublicShareSidebar from './PublicShareSidebar.vue'
import PublicShareSidebarTrigger from './PublicShareSidebarTrigger.vue'
import './init.js'

// Store
Expand Down Expand Up @@ -98,10 +99,6 @@ if (window.innerWidth > 1111) {
function addTalkSidebarTrigger() {
const talkSidebarTriggerElement = document.createElement('button')
talkSidebarTriggerElement.setAttribute('id', 'talk-sidebar-trigger')
talkSidebarTriggerElement.setAttribute('class', 'icon-menu-people-white')
talkSidebarTriggerElement.addEventListener('click', () => {
sidebarState.isOpen = !sidebarState.isOpen
})

// The ".header-right" element may not exist in the public share page if
// there are no header actions.
Expand All @@ -112,6 +109,17 @@ function addTalkSidebarTrigger() {
}

document.querySelector('.header-right').appendChild(talkSidebarTriggerElement)

const talkSidebarTriggerVm = new Vue({
propsData: {
sidebarState,
},
...PublicShareSidebarTrigger,
})
talkSidebarTriggerVm.$on('click', () => {
sidebarState.isOpen = !sidebarState.isOpen
})
talkSidebarTriggerVm.$mount('#talk-sidebar-trigger')
}

addTalkSidebarTrigger()
Expand Down