Tweak style

This commit is contained in:
qingwei.li 2017-01-01 12:01:01 +08:00
commit 00253d3148
8 changed files with 37 additions and 16 deletions

View file

@ -1,3 +1,7 @@
## 1.4.3
### Bug fixes
- Tweak style.
## 1.4.2 ## 1.4.2
### Bug fixes ### Bug fixes

View file

@ -30,7 +30,7 @@ renderer.heading = function (text, level) {
toc.push({ level, slug: `${route}#${encodeURIComponent(slug)}`, title: text }) toc.push({ level, slug: `${route}#${encodeURIComponent(slug)}`, title: text })
return `<a href="${route}#${slug}" data-id="${slug}" class="anchor"><h${level} id="${slug}">${text}</h${level}></a>` return `<h${level} id="${slug}"><a href="${route}#${slug}" data-id="${slug}" class="anchor"><span>${text}</span></a></h${level}>`
} }
// highlight code // highlight code
renderer.code = function (code, lang = '') { renderer.code = function (code, lang = '') {

View file

@ -20,7 +20,7 @@ section.cover {
.cover-main { .cover-main {
flex: 1; flex: 1;
text-align: center; text-align: center;
margin: 0 16px; margin: -20px 16px 0;
z-index: 1; z-index: 1;
} }
@ -46,6 +46,10 @@ section.cover {
font-weight: 300; font-weight: 300;
color: inherit; color: inherit;
a {
display: block;
}
small { small {
position: absolute; position: absolute;
bottom: -.4375rem; bottom: -.4375rem;

View file

@ -31,6 +31,7 @@ body {
letter-spacing: 0; letter-spacing: 0;
margin: 0; margin: 0;
overflow-x: hidden; overflow-x: hidden;
color: $color-text;
} }
img { img {
@ -159,14 +160,18 @@ nav {
/* main */ /* main */
main { main {
size: 100% 100%; size: 100vw 100%;
position: relative; position: relative;
} }
.anchor { .anchor {
text-decoration: none; text-decoration: none;
transition: all .3s; transition: all .3s;
display: block; display: inline-block;
span {
color: $color-text;
}
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
@ -313,6 +318,11 @@ body.close {
top: 30px; top: 30px;
} }
main {
height: auto;
overflow-x: hidden;
}
.sidebar { .sidebar {
left: -$sidebar-width; left: -$sidebar-width;
transition: transform 250ms ease-out; transition: transform 250ms ease-out;
@ -320,7 +330,8 @@ body.close {
.content { .content {
left: 0; left: 0;
min-width: 100vw; max-width: 100vw;
position: static;
transition: transform 250ms ease; transition: transform 250ms ease;
} }
@ -330,6 +341,7 @@ body.close {
.sidebar-toggle { .sidebar-toggle {
width: auto; width: auto;
background-color: transparent;
} }
body.close { body.close {
@ -339,6 +351,8 @@ body.close {
.sidebar-toggle { .sidebar-toggle {
width: calc($sidebar-width - 16px); width: calc($sidebar-width - 16px);
background-color: rgba($color-bg, .8);
transition: 1s background-color;
} }
.content { .content {
@ -346,7 +360,7 @@ body.close {
} }
nav, .github-corner { nav, .github-corner {
transform: translateX($sidebar-width); display: none;
} }
} }

View file

@ -2,14 +2,12 @@
$color-primary: #0074D9; $color-primary: #0074D9;
$color-bg: #fff; $color-bg: #fff;
$color-text: #34495e;
$sidebar-width: 16em; $sidebar-width: 16em;
@import "basic/layout"; @import "basic/layout";
@import "basic/coverpage"; @import "basic/coverpage";
body {
color: #34495e;
}
/* sidebar */ /* sidebar */
.sidebar { .sidebar {
color: #364149; color: #364149;

View file

@ -1,4 +1,5 @@
$color-primary: #000; $color-primary: #000;
$color-bg: #fff; $color-bg: #fff;
$color-text: #000;
$sidebar-width: 300px; $sidebar-width: 300px;
@import "basic/layout"; @import "basic/layout";

View file

@ -2,6 +2,7 @@
$color-primary: #42b983; $color-primary: #42b983;
$color-bg: #fff; $color-bg: #fff;
$color-text: #34495e;
$sidebar-width: 300px; $sidebar-width: 300px;
@import "basic/layout"; @import "basic/layout";
@ -9,7 +10,6 @@ $sidebar-width: 300px;
body { body {
background-color: $color-bg; background-color: $color-bg;
color: #34495e;
} }
/* sidebar */ /* sidebar */

View file

@ -1,4 +1,4 @@
import { isMobile } from './util'
/** /**
* Render github corner * Render github corner
* @param {Object} data * @param {Object} data
@ -23,13 +23,13 @@ export function corner (data) {
* Render main content * Render main content
*/ */
export function main (tpl) { export function main (tpl) {
return `<main> const aside = `${tpl}<aside class="sidebar"></aside>`
${tpl}
<aside class="sidebar"></aside> return (isMobile() ? `${aside}<main>` : `<main>${aside}`) +
<section class="content"> `<section class="content">
<article class="markdown-section"></article> <article class="markdown-section"></article>
</section> </section>
</main>` </main>`
} }
/** /**