UI布局优化

This commit is contained in:
xugaoyi 2020-04-23 17:15:18 +08:00
parent 6ce09133c2
commit 54af6da86b
20 changed files with 119 additions and 70 deletions

View File

@ -5,7 +5,11 @@ h1
width 1.6rem
//
// //
#vuepress-plugin-comment
@media (min-width: 1200px)
box-shadow: 0 3px 3px 0 rgba(0,0,30,0.1), 0px 4px 4px 0 rgba(0,0,0,0.1)
margin-top: -5px
.gt-container
.gt-meta
border-color var(--borderColor)!important

View File

@ -13,18 +13,23 @@
// //
// $navbarHeight = 3.6rem
// $sidebarWidth = 18rem
// $contentWidth = 830px
// $contentWidth = 860px
// $homePageWidth = 1080px
// $rightMenuWidth = 280px //
// $rightMenuWidth = 230px //
// //
// $lineNumbersWrapperWidth = 2.5rem
// //
// $cardLayout = 1200px //
// //
// .theme-mode-light
// --bg: #fff
// --textColor: #004050
// --textLightenColor: #0085AD
// --sidebarBg: rgba(255,255,255,.85)
// --borderColor: rgba(0,0,0,.15)
// --codeBgColor: #f6f6f6
// --codeColor: #525252
@ -35,6 +40,7 @@
// --bg: rgb(30,30,34)
// --textColor: rgb(150,150,154)
// --textLightenColor: #0085AD
// --sidebarBg: rgba(30,30,34,.3)
// --borderColor: #2C2C3A
// --codeBgColor: #252526
// --codeColor: #fff
@ -45,6 +51,7 @@
// --bg: #f5f5d5
// --textColor: #004050
// --textLightenColor: #0085AD
// --sidebarBg: #f5f5d5
// --borderColor: rgba(0,0,0,.15)
// --codeBgColor: #282c34
// --codeColor: #fff

View File

