Skip to content

Commit

Permalink
feat(client): 改进移动适配右侧菜单栏,提取 layout 样式
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet committed Jun 28, 2019
1 parent ccb1e71 commit 4f0382d
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 88 deletions.
72 changes: 0 additions & 72 deletions packages/client/public/styles/common/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -95,75 +95,3 @@ hr {
background-color: @gray;
background-image: repeating-linear-gradient(-45deg, @white, @white 4px, transparent 4px, transparent 8px);
}

.container {
min-height: 100vh;
transition: transform .3s;

&.slide-left {
transform: translateX(-180px);
box-shadow: 2px 0 6px rgba(0, 0, 0, .2);
overflow: hidden;
}
}

.mobile-menu {
display: none;
position: fixed;
right: 0;
top: 0;
width: 180px;
min-height: 100vh;
overflow: hidden;
background-color: rgba(lighten(@theme-color, 80%), .1);
transform: translate3d(180px, 0, 0);
transition: transform .3s;

&.open {
transform: translate3d(0, 0, 0);
}

@media @screen {
display: block;
}
}

.layout {
margin: 0 auto;
width: @global-body-width;

@media @screen {
width: 100%;
}
}

.main {
display: flex;
padding: 20px 10px;
min-height: 600px;
box-sizing: border-box;
.layout();

@media @screen {
padding: 10px 0;
}

& > .content {
flex: 3;
border-radius: 4px;
background: @white;

@media @screen {
flex: 1;
}
}

& > .asider {
flex: 1;
margin-left: 20px;

@media @screen {
display: none;
}
}
}
1 change: 1 addition & 0 deletions packages/client/public/styles/includes/footer.less
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
}

.copy {
font-size: @font-size-small;
background: rgba(@theme-color, .1);

p {
Expand Down
11 changes: 5 additions & 6 deletions packages/client/public/styles/includes/header.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.header {
height: 55px;
height: 50px;
box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
background-color: @white;

Expand All @@ -13,8 +13,8 @@
}

.logo {
flex: 0 0 55px;
.size(55px);
flex: 0 0 50px;
.size(50px);
}

.search {
Expand Down Expand Up @@ -77,9 +77,8 @@

.avatar {
display: inline-block;
.size(40px);

vertical-align: middle;
.size(40px);

img {
border-radius: 50%;
Expand All @@ -95,7 +94,7 @@
.drop-menus {
display: none;
position: absolute;
top: 55px;
top: 50px;
left: 50%;
width: 120px;
color: @white;
Expand Down
1 change: 1 addition & 0 deletions packages/client/public/styles/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@import './includes/header.less';
@import './includes/footer.less';
@import './includes/aider.less';
@import './pages/layout.less';
@import './pages/topic.less';
// @import './pages/user.less'
// @import './pages/reply.less';
Expand Down
94 changes: 94 additions & 0 deletions packages/client/public/styles/pages/layout.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.container {
min-height: 100vh;
transition: transform .3s;

&.slide-left {
transform: translateX(-180px);
box-shadow: 2px 0 6px rgba(0, 0, 0, .2);
overflow: hidden;
}
}

.mobile-menu {
display: none;
position: fixed;
right: 0;
top: 0;
width: 180px;
min-height: 100vh;
overflow: hidden;
background-color: rgba(lighten(@theme-color, 80%), .1);
transform: translate3d(180px, 0, 0);
transition: transform .3s;

&.open {
transform: translate3d(0, 0, 0);
}

@media @screen {
display: block;
}

.account {
display: block;
padding-top: 20px;
text-align: center;

& > .divider {
margin: 0 10px;
}

.avatar {
.size(40px);

img {
border-radius: 50%;
}
}
}

ul.menu {
text-align: center;
}
}

.layout {
margin: 0 auto;
width: @global-body-width;

@media @screen {
width: 100%;
}
}

.main {
display: flex;
padding: 20px 10px;
min-height: 600px;
box-sizing: border-box;
.layout();

@media @screen {
padding: 0;
border-top: 1px solid @gray-light;
}

& > .content {
flex: 3;
border-radius: 4px;
background: @white;

@media @screen {
flex: 1;
}
}

& > .asider {
flex: 1;
margin-left: 20px;

@media @screen {
display: none;
}
}
}
20 changes: 10 additions & 10 deletions packages/client/views/includes/footer.pug
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
.title
span.mints.mints-home
span Mints.
p.copyright 蜀ICP备17043710号-1
p.copyright 蜀ICP备18037778号-1
.contact
span 联系我们:
a.mints.mints-github(href="")
a.mints.mints-github(href="https://github.com/mintsweet/practice", target="_blank")
ul.about
li
.title About
.links
a(href="") 关于本站
a(href="") 反馈与建议
a(href="") 加入我们
a(href="https://docs.mintsweet.cn/", target="_blank") 关于本站
a(href="https://github.com/mintsweet/practice/issues", target="_blank") 反馈与建议
a(href="https://github.com/mintsweet/practice/pulls", target="_blank") 加入我们
li
.title 开发者
.links
a(href="") 开发者指南
a(href="") API
a(href="https://docs.mintsweet.cn/#/codespecification", target="_blank") 开发者指南
a(href="https://docs.mintsweet.cn/#/API", target="_blank") API
li
.title 客户端
.links
a(href="") APP
a(href="https://github.com/mintsweet/practice/blob/master/packages/mobile/README.md") APP
.mobile-link
a(href="") 关于本站
a(href="https://docs.mintsweet.cn/", target="_blank") 关于本站
span.divider ·
a(href="https://github.com/mintsweet/practice", target="_blank") 源码
span.divider ·
a(href="") 反馈与建议
a(href="https://github.com/mintsweet/practice/issues", target="_blank") 反馈与建议
.copy
.layout
p © 2019 All Rights Reserved
Expand Down
17 changes: 17 additions & 0 deletions packages/client/views/layout.pug
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,20 @@ html
block footer
include ./includes/footer.pug
.mobile-menu
if user
a.account(href=`/user/${user.id}`)
.avatar
img(src=user.avatar)
.nickname #{user.nickname}
else if config.ALLOW_SIGNUP
.account
a(href="/signin") 登录
span.divider |
a(href="/signup") 注册
else
.account
a(href="/auth/github") 使用 GitHub 登录
ul.menu
each item in config.menus
li
a(href=item.url, target=`${item.url.indexOf('http') === 0 ? '_blank' : '_self'}`) #{item.name}

0 comments on commit 4f0382d

Please sign in to comment.