marc-leopold/store/navigation.js

52 lines
1.4 KiB
JavaScript

const SITE_NAV = [
{ 'to': '/', 'text': 'Home', bgImgUrl: '/img/devices--bw.jpg'},
{ 'to': '/galleries', 'text': 'Galleries', bgImgUrl: '/img/photo-box--bw.jpg' },
{ 'to': '/services', 'text': 'Services', bgImgUrl: '/img/camera--bw.jpg' },
{ 'to': '/about', 'text': 'About Me', bgImgUrl: '/img/silhouette--dark.jpg' },
{ 'to': '/contact', 'text': 'Contact Me', bgImgUrl: '/img/mail--bw.jpg' },
]
const SOCIAL_NAV = [
{ 'to': 'https://www.instagram.com', 'text': 'Instagram', icon: 'instagram' },
{ 'to': 'https://www.facebook.com', 'text': 'Facebook', icon: 'facebook' },
{ 'to': 'https://twitter.com', 'text': 'Twitter', icon: 'twitter' },
{ 'to': 'https://uk.linkedin.com', 'text': 'LinkedIn', icon: 'linkedin' },
]
export const state = () => ({
siteNav: [],
socialNav: [],
})
export const actions = {
load ({ commit }) {
return new Promise(resolve => {
setTimeout(() => {
commit('updateSiteNav', SITE_NAV)
commit('updateSocialNav', SOCIAL_NAV)
resolve()
}, 300)
})
}
}
export const getters = {
siteNav: state => {
return state.siteNav
},
socialNav: state => {
return state.socialNav
},
}
export const mutations = {
updateSiteNav (state, navItems) {
state.siteNav = navItems
},
updateSocialNav (state, socialItems) {
state.socialNav = socialItems
},
}