Skip to content

Commit

Permalink
Update styles for mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
zry656565 committed Jun 24, 2017
1 parent 40318ec commit a3aa3d5
Show file tree
Hide file tree
Showing 9 changed files with 117 additions and 103 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@ pages/1_articles.md
.tmp
assets/css/main.css
assets/css/posts.css
assets/css/pages.css

#PhpStorm configure files
.idea
Expand Down
1 change: 1 addition & 0 deletions Gruntfile.js
Expand Up @@ -15,6 +15,7 @@ module.exports = function(grunt) {
},
"<%= pkg.srcRoot %>/css/main.css": "<%= pkg.srcRoot %>/css/main.less",
"<%= pkg.srcRoot %>/css/posts.css": "<%= pkg.srcRoot %>/css/posts.less",
"<%= pkg.srcRoot %>/css/pages.css": "<%= pkg.srcRoot %>/css/pages.less",
},
useminPrepare: {
html: '_includes/head.html',
Expand Down
3 changes: 3 additions & 0 deletions _includes/header.html
Expand Up @@ -2,6 +2,9 @@
<div class="wrap">
<a class="site-title" href="{{ site.baseurl }}/">{{ site.title }}</a>
<nav class="site-nav">
<div class="menu-icon">
<img class="icon" src="{{ site.static_url }}/menu.svg" title="More"/>
</div>
<div class="trigger">
<a class="page-link" href="/">首页</a>
{% for page in site.pages %}
Expand Down
18 changes: 13 additions & 5 deletions assets/css/main.less
Expand Up @@ -2,6 +2,7 @@
*===========================================================*/

@import "config";
@import "utils";

@media-diverge-small: 600px;
@media-diverge-medium: 840px;
Expand Down Expand Up @@ -90,7 +91,7 @@ hr{
}

@media screen and (max-width: @media-diverge-small) {
position: fixed;
position: absolute;
z-index: 10;
top: 14px;
right: 8px;
Expand All @@ -104,12 +105,15 @@ hr{
display: block;
float: right;
width: 36px;
font-size: 24px;
color: #505050;
height: 36px;
text-align: center;
line-height: 36px;

svg { width: 18px; height: 16px; }
img {
padding: 9px;
width: 18px;
height: 18px;
}
}

.trigger {
Expand All @@ -123,11 +127,15 @@ hr{
.page-link {
display: block;
margin: 0;
padding: 5px 10px;
padding: 10px 20px;
text-align: right;
line-height: 1.25;
}

.page-link:last-child {
display: none;
}

}
}

Expand Down
82 changes: 0 additions & 82 deletions assets/css/pages.css

This file was deleted.

85 changes: 85 additions & 0 deletions assets/css/pages.less
@@ -0,0 +1,85 @@
/* articles
======================================*/

.label-section {
margin-bottom: 20px;

.post-label {
display: inline-block;
font-size: 14px;
color: #555;
background: #FFEFD5;
border: 1px solid #aaa;
border-radius: 2px;
padding: 1px 6px;
margin: 0 7px 7px 0;
cursor: pointer;

&.select {
color: #fff;
background: #f59b4d;
}
}
}

.label-section h2,
.articles-section h2 {
font-weight: 400;
font-size: 1.1em;
margin: 0;
}

.articles {
list-style-type: none;
margin: 0;
padding: 0;
font-size: 1em;

.article-date {
display: block;
float: left;
color: #818181;
padding: 4px 10px 0 20px;
font-size: 0.8em;
line-height: 1.5;
}

.article-title {
display: block;
overflow: hidden;
line-height: 1.8;
}
}

.articles-section {
h2 {
display: inline-block;
}

.search-icon {
display: inline-block;
margin-left: 4px;
cursor: pointer;

img {
width: 14px;
height: 14px;
}
}

.search-box {
display: inline-block;
font-size: 14px;
width: 170px;
margin-left: 20px;
}

h3 {
display: inline-block;
font-size: 1.1em;
margin: 0.5em 0;
border-bottom: 1px solid #ccc;
padding: 0 50px 0 5px;
font-weight: 500;
}
}
10 changes: 10 additions & 0 deletions assets/css/utils.less
@@ -0,0 +1,10 @@
.clearfix {
&:before,&:after {
content: " ";
display: table;
}

&:after {
clear: both;
}
}
14 changes: 0 additions & 14 deletions assets/js/index_main.js

This file was deleted.

6 changes: 4 additions & 2 deletions pages/articles.js
Expand Up @@ -88,9 +88,11 @@
render: function() {
var post = this.props.post;
return (
<li className="article">
<li className="article clearfix">
<span className="article-date">{post.date.substr(5)}</span>
<a className="article-title" href={post.link}>{post.title}</a>
<div className="article-title">
<a href={post.link}>{post.title}</a>
</div>
</li>
);
}
Expand Down

0 comments on commit a3aa3d5

Please sign in to comment.