@ -99,10 +99,11 @@ article: false
## 设计
- [创造师导航](http://chuangzaoshi.com/)
- [设计师网址导航](http://hao.uisdc.com/)
- [uimovement](https://uimovement.com/) 能从这个网站找到不少动画交互的灵感
- [awwwards](https://www.awwwards.com/)是一个一个专门为设计精美的网站以及富有创意的网站颁奖的网站
- [dribbble](https://dribbble.com/) 经常能在上面找到很多有创意好看的 gif 或者图片,基本上我所有的图都是上面招的
- [dribbble](https://dribbble.com/) 经常能在上面找到很多有创意好看的 gif 或者图片
- [Bēhance](https://www.behance.net/) dribbble 是设计师的微博Bēhance 是设计师的博客
- [Logojoy](https://logojoy.com/) 使用 ai 做 logo 的网站,做出来的 logo 质量还不错。
- [brandmark](http://brandmark.io/) 另一个在线制作 logo 网站

View File

@ -91,7 +91,7 @@ function zero(d){
@extend $wrapper
position: relative
z-index: 1
margin: 2.6rem 0 -3.1rem 0
margin-top .5rem
color #888
.articleInfo
overflow hidden

View File

@ -200,7 +200,7 @@ export default {
text-align center
cursor pointer
// color var(--textLightenColor)
background rgba(255,255,255,.1)
background var(--bg)
&:hover
&:before
color $accentColor

View File

@ -91,8 +91,8 @@ export default {
dl,dd
margin 0
.column-wrapper
margin-top .6rem
display flex
margin-top 4.6rem!important
padding-bottom 2rem
border-bottom 1px solid var(--borderColor)
img

View File

@ -42,23 +42,30 @@ $mobileSidebarWidth = $sidebarWidth * 0.82
.iconfont
padding 0 10px
font-size 19px
.footer
padding 2.5rem 2.5rem 3rem
padding 1.5rem 1.5rem 2rem
text-align center
color var(--textColor)
opacity .6
color #666
box-sizing border-box
font-size .85rem
transition all .2s ease
@media (min-width: $cardLayout)
background var(--pageBg)
a
color var(--textColor)
color #666
@media (min-width: ($MQMobile + 1px))
.sidebar-open .footer
width auto
margin-left $sidebarWidth
padding-left ($sidebarWidth + 1.5rem)
@media (min-width 1520px)
.have-rightmenu .footer
padding-right ($rightMenuWidth + 1.5rem)
.no-sidebar .footer
width auto
margin-left 0
padding-left 0
</style>

View File

@ -252,9 +252,10 @@ export default {
background #517EA9
.i-body
background bottom no-repeat
// background-color var(--homeBg)
background-color rgba(220,220,220,0.1)
background-color var(--pageBg)
overflow hidden
.footer
background none
.banner
width 100%
min-height 450px

View File

@ -227,7 +227,7 @@ export default {
<style lang="stylus">
.i-body
background bottom no-repeat
background-color rgba(220,220,220,0.1)
background-color var(--pageBg)
overflow hidden
.banner
width 100%
@ -402,6 +402,8 @@ export default {
margin-bottom 6px
.slogan
color var(--textColor)
.footer
background none
@keyframes heart

View File

@ -92,6 +92,7 @@ $navbar-horizontal-padding = 1.5rem
.navbar
padding $navbar-vertical-padding $navbar-horizontal-padding
line-height $navbarHeight - 1.4rem
transition transform 0.3s
a, span, img
display inline-block
.logo
@ -118,6 +119,10 @@ $navbar-horizontal-padding = 1.5rem
flex: 0 0 auto
vertical-align top
.hide-navbar
.navbar
transform translateY(-100%)
@media (max-width: $MQMobile)
.navbar
padding-left 4rem

View File

@ -12,6 +12,7 @@
<RightMenu v-if="showRightMenu"/>
<Content class="theme-vdoing-content" />
</div>
<PageEdit />
<PageNav v-bind="{ sidebarItems }" />
@ -74,8 +75,12 @@ export default {
@require '../styles/variable.styl'
.page
padding-bottom 2rem
padding-bottom 3rem
display block
padding-top ($navbarHeight)
@media (min-width $cardLayout)
padding-top ($navbarHeight + 2rem)
background var(--pageBg)
>*
@extend $vdoing-wrapper
@ -86,23 +91,11 @@ export default {
/**
* 右侧菜单的自适应
*/
@media (min-width: 1680px) //
.have-rightmenu //
.page
.theme-vdoing-wrapper
max-width ($contentWidth + $rightMenuWidth)
>*:not(.theme-vdoing-wrapper)
transform translateX(-($rightMenuWidth / 2))
@media (min-width: 1520px) and (max-width: 1679px)
@media (min-width: 720px) and (max-width: 1519px)
.have-rightmenu
.page
transition: all 0s!important
.theme-vdoing-wrapper
max-width ($contentWidth + $rightMenuWidth)
&.sidebar-open
.page >*
margin 0 0 0 2rem
.page
padding-right 0!important
@media (max-width: 1519px)
.right-menu-wrapper
display none
@ -110,21 +103,4 @@ export default {
.sidebar .sidebar-sub-headers
display none
// @media (min-width: 1360px) and (max-width: 1519px)
// .have-rightmenu
// .page
// .theme-vdoing-wrapper
// max-width ($contentWidth + $rightMenuWidth - 200px)
// .theme-vdoing-content,.page-edit,.page-nav,#vuepress-plugin-comment,.article:not(.article-home)
// max-width ($contentWidth - 200px)
// .right-menu-wrapper
// // margin-left ($contentWidth - 180px)
// @media (max-width: 1359px) // 1359
// .right-menu-wrapper
// display none
// @media (min-width: 1360px) // 1360
// .sidebar .sidebar-sub-headers
// display none
</style>

View File

@ -186,6 +186,7 @@ function flatten (items, res) {
margin-top -35px
outline 0
transition all .2s
border-radius 2px
@media (max-width: 1340px)
width 50px
@media (max-width: 960px)

View File

@ -49,12 +49,12 @@ export default {
.right-menu-wrapper
width $rightMenuWidth
float right
margin-right -20px
margin-right -($rightMenuWidth + 60px)
position sticky
top 0
font-size .9rem
.right-menu-padding
padding-top ($navbarHeight + 3rem)
padding-top ($navbarHeight + 1rem)
.right-menu-content
max-height 80vh
position relative

View File

@ -41,6 +41,7 @@
transition left .2s ease
&:hover
box-shadow 0 2px 6px rgba(0,0,0,.15)
background var(--bg)
.icon
display inline
width 1rem

View File

@ -71,7 +71,7 @@ export default {
@require '../styles/wrapper.styl'
.article
@extend $wrapper
padding 2rem 2.5rem 0 2.5rem
padding 1.8rem 2rem 0 2rem
&:not(.article-home)
margin-top 2rem
border 8px solid rgba(160,160,160,.1)
@ -109,7 +109,7 @@ export default {
display flex
padding 8px 0
margin 0
height 55px
height 45px
width 100%
// width 50%
// @media (max-width: $MQNarrow)
@ -122,7 +122,7 @@ export default {
width 50px
margin-left 22px
font-weight bold
line-height: 55px;
line-height: 45px;
@media (max-width: $MQNarrow)
width 45px
dt
@ -132,7 +132,7 @@ export default {
color var(--textColor)
flex 1
display: flex;
height: 55px;
height: 45px;
align-items: center;
div
overflow: hidden;
@ -151,7 +151,7 @@ export default {
color #999
text-align right
font-size .9rem
line-height: 55px;
line-height: 45px;
@media (max-width: $MQNarrow)
width 95px
</style>

View File

@ -61,6 +61,7 @@ import Sidebar from '@theme/components/Sidebar.vue'
import Buttons from '@theme/components/Buttons.vue'
import { resolveSidebarItems } from '../util'
import storage from 'good-storage' //
import _ from 'lodash'
const MOBILE_DESKTOP_BREAKPOINT = 719 // refer to config.styl
@ -69,6 +70,7 @@ export default {
data () {
return {
hideNavbar: false,
isSidebarOpen: true,
showSidebar: false,
themeMode: 'light'
@ -124,6 +126,7 @@ export default {
return [
{
'no-navbar': !this.shouldShowNavbar,
'hide-navbar': this.hideNavbar, //
'sidebar-open': this.isSidebarOpen,
'no-sidebar': !this.shouldShowSidebar,
'have-rightmenu': this.showRightMenu,
@ -153,9 +156,35 @@ export default {
this.$router.afterEach(() => {
this.isSidebarOpenOfclientWidth()
})
},
//
let p = 0, t = 0;
window.addEventListener('scroll', _.throttle(() => {
if(!this.isSidebarOpen) { //
p = this.getScrollTop()
if(t < p) { //
this.hideNavbar = true
} else { //
this.hideNavbar = false
}
setTimeout(() => {t = p},0)
}
}, 300))
},
watch: {
isSidebarOpen() {
if(this.isSidebarOpen) { //
this.hideNavbar = false
}
}
},
methods: {
getScrollTop () {
return window.pageYOffset
|| document.documentElement.scrollTop
|| document.body.scrollTop || 0
},
isSidebarOpenOfclientWidth() {
if (document.documentElement.clientWidth < MOBILE_DESKTOP_BREAKPOINT) {
this.isSidebarOpen = false

View File

@ -1,5 +1,5 @@
//
@import '//at.alicdn.com/t/font_1678482_suhesk0rdo7.css'
@import '//at.alicdn.com/t/font_1678482_ry1g3lguu0k.css'
@require './config'
@require './code'
@ -11,7 +11,6 @@
html, body
padding 0
margin 0
background-color #fff
body
font-family -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif
@ -88,7 +87,6 @@ a,input,button
.page
transition padding .2s ease
// padding-left $sidebarWidth
padding-left 0
.navbar
@ -100,7 +98,6 @@ a,input,button
height $navbarHeight
background-color var(--bg)
box-sizing border-box
border-bottom 1px solid var(--borderColor)
box-shadow 0 2px 5px rgba(0,0,0,.06)
.sidebar-mask
@ -114,7 +111,7 @@ a,input,button
.sidebar
font-size 16px
background-color rgba(220,220,220,.1)
background-color var(--sidebarBg)
width $sidebarWidth
position fixed
z-index 13
@ -126,7 +123,7 @@ a,input,button
border-right 1px solid var(--borderColor)
overflow-y auto
transform translateX(-100%)
transition transform .2s ease
transition transform .2s
@media (max-width: $MQMobile)
background-color var(--bg)
@ -135,7 +132,7 @@ a,input,button
word-wrap break-word
@extend $wrapper
> *:first-child
margin-top $navbarHeight
// margin-top $navbarHeight // top
a:hover
text-decoration underline
@ -198,7 +195,7 @@ h1, h2, h3, h4, h5, h6
margin-bottom 0
&:first-child
margin-top -1.5rem
// margin-top -1.5rem
margin-bottom 1rem
+ p, + pre, + .custom-block

View File

@ -50,6 +50,9 @@ $mobileSidebarWidth = $sidebarWidth * 0.95
left $sidebarWidth
.page
padding-left $sidebarWidth
&.have-rightmenu
.page
padding-right $rightMenuWidth
&.no-sidebar
.page
padding-left 0

View File

@ -33,18 +33,24 @@ $badgeErrorColor = #DA5961
//
$navbarHeight = 3.6rem
$sidebarWidth = 18rem
$contentWidth = 830px
$contentWidth = 860px
$homePageWidth = 1080px
$rightMenuWidth = 280px //
$rightMenuWidth = 230px //
//
$lineNumbersWrapperWidth = 2.5rem
//
$cardLayout = 1200px //
//
.theme-mode-light
--bg: #fff
--textColor: #004050
--textLightenColor: #0085AD
--sidebarBg: rgba(255,255,255,.85)
--pageBg: rgba(220,220,220,0.2)
--borderColor: rgba(0,0,0,.15)
--codeBgColor: #f6f6f6
--codeColor: #525252
@ -55,6 +61,8 @@ $lineNumbersWrapperWidth = 2.5rem
--bg: rgb(30,30,34)
--textColor: rgb(150,150,154)
--textLightenColor: #0085AD
--sidebarBg: rgba(120,120,120,.1)
--pageBg: rgba(120,120,120,.1)
--borderColor: #2C2C3A
--codeBgColor: #252526
--codeColor: #fff
@ -65,6 +73,8 @@ $lineNumbersWrapperWidth = 2.5rem
--bg: #f5f5d5
--textColor: #004050
--textLightenColor: #0085AD
--sidebarBg: #f5f5d5
--pageBg: rgba(220,220,220,0.1)
--borderColor: rgba(0,0,0,.15)
--codeBgColor: #282c34
--codeColor: #fff

View File

@ -1,7 +1,12 @@
$vdoing-wrapper
max-width $contentWidth
margin 0 auto
padding 2rem 2.5rem
padding 1rem 2.5rem 2rem 2.5rem
&:not(.footer)
@media (min-width: $cardLayout)
background var(--bg)
border-radius 5px
box-shadow 0 1px 3px 0 rgba(0,0,30,0.1), 1px 2px 4px 0 rgba(0,0,0,0.1)
@media (max-width: $MQNarrow)
padding 2rem
@media (max-width: $MQMobileNarrow)