-
Notifications
You must be signed in to change notification settings - Fork 31
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 #831 from oslokommune/period-selector-facelift
Period selector facelift
- Loading branch information
Showing
10 changed files
with
290 additions
and
203 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
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 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,87 @@ | ||
<template> | ||
<nav-menu class="period-selector-menu"> | ||
<nav-menu-text | ||
:text="`${$t('general.period')}:`" | ||
strong | ||
class="period-selector-menu__label pkt-show-tablet-up" | ||
/> | ||
<nav-menu-item v-slot="{ close }" :text="periodLabel" dropdown> | ||
<period-selector | ||
v-model="period" | ||
:options="_predefinedPeriods" | ||
:max-months="3" | ||
class="period-selector-menu__dropdown" | ||
@input="close" | ||
/> | ||
</nav-menu-item> | ||
</nav-menu> | ||
</template> | ||
|
||
<script> | ||
import { mapState, mapActions } from 'vuex'; | ||
import { getPeriods } from '@/config/periods'; | ||
import NavMenu from '@/components/Navigation/navbar/NavMenu.vue'; | ||
import NavMenuItem from '@/components/Navigation/navbar/NavMenuItem.vue'; | ||
import NavMenuText from '@/components/Navigation/navbar/NavMenuText.vue'; | ||
import PeriodSelector from '@/components/period/PeriodSelector.vue'; | ||
export default { | ||
name: 'PeriodSelectorMenu', | ||
components: { | ||
NavMenu, | ||
NavMenuItem, | ||
NavMenuText, | ||
PeriodSelector, | ||
}, | ||
computed: { | ||
...mapState(['selectedPeriod']), | ||
period: { | ||
get() { | ||
return this.selectedPeriod; | ||
}, | ||
set(value) { | ||
this.setSelectedPeriod(value); | ||
}, | ||
}, | ||
periodLabel() { | ||
if (this.selectedPeriod) { | ||
return this.selectedPeriod.label; | ||
} | ||
return this.$t('period.choosePeriod'); | ||
}, | ||
_predefinedPeriods() { | ||
return Object.values(getPeriods()); | ||
}, | ||
}, | ||
methods: { | ||
...mapActions(['setSelectedPeriod']), | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
@use '@oslokommune/punkt-css/dist/scss/abstracts/mixins/breakpoints' as *; | ||
.period-selector-menu { | ||
&__dropdown { | ||
width: 100vw; | ||
@include bp('tablet-up') { | ||
width: unset; | ||
min-width: 10rem; | ||
} | ||
} | ||
&__label { | ||
::v-deep .nav-menu-text__inner { | ||
padding-right: 0; | ||
} | ||
} | ||
} | ||
</style> |
Oops, something went wrong.