Skip to content

Commit 818a1fc

Browse files
QuincyGowbmuenzenmeyer
authored andcommitted
Merge pull request #19 from bradfrost/feature/update-blog-posts
Feature/update blog posts
1 parent 42cdd92 commit 818a1fc

File tree

7 files changed

+116
-2
lines changed

7 files changed

+116
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends 'layouts/base.njk' %}
2+
{% set pageType = 'Post Archive' %}
3+
4+
{# Intro content #}
5+
{% set introHeading = title %}
6+
{% set introSummary %}{{ content | safe }}{% endset %}
7+
8+
{# Post list content #}
9+
{% set postListHeading = 'All posts' %}
10+
{% set postListItems = collections.posts %}
11+
12+
{% block content %}
13+
<main id="main-content">
14+
{% include "partials/components/intro.njk" %}
15+
{% include "partials/components/post-list.njk" %}
16+
</main>
17+
{% endblock %}

packages/docs/src/_includes/layouts/post.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<div class="l-linelength-container">
1818
<article class="[ post ] [ h-entry ]">
1919
{% include "partials/components/intro.njk" %}
20-
{% include "components/page-header.njk" %}
20+
2121
<div class="c-text-passage">
2222
{{ content | safe }}
2323
</div>

packages/docs/src/blog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
layout: layouts/page.njk
3+
title: Blog
4+
---
5+
6+
## Blog
7+
8+

packages/docs/src/docs/blog.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: Blog
3+
tags:
4+
- demo-content
5+
- code
6+
- blog
7+
category: updates
8+
---
9+
10+
The best way to demo a code post is to display a real life post, so check out this one from [andy-bell.design](https://andy-bell.design/wrote/creating-a-full-bleed-css-utility/) about a full bleed CSS utility.
11+
12+
---
13+
14+
Sometimes you want to break your components out of the constraints that they find themselves in. A common situation where this occurs is when you don’t have much control of the container that it exists in, such as a CMS main content area.
15+
16+
This is even more the case with editing tools such as the [WordPress Gutenberg editor](https://wordpress.org/gutenberg/), where in theory, you could pull in a component from a design system and utilise it in the main content of your web page. In these situations, it can be pretty darn handy to have a little utility that makes the element 100% of the viewport’s width _and_ still maintain its flow within its parent container.
17+
18+
This is when I normally pull the `.full-bleed` utility class out of my back pocket.
19+
20+
## The `.full-bleed` utility
21+
22+
It’s small, but hella mighty:
23+
24+
```css
25+
.full-bleed {
26+
width: 100vw;
27+
margin-left: 50%;
28+
transform: translateX(-50%);
29+
}
30+
```
31+
32+
Here it is in a context where it makes a fancy `<aside>` and a `<figure>` element bleed out of their parent container.
33+
34+
<iframe height="300" style="width: 100%;" scrolling="no" title="Piccalilli CSS Utility — Issue #2 — Full bleed utility" src="//codepen.io/andybelldesign/embed/Nmxrwv/?height=300&theme-id=dark&default-tab=css,result" frameborder="no" allowtransparency="true" allowfullscreen="true">
35+
See the Pen <a href='https://codepen.io/andybelldesign/pen/Nmxrwv/'>Piccalilli CSS Utility — Issue #2 — Full bleed utility</a> by Andy Bell
36+
(<a href='https://codepen.io/andybelldesign'>@andybelldesign</a>) on <a href='https://codepen.io'>CodePen</a>.
37+
</iframe>
38+
39+
The `.full-bleed` utility gives those elements prominence and _importantly_ keeps their semantic place in the page. Just how I like it.
40+
41+
---
42+
43+
🔥 **Pro tip**: When working with a utility like `.full-bleed`, it’s a good idea to add an inner container that has a max-width and auto horizontal margin. For this, I normal create a shared `.wrapper` component like this:
44+
45+
```css
46+
.wrapper {
47+
max-width: 50rem;
48+
margin-left: auto;
49+
margin-right: auto;
50+
}
51+
```
52+
53+
Having a container like `.wrapper` helps to create consistent, centred content.
54+
55+
---
56+
57+
### How the `.full-bleed` utility works
58+
59+
We set the container to be `width: 100vw`, which equates to the full viewport width. We couldn’t set it to `width: 100%` because it would only fill the space of its parent element. The parent element’s width _is_ useful though, because by setting `margin-left: 50%`, we are telling the component to align its **left edge** to the center of its parent element, because `50%` is half of the **parent element’s** width.
60+
61+
Finally, we use CSS transforms to `translateX(-50%)`. Because the transform works off the element’s dimensions and not the parent’s dimensions, it’ll pull the element back `50vw`, because it’s `100vw` wide, thus making it sit perfectly flush with the viewport’s edges.
62+
63+
## Wrapping up
64+
65+
Hopefully this short and sweet trick will help you out on your projects. If it does, [drop me a tweet](https://twitter.com/andybelldesign), because I’d love to see it!

packages/docs/src/docs/blog2.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Blog 2
3+
tags:
4+
- blog
5+
category: updates
6+
---
7+
8+
## Blog 2
9+
10+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

packages/docs/src/posts/blog1.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Blog 1
3+
tags:
4+
- demo-content
5+
- code
6+
- blog
7+
8+
---
9+
10+
## Blog 1
11+
12+
<blockquote>Maecenas faucibus mollis interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae elit libero, a pharetra augue.</blockquote>

packages/docs/src/updates.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
2-
layout: layouts/page.njk
2+
layout: layouts/blog.njk
33
title: Updates
44
---
55

66
[list of blog posts]
7+
8+

0 commit comments

Comments
 (0)