Skip to content

Commit

Permalink
Use ActionButton for AppNavigationToggle
Browse files Browse the repository at this point in the history
Signed-off-by: Jan C. Borchardt <[email protected]>
Signed-off-by: Raimund Schlüßler <[email protected]>
  • Loading branch information
jancborchardt authored and raimund-schluessler committed Apr 13, 2021
1 parent 0d6eb7c commit b82043c
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions src/components/AppNavigationToggle/AppNavigationToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,40 @@
-
-->
<template>
<a class="app-navigation-toggle"
href="#"
:aria-expanded="open ? 'true' : 'false'"
aria-controls="app-navigation-vue"
@click.prevent="toggleNavigation"
@keydown.space.exact.prevent="toggleNavigation" />
<Actions class="app-navigation-toggle">
<ActionButton
:aria-expanded="open ? 'true' : 'false'"
:aria-label="label"
aria-controls="app-navigation-vue"
@click="$emit('update:open', !open)">
{{ label }}
</ActionButton>
</Actions>
</template>

<script>
import Actions from '../Actions/Actions'
import ActionButton from '../ActionButton/ActionButton'

export default {

name: 'AppNavigationToggle',

components: {
Actions,
ActionButton,
},

props: {
open: {
type: Boolean,
required: true,
},
},

methods: {
toggleNavigation() {
this.$emit('update:open', !this.open)
computed: {
label() {
return this.open ? this.t('Close navigation') : this.t('Open navigation')
},
},
}
Expand All @@ -53,26 +64,13 @@ export default {
<style scoped lang="scss">
@import '../../fonts/scss/iconfont-vue';

.app-navigation-toggle {
button.app-navigation-toggle {
position: absolute;
top: 0;
right: 0;
margin-right: - $clickable-area;
width: $clickable-area;
height: $clickable-area;
padding: $icon-margin;

cursor: pointer;
opacity: 0.6;

font-size: $icon-size;
line-height: 17px;
@include iconfont('menu');

&:hover,
&:focus {
opacity: $opacity_full;
}
}

</style>

0 comments on commit b82043c

Please sign in to comment.