Add simple sidebar demo without content bleed
glightbox covers that use case well enough
This commit is contained in:
parent
12475dd216
commit
c65e19807d
2 changed files with 161 additions and 0 deletions
55
src/sidebar-no-bleed/index.html
Normal file
55
src/sidebar-no-bleed/index.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" href="./index.scss" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="hero" id="hero">
|
||||
<div class="details-wrapper" id="details">
|
||||
<div class="details">
|
||||
<small>Breadcrumb</small>
|
||||
<h1>Title</h1>
|
||||
<p>Details</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<main>
|
||||
<div class="spacer"></div>
|
||||
<div class="content-wrapper">
|
||||
<p>Content</p>
|
||||
<img src="https://placehold.co/2000x200" />
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
</div>
|
||||
<div class="sidebar">
|
||||
<div class="sidebar-inner">
|
||||
<p>Date</p>
|
||||
<p>Reading time</p>
|
||||
<p>Tags</p>
|
||||
<ul>
|
||||
<li>1</li>
|
||||
<li>1</li>
|
||||
<li>1</li>
|
||||
<li>1</li>
|
||||
<li>1</li>
|
||||
<li>1</li>
|
||||
<li>1</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
106
src/sidebar-no-bleed/index.scss
Normal file
106
src/sidebar-no-bleed/index.scss
Normal file
|
@ -0,0 +1,106 @@
|
|||
@import "normalize.css";
|
||||
|
||||
body,
|
||||
html {
|
||||
height: 100%;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
$content-width: 80ch;
|
||||
$content-padding: 16px;
|
||||
$sidebar-width: 300px;
|
||||
|
||||
$details-bg: black;
|
||||
$details-padding: $content-padding;
|
||||
|
||||
.hero {
|
||||
height: 50vh;
|
||||
background-color: red;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: center;
|
||||
|
||||
.details-wrapper {
|
||||
background-color: transparentize($details-bg, 0.6);
|
||||
color: white;
|
||||
line-height: 1;
|
||||
width: calc(100% - ($details-padding * 2));
|
||||
padding: 0 $details-padding;
|
||||
}
|
||||
|
||||
.details {
|
||||
width: $content-width;
|
||||
max-width: 100%;
|
||||
margin: 1rem auto;
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
margin-bottom: 0.75rem;
|
||||
margin-top: 0.5rem;
|
||||
font-size: 3.5rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
display: flex;
|
||||
gap: $content-padding;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
flex-grow: 1;
|
||||
flex-basis: $sidebar-width;
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
width: $content-width;
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
flex-grow: 1;
|
||||
flex-basis: $sidebar-width;
|
||||
min-width: $sidebar-width;
|
||||
|
||||
.sidebar-inner {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
font-size: 90%;
|
||||
margin: $content-padding;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
main {
|
||||
flex-direction: column-reverse;
|
||||
align-items: center;
|
||||
margin-left: $content-padding;
|
||||
margin-right: $content-padding;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
flex-basis: unset;
|
||||
width: $content-width;
|
||||
max-width: 100%;
|
||||
|
||||
.sidebar-inner {
|
||||
position: unset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: calc($sidebar-width + 100px)) {
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue