Merge pull request #6 from nikandlv/development

Responsive update
pull/8/head
Nikan Dalvand 2019-07-21 17:29:37 +04:30 committed by GitHub
commit 42bd86c4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 185 additions and 111 deletions

View File

@ -1,3 +1,4 @@
test/unit/coverage/** test/unit/coverage/**
test/unit/*.js test/unit/*.js
test/e2e/*.js test/e2e/*.js
src/main/*.js

View File

@ -1,7 +1,7 @@
'use strict' 'use strict'
import { app, BrowserWindow } from 'electron' import { app, BrowserWindow } from 'electron'
import store from '../renderer/store/index'
/** /**
* Set `__static` path to static files in production * Set `__static` path to static files in production
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html

View File

@ -43,4 +43,8 @@ $lato-font-path: '/node_modules/lato-font/fonts'
.page .page
flex-grow: 1 flex-grow: 1
overflow: auto overflow: auto
transition: padding-top 300ms
@media(max-width: 800px)
.page
padding-top: 64px
</style> </style>

View File

@ -1,5 +1,5 @@
<template> <template>
<span> <span :class="{'nopadding' : nopadding === true}">
<img src="/static/logo-2.svg" alt="Jukebox"> <img src="/static/logo-2.svg" alt="Jukebox">
Jukebox. Jukebox.
</span> </span>
@ -7,7 +7,8 @@
<script> <script>
export default { export default {
name: 'Logo' name: 'Logo',
props: ['nopadding']
} }
</script> </script>
@ -16,6 +17,9 @@ span
margin-bottom: 12px margin-bottom: 12px
font-size: 1.5rem font-size: 1.5rem
color: lighten(black,40) color: lighten(black,40)
&.nopadding
margin-bottom: 0px
img img
width: 24px width: 24px
height: auto height: auto

View File

@ -1,6 +1,23 @@
<template> <template>
<section> <div>
<Logo /> <section class="handle">
<div @click="toggleMenuStatus" class="icon">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 384.97 384.97" style="enable-background:new 0 0 384.97 384.97;" xml:space="preserve">
<g>
<g id="Menu_1_">
<path d="M12.03,120.303h360.909c6.641,0,12.03-5.39,12.03-12.03c0-6.641-5.39-12.03-12.03-12.03H12.03
c-6.641,0-12.03,5.39-12.03,12.03C0,114.913,5.39,120.303,12.03,120.303z"/>
<path d="M372.939,180.455H12.03c-6.641,0-12.03,5.39-12.03,12.03s5.39,12.03,12.03,12.03h360.909c6.641,0,12.03-5.39,12.03-12.03
S379.58,180.455,372.939,180.455z"/>
<path d="M372.939,264.667H132.333c-6.641,0-12.03,5.39-12.03,12.03c0,6.641,5.39,12.03,12.03,12.03h240.606
c6.641,0,12.03-5.39,12.03-12.03C384.97,270.056,379.58,264.667,372.939,264.667z"/>
</g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g>
</svg>
</div>
<Logo :nopadding="true"/>
</section>
<section class="sidebar" :class="{'open': menuStatus === true}">
<Logo class="logo" />
<MenuGroup> <MenuGroup>
<template v-slot:title>Menu</template> <template v-slot:title>Menu</template>
<MenuItem to="/artists"> <MenuItem to="/artists">
@ -80,6 +97,7 @@
</MenuItem> </MenuItem>
</MenuGroup> </MenuGroup>
</section> </section>
</div>
</template> </template>
<script> <script>
@ -87,18 +105,50 @@ import MenuGroup from '../components/MenuGroup'
import MenuItem from '../components/MenuItem' import MenuItem from '../components/MenuItem'
import projectPackage from '~/package.json' import projectPackage from '~/package.json'
import Logo from '../components/Logo' import Logo from '../components/Logo'
import { mapActions, mapGetters } from 'vuex'
export default { export default {
name: 'DockableSidebar', name: 'DockableSidebar',
components: { MenuGroup, MenuItem, Logo }, components: { MenuGroup, MenuItem, Logo },
data: () => { data: () => {
return { version: projectPackage.version } return { version: projectPackage.version }
} },
methods: {
...mapActions(['toggleMenuStatus'])
},
computed: mapGetters(['menuStatus'])
} }
</script> </script>
<style scoped lang="sass"> <style scoped lang="sass">
section section.handle
position: absolute
left: 0
top: 0
width: 100% width: 100%
height: 64px
box-sizing: border-box
transition: transform 300ms
background-color: #fcfcfc
transform: translateY(-100%)
display: flex
align-items: center
padding: 0 1rem
.icon
margin: 0 10px
width: 24px
height: 24px
padding: 0.8rem
cursor: pointer
transition: background-color 200ms
border-radius: 100%
&:hover
background-color: rgba(black,0.05)
svg
width: 24px
height: 24px
section.sidebar
width: 250px
max-width: 250px max-width: 250px
min-height: 100vh min-height: 100vh
padding: 2rem 2rem 0rem 2rem padding: 2rem 2rem 0rem 2rem
@ -107,6 +157,7 @@ section
display: flex display: flex
flex-direction: column flex-direction: column
overflow: auto overflow: auto
transition: width 300ms,transform 300ms,padding 500ms
.icon .icon
width: 18px width: 18px
height: auto height: auto
@ -114,4 +165,17 @@ section
fill: lighten(gray,20) fill: lighten(gray,20)
.grow .grow
flex-grow: 1 flex-grow: 1
@media(max-width: 1000px)
section.sidebar
width: 200px
overflow: auto
padding: 1rem 1rem 0rem 1rem
@media(max-width: 800px)
section.sidebar
transform: translateX(-100%)
width: 0
overflow: hidden
padding: 2rem 0rem 0rem 0rem
section.handle
transform: translateY(0%)
</style> </style>

View File

@ -1,25 +0,0 @@
const state = {
main: 0
}
const mutations = {
DECREMENT_MAIN_COUNTER (state) {
state.main--
},
INCREMENT_MAIN_COUNTER (state) {
state.main++
}
}
const actions = {
someAsyncTask ({ commit }) {
// do something async
commit('INCREMENT_MAIN_COUNTER')
}
}
export default {
state,
mutations,
actions
}

View File

@ -0,0 +1,26 @@
const state = {
menu_open: false
}
const getters = {
menuStatus: (state) => state.menu_open
}
const mutations = {
TOGGLE_MENU (state) {
state.menu_open = !state.menu_open
}
}
const actions = {
toggleMenuStatus ({ commit }) {
commit('TOGGLE_MENU')
}
}
export default {
actions,
state,
mutations,
getters
}