Consistent sidebars 2641 (#2642)

* consistent sidebar tutorial

- added css-var for light sidebar-text for easy handling
- provide higher contrast for better readability in code and blockquotes
- push SHOW ME with higher contrast (on dark instead on white)

* minor fixes on opacities and color

* adjust sidebar-styles of docs and examples

closes #2641
pull/2650/head
Achim Vedam 6 years ago committed by GitHub
parent e73084b6af
commit 3b244a6fde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -48,19 +48,12 @@
a { a {
position: relative; position: relative;
opacity: 0.75; transition: color 0.2s;
transition: opacity 0.2s;
border-bottom: none; border-bottom: none;
padding: 0; padding: 0;
color: var(--second); color: var(--second);
} }
@media (min-width: 832px) {
a {
color: white;
}
}
.section { .section {
display: block; display: block;
padding: 0 0 .8rem 0; padding: 0 0 .8rem 0;
@ -78,22 +71,33 @@
} }
.section:hover, .section:hover,
.subsection:hover { .subsection:hover,
.active {
color: var(--flash); color: var(--flash);
opacity: 1
} }
.subsection[data-level="4"] { .subsection[data-level="4"] {
padding-left: 1.2rem; padding-left: 1.2rem;
} }
.active { opacity: 1 }
.icon-container { .icon-container {
position: absolute; position: absolute;
top: -.2rem; top: -.2rem;
right: 2.4rem; right: 2.4rem;
} }
@media (min-width: 832px) {
a {
color: var(--sidebar-text);
}
a:hover,
.section:hover,
.subsection:hover,
.active {
color: white
}
}
</style> </style>
<ul <ul

@ -22,7 +22,7 @@
.section-title { .section-title {
display: block; display: block;
padding: 0 0 .8rem 0; padding: 0 0 0.8rem 0;
font: 400 var(--h6) var(--font); font: 400 var(--h6) var(--font);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.12em; letter-spacing: 0.12em;
@ -32,7 +32,7 @@
a { a {
display: flex; display: flex;
position: relative; position: relative;
color: white; color: var(--sidebar-text);
border-bottom: none; border-bottom: none;
padding: 0.2rem 3rem; padding: 0.2rem 3rem;
margin: 0 -3rem; margin: 0 -3rem;
@ -42,17 +42,19 @@
} }
a:hover { a:hover {
color: var(--flash); color: white;
} }
a.active { a.active {
background: rgba(255, 255, 255, 0.1) calc(100% - 3rem) 50% no-repeat url(/icons/arrow-right.svg); background: rgba(0, 0, 0, 0.15) calc(100% - 3rem) 50% no-repeat
url(/icons/arrow-right.svg);
background-size: 1em 1em; background-size: 1em 1em;
color: white; color: white;
} }
a.active.loading { a.active.loading {
background: rgba(255, 255, 255, 0.1) calc(100% - 3rem) 50% no-repeat url(/icons/loading.svg); background: rgba(0, 0, 0, 0.1) calc(100% - 3rem) 50% no-repeat
url(/icons/loading.svg);
background-size: 1em 1em; background-size: 1em 1em;
color: white; color: white;
} }
@ -63,34 +65,34 @@
width: 5rem; width: 5rem;
height: 5rem; height: 5rem;
border-radius: 2px; border-radius: 2px;
box-shadow: 1px 1px 3px rgba(0,0,0,0.13); box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.13);
margin: 0.2em 0.5em 0.2em 0; margin: 0.2em 0.5em 0.2em 0;
} }
</style> </style>
<ul class="examples-toc"> <ul class="examples-toc">
{#each sections as section} {#each sections as section}
<li> <li>
<span class="section-title"> <span class="section-title">
{section.title} {section.title}
</span> </span>
{#each section.examples as example} {#each section.examples as example}
<a <a
href="examples#{example.slug}" href="examples#{example.slug}"
class="row" class="row"
class:active="{example.slug === active_section}" class:active="{example.slug === active_section}"
class:loading="{isLoading}" class:loading="{isLoading}"
> >
<img <img
class="thumbnail" class="thumbnail"
alt="{example.title} thumbnail" alt="{example.title} thumbnail"
src="examples/thumbnails/{example.slug}.jpg" src="examples/thumbnails/{example.slug}.jpg"
> />
<span>{example.title}</span> <span>{example.title}</span>
</a> </a>
{/each} {/each}
</li> </li>
{/each} {/each}
</ul> </ul>

@ -30,13 +30,17 @@
display: block; display: block;
padding: 0.7em 0; padding: 0.7em 0;
text-align: center; text-align: center;
opacity: 0.7; opacity: 0.75;
color: white; color: white;
} }
a:hover {
opacity: 1;
}
a.disabled, a.disabled:hover, a.disabled:active { a.disabled, a.disabled:hover, a.disabled:active {
color: white; color: white;
opacity: 0.4; opacity: 0.3;
} }
span { span {

@ -151,7 +151,7 @@
height: 100%; height: 100%;
border-right: 1px solid var(--second); border-right: 1px solid var(--second);
background-color: var(--second); background-color: var(--second);
color: white; color: var(--sidebar-text);
} }
.chapter-markup { .chapter-markup {
@ -165,6 +165,7 @@
margin: 4rem 0 1.6rem 0; margin: 4rem 0 1.6rem 0;
font-size: var(--h3); font-size: var(--h3);
line-height: 1; line-height: 1;
font-weight: 400;
color: white; color: white;
} }
@ -173,16 +174,21 @@
} }
.chapter-markup :global(a) { .chapter-markup :global(a) {
color: var(--sidebar-text);
}
.chapter-markup :global(a:hover) {
color: white; color: white;
} }
.chapter-markup :global(ul) { .chapter-markup :global(ul) {
padding: 0 0 0 2em; padding: 0 0 0 2em;
} }
.chapter-markup :global(blockquote) { .chapter-markup :global(blockquote) {
background-color: rgba(255,255,255,.1); background-color: rgba(0,0,0,.17);
color: white; color: var(--sidebar-text);
} }
.chapter-markup::-webkit-scrollbar { .chapter-markup::-webkit-scrollbar {
@ -198,22 +204,22 @@
.chapter-markup :global(p) > :global(code), .chapter-markup :global(p) > :global(code),
.chapter-markup :global(ul) :global(code) { .chapter-markup :global(ul) :global(code) {
color: white; color: var(--sidebar-text);
background: rgba(255,255,255,.1); background: rgba(0,0,0,.12);
padding: .2em .4em; padding: .2em .4em .3em;
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
top: -0.1em; top: -0.1em;
} }
.controls { .controls {
border-top: 1px solid rgba(255,255,255,.1); border-top: 1px solid rgba(255,255,255,.15);
padding: 1em 0 0 0; padding: 1em 0 0 0;
display: flex; display: flex;
} }
.show { .show {
background: rgba(255,255,255,.1); background: rgba(0,0,0,.4);
padding: .2em .7em .3em; padding: .2em .7em .3em;
border-radius: var(--border-r); border-radius: var(--border-r);
top: .1em; top: .1em;
@ -223,22 +229,17 @@
} }
.show:hover { .show:hover {
background: rgba(255,255,255,.2); background: rgba(0,0,0,.65);
color: white;
} }
a.next { a.next {
/* border-bottom: none; */
padding-right: 1.2em; padding-right: 1.2em;
background: no-repeat 100% 50% url(/icons/arrow-right.svg); background: no-repeat 100% 50% url(/icons/arrow-right.svg);
background-size: 1em 1em; background-size: 1em 1em;
margin-left: auto; margin-left: auto;
} }
a.next:hover {
/* border-bottom: 2px solid currentColor; */
/* text-decoration: underline; */
}
.improve-chapter { .improve-chapter {
padding: 1em 0 .5em 0; padding: 1em 0 .5em 0;
} }

@ -46,6 +46,7 @@
--flash: #40b3ff; --flash: #40b3ff;
--heading: var(--second); --heading: var(--second);
--text: #444; --text: #444;
--sidebar-text: rgba(255, 255, 255, .75);
--border-w: .3rem; /* border-width */ --border-w: .3rem; /* border-width */
--border-r: .4rem; /* border-radius */ --border-r: .4rem; /* border-radius */
} }

Loading…
Cancel
Save