Skip to content

Commit

Permalink
Code style update, using tablet-mobile() to make CSS cleaner (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang authored Mar 22, 2019
1 parent 35180c2 commit 9995fcd
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 131 deletions.
1 change: 0 additions & 1 deletion source/css/_common/components/components.styl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
@import "buttons";
@import "pagination";
@import "comments";
@import "tag-cloud";
@import (hexo-config('back2top.sidebar') ? "back-to-top-sidebar" : "back-to-top") if (hexo-config('back2top.enable'));

@import "header";
Expand Down
6 changes: 3 additions & 3 deletions source/css/_common/components/header/github-banner.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
animation: octocat-wave 560ms ease-in-out;
}
@keyframes octocat-wave {
0%,100% {
0%, 100% {
transform: rotate(0);
}
20%,60% {
20%, 60% {
transform: rotate(-25deg);
}
40%,80% {
40%, 80% {
transform: rotate(10deg);
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/css/_common/components/header/menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
margin: 0 10px;
list-style: none;

@media screen and (max-width: 767px) {
+mobile() {
margin-top: 10px;
}

Expand Down
1 change: 1 addition & 0 deletions source/css/_common/components/pages/pages.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
@import "schedule";
@import "post-detail";
@import "breadcrumb";
@import "tag-cloud";
24 changes: 12 additions & 12 deletions source/css/_common/components/pages/schedule.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
ul#event-list {
padding-left: 30px
hr {
margin: 20px 0 45px 0!important
margin: 20px 0 45px 0 !important
background: #222
&:after {
display: inline-block
content: 'NOW'
background: #222
color: #FFF
font-weight:bold
text-align: right
padding: 0 5px
}
&:after {
display: inline-block
content: 'NOW'
background: #222
color: #FFF
font-weight:bold
text-align: right
padding: 0 5px
}
}
li.event {
margin: 20px 0px
Expand Down Expand Up @@ -94,7 +94,7 @@
}
}
* {
color: #FFF!important
color: #FFF !important
}
}
li.event-future {
Expand All @@ -109,7 +109,7 @@
}
}
* {
color: #FFF!important
color: #FFF !important
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion source/css/_common/components/pagination.styl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}
}

@media (max-width: 767px)
+mobile() {
.pagination { border-top: none; }

.pagination {
Expand All @@ -54,3 +54,4 @@
&:hover { border-bottom-color: $pagination-link-hover-border; }
}
}
}
2 changes: 1 addition & 1 deletion source/css/_common/components/post/post-collapse.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: Refactor.

@media (max-width: 767px) {
+mobile() {
.posts-collapse {
margin: 0 20px;

Expand Down
7 changes: 2 additions & 5 deletions source/css/_common/components/post/post.styl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
cursor: zoom-in;
}

.post-body .image-caption {
.post-body .image-caption,
.post-body .figure .caption {
margin: -20px auto 15px;
text-align: center;
font-size: $font-size-base;
Expand All @@ -26,10 +27,6 @@
line-height: 1;
}

.post-body .figure .caption {
@extend .post-body .image-caption;
}

.post-sticky-flag {
display: inline-block;
font-size: 16px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.chat {
.feed-link, .chat {
margin-top: 10px;

a {
Expand Down
23 changes: 0 additions & 23 deletions source/css/_common/components/sidebar/sidebar-feed-link.styl

This file was deleted.

20 changes: 8 additions & 12 deletions source/css/_common/components/sidebar/sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
a, span.exturl {
color: $grey-dark;
border-bottom-color: $black-light;
&:hover { color: $gainsboro; }
}
span.exturl:hover {
border-bottom-color: $gainsboro;
&:hover {
color: $gainsboro;
border-bottom-color: $gainsboro;
}
}

+tablet() {
hide() if not hexo-config('sidebar.onmobile');
}
+mobile() {
+tablet-mobile() {
hide() if not hexo-config('sidebar.onmobile');
}
}
Expand Down Expand Up @@ -58,11 +55,10 @@

@import "sidebar-toggle";
@import "sidebar-author";
@import "site-state";
@import "sidebar-feed-link";
@import "sidebar-author-links";
@import "sidebar-button";
@import "sidebar-blogroll";
@import "sidebar-nav";
@import "sidebar-toc";
@import "site-state" if hexo-config('site_state');
@import "sidebar-toc" if hexo-config('toc.enable');
@import "sidebar-dimmer" if hexo-config('sidebar.dimmer');
@import "sidebar-chat" if hexo-config('chat.enable');
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

.btn {
//display: initial;
padding: 0 10px 0 14px
padding: 0 10px 0 14px;
border: 1px solid $btn-default-border-color;
border-radius: 4px;
}
Expand Down
3 changes: 1 addition & 2 deletions source/css/_common/scaffolding/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ body {
color: $text-color;
background: $body-bg-color;

+mobile() { padding-right: 0 !important; }
+tablet() { padding-right: 0 !important; }
+tablet-mobile() { padding-right: 0 !important; }
+desktop-large() { font-size: $font-size-large; }
}

Expand Down
4 changes: 3 additions & 1 deletion source/css/_common/scaffolding/helpers.styl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
}
}

.affix.affix.affix { position: fixed; }
.affix {
position: fixed;
}

.translation {
margin-top: -20px;
Expand Down
6 changes: 4 additions & 2 deletions source/css/_common/scaffolding/tables.styl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ table {
font-size: $table-font-size;
}

table>tbody>tr {
table > tbody > tr {
&:nth-of-type(odd) { background-color: $table-row-odd-bg-color; }
&:hover { background-color: $table-row-hover-bg-color; }
}
Expand All @@ -33,4 +33,6 @@ th {
font-weight: $table-th-font-weight;
}

td { border-bottom-width: 1px; }
td {
border-bottom-width: 1px;
}
12 changes: 3 additions & 9 deletions source/css/_schemes/Pisces/_brand.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
color: white;
background: $black-deep;

+tablet() {
box-shadow: 0 0 16px rgba(0,0,0,0.5);
}
+mobile() {
box-shadow: 0 0 16px rgba(0,0,0,0.5);
+tablet-mobile() {
box-shadow: 0 0 16px rgba(0, 0, 0, 0.5);
}
}

Expand All @@ -31,10 +28,7 @@

.custom-logo-image {
margin-top: 20px;
+tablet() {
display: none;
}
+mobile() {
+tablet-mobile() {
display: none;
}
}
Expand Down
29 changes: 5 additions & 24 deletions source/css/_schemes/Pisces/_layout.styl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
+desktop-largest() {
width: $content-desktop-largest;
}
+tablet() {
width: auto;
}
+mobile() {
+tablet-mobile() {
width: auto;
}
}
Expand All @@ -30,12 +27,7 @@
+desktop-large() {
.container & { width: $sidebar-desktop; }
}
+tablet() {
position: relative;
width: auto;
border-radius: initial;
}
+mobile() {
+tablet-mobile() {
position: relative;
width: auto;
border-radius: initial;
Expand All @@ -48,10 +40,7 @@

.container .main-inner {

+tablet() {
width: auto;
}
+mobile() {
+tablet-mobile() {
width: auto;
}
}
Expand Down Expand Up @@ -87,10 +76,7 @@
background: $body-bg-color;
box-shadow: none;

+tablet() {
display: none;
}
+mobile() {
+tablet-mobile() {
display: none;
}
}
Expand All @@ -100,12 +86,7 @@
.footer-inner {
padding-left: 260px;

+tablet() {
width: auto;
padding-left: 0 !important;
padding-right: 0 !important;
}
+mobile() {
+tablet-mobile() {
width: auto;
padding-left: 0 !important;
padding-right: 0 !important;
Expand Down
Loading

0 comments on commit 9995fcd

Please sign in to comment.