Skip to content

Commit

Permalink
Add new layout for section page and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
backlands committed Apr 20, 2018
1 parent 14fac35 commit 83a6994
Show file tree
Hide file tree
Showing 7 changed files with 247 additions and 7 deletions.
90 changes: 90 additions & 0 deletions _layouts/listings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!doctype html>
<html lang="{{ site.lang | default: "en-US" }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">

{% seo %}
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="{{ '/assets/js/respond.js' | relative_url }}"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if lt IE 8]>
<link rel="stylesheet" href="{{ '/assets/css/ie.css' | relative_url }}">
<![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

</head>
<body class="{{ page.colorspace }}">
{% if site.show_header %}
<div id="header">
<nav>
<li class="fork"><a href="{{ site.github.repository_url }}">View On GitHub</a></li>
{% if site.show_downloads %}
<li class="downloads"><a href="{{ site.github.zip_url }}">ZIP</a></li>
<li class="downloads"><a href="{{ site.github.tar_url }}">TAR</a></li>
<li class="title">DOWNLOADS</li>
{% endif %}
</nav>
</div><!-- end header -->
{% endif %}

<div class="wrapper">
{% if site.show_header %}<section>
{% else %}<section class="no-header">{% endif %}
<div id="title">
{% if page.icon %}
<img src="{{ site.url }}/assets/images/{{ page.icon }}" />
{% endif %}
<h1>{{ site.title | default: site.github.repository_name }}</h1>
<p>{{ site.description | default: site.github.project_tagline }}</p>
<hr>
</div>

{{ content }}

<div class="listings">
{% for category in page.listings %}
<div class="listings-category">
<h2 class="title">{{ category[0] }}</h2>
{% for listing in category[1] %}
<div class="listing">
{% if listing[1].link contains 'http' %}
<a href="{{ listing[1].link }}">
{% else %}
<a href="{{ listing[1].link | baseurl }}">
{% endif %}
<img src="{{ listing[1].icon | baseurl }}" />
<h3>{{ listing[0] }}</h3>
</a>
</div>
{% endfor %}
</div>
{% endfor %}
</div>

<a href="../" class="button">Back</a>

<div id="footer">
<hr />
<span class="credits left">Project maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a></span>
<span class="credits right">Hosted on GitHub Pages &mdash; Theme by <a href="https://draculatheme.com/">Dracula</a></span>
</div>
</section>

</div>

{% if site.google_analytics %}
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
</body>
</html>
82 changes: 77 additions & 5 deletions _sass/jekyll-theme-dracula.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
@import "normalize";
@import "fonts";
@import "variables";
@import "mixins";
@import "rouge-dracula.scss";
@import "colorspaces.scss";

body {
padding:0px 0 20px 0px;
Expand Down Expand Up @@ -112,6 +114,7 @@ blockquote {
code {
font-family: $mono-fonts;
color:$foreground;
background: $current;
font-size:13px;
margin: 0 4px;
padding: 4px 6px;
Expand Down Expand Up @@ -140,7 +143,6 @@ th {
text-align:left;
padding:5px 10px;
background: $comment;
border-bottom:1px solid $pink;
color: $foreground;
font-weight: 600;
}
Expand All @@ -164,6 +166,24 @@ dt {
font-weight: 600;
}

button, a.button {
color: $background;
border: 1px solid $cyan;
background: $cyan;
padding: 10px 12px;
margin-top: 6px;
line-height:14px;
font-size:14px;
font-weight: bold;
display:inline-block;
text-align:center;
&:hover {
background: $comment;
color: $foreground;
border-color: $comment;
}
}


#header {
z-index: 100;
Expand Down Expand Up @@ -270,8 +290,50 @@ section {
}
}

@media print, screen and (max-width: 720px) {
.listings-category {
text-align: center;
.title {
margin-bottom: 16px;
transform: rotate(-5deg);
}
&:nth-child(2n) {
.title { transform: rotate(5deg); }
}
&:nth-child(6n+1) {
.title { color: $cyan; }
}
&:nth-child(6n+2) {
.title { color: $orange; }
}
&:nth-child(6n+3) {
.title { color: $purple; }
}
&:nth-child(6n+4) {
.title { color: $red; }
}
&:nth-child(6n+5) {
.title { color: $pink; }
}
.listing {
width: 32.32%;
display: inline-block;
box-sizing: border-box;
padding: 0 16px;
margin-bottom: 32px;
vertical-align: text-top;
&:nth-child(3n+2) { @include clear(); }
a {
display: block;
h3 {
color: $faded;
margin-top: 8px;
}
}
}
@include clearfix();
}

@media print, screen and (max-width: 720px) {
#title {
.credits {
display: block;
Expand All @@ -290,20 +352,30 @@ section {
}
}
}

.listings-category {
.listing {
width: 49%;
}
}
}

@media print, screen and (max-width: 480px) {

#header {
margin-top: -20px;
}

section {
margin-top: 40px;
}

nav {
display: none;
}
}

@import "colorspaces.scss";
.listings-category {
.listing {
width: 100%;
}
}
}
14 changes: 14 additions & 0 deletions _sass/mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@mixin clearfix() {
&:before,
&:after {
content: "";
display: table;
}
&:after {
clear: both;
}
zoom: 1;
}
@mixin clear() {
clear: both;
}
1 change: 1 addition & 0 deletions _sass/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $current: #44475a;
$selection: #44475a;
$foreground:#f8f8f2;
$comment: #6272a4;
$faded: #bcc2cd;
$cyan: #8be9fd;
$green: #50fa7b;
$orange: #ffb86c;
Expand Down
36 changes: 36 additions & 0 deletions docs/listings-pages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
layout: default
colorspace: red
---

## Using Listing Pages

> Listing pages can be used as a central hub of a larger set of content that can then be navigated to through the listed links. These pages are benificial for simplifying navigation through your documentation.
[Preview](../samples/listings-page){: .button}

### Listing Hash Structure

```yaml
listings:
"Featured":
'React Dev Tools':
link: '#example'
icon: '/assets/images/candies.png'
'Slack':
link: '#example'
icon: '/assets/images/candies.png'
'Visual Studio Code':
link: '#example'
icon: '/assets/images/candies.png'
"Code Editors":
'Vim':
link: '#example'
icon: '/assets/images/candies.png'
```
As you can see, each Listings page has a page variable defined of `listings` with aa nested category hash with it's frontend name. These categories then have a final nested hash with the Listing items name and a link/icon pair inside.

This structure must be followed exactly for the layout to output the predefined structured listings page.

[Home](../){: .button}
5 changes: 3 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
layout: default
---

Text can be **bold**, _italic_, or ~~strikethrough~~.
### Preview Page Types
[Listing Pages](/samples/listings-page)

[Link to another page](another-page).
Text can be **bold**, _italic_, or ~~strikethrough~~.

There should be whitespace between paragraphs.

Expand Down
26 changes: 26 additions & 0 deletions samples/listings-page.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
layout: listings
colorspace: purple
listings:
'Featured':
'React Dev Tools':
link: '#example'
icon: '/assets/images/candies.png'
'Slack':
link: '#example'
icon: '/assets/images/candies.png'
'Code Editors':
'Vim':
link: '#example'
icon: '/assets/images/candies.png'
'Sublime':
link: '#example'
icon: '/assets/images/candies.png'
'Xcode':
link: '#example'
icon: '/assets/images/candies.png'
---

Below you will find an example of the structure of a listings page with some filler content that goes nowhere.

[Documentation](../docs/listings-pages){: .button}

0 comments on commit 83a6994

Please sign in to comment.