Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USWDS-Site - What's new: Update post preview structure and styles #2979

Merged
merged 28 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
647be14
Update post preview styles; allow custom preview url
amyleadem Nov 20, 2024
0e83a74
Add sample posts
amyleadem Nov 20, 2024
c77ea37
Merge branch 'main' of https://github.com/uswds/uswds-site into al-wh…
amyleadem Nov 20, 2024
7b360a4
Separate post.html and post-preview.html
amyleadem Nov 20, 2024
ca4c58f
Update content on sample posts
amyleadem Nov 21, 2024
3eebc4f
Add underline to post-title link styles
amyleadem Nov 21, 2024
4858824
Refine styles for "news and updates"; remove h3 from in-page nav
amyleadem Nov 21, 2024
3abcf7b
Merge branch 'main' of https://github.com/uswds/uswds-site into al-wh…
amyleadem Nov 21, 2024
ecadaf6
Remove excerpt_link_text
amyleadem Nov 21, 2024
95b14b6
Format code
amyleadem Nov 21, 2024
80e627a
Move date below byline
amyleadem Nov 21, 2024
f9ccd69
Move utility clases off of post.html
amyleadem Nov 21, 2024
f659984
Restore measure-4 on post.html
amyleadem Nov 21, 2024
39e8f6a
Move utility classes off of post-content
amyleadem Nov 21, 2024
c0774a6
Format code
amyleadem Nov 22, 2024
41fd023
Add comments to includes
amyleadem Nov 25, 2024
c4d016a
Replace excerpt_link_url > custom_url; Add comment
amyleadem Nov 25, 2024
55d9f08
Create .post-meta subheading styles.
amyleadem Nov 25, 2024
fece742
Move post styles to posts partial
amyleadem Nov 25, 2024
cca2c85
Add article wrapper to post.html; add include comment
amyleadem Nov 25, 2024
0a1b612
Replace custom_url -> preview_url
amyleadem Nov 26, 2024
e9f2d18
Format code
amyleadem Nov 29, 2024
2b25d81
Tweak lead copy
amyleadem Nov 29, 2024
61aaf20
Remove demo posts
amyleadem Nov 29, 2024
a4a2f63
Update all-news.md
annepetersen Dec 9, 2024
11d17df
Update overview.md
annepetersen Dec 9, 2024
94ce244
Merge branch 'main' of https://github.com/uswds/uswds-site into al-wh…
amyleadem Dec 9, 2024
e6a115f
Merge branch 'main' of https://github.com/uswds/uswds-site into al-wh…
amyleadem Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _includes/post-author.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<span class="post-date site-subheading">By {{ post.author }}</span>
3 changes: 3 additions & 0 deletions _includes/post-date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<time class="post-date site-subheading" datetime="{{ post.date | date: '%FT%T' }}">
{{ post.date | date: '%B %-d, %Y' }}
</time>
35 changes: 35 additions & 0 deletions _includes/post-preview.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% assign post = include.post %}

{%- capture excerpt_link_url -%}
{%- if post.excerpt_link_url -%}
{{ post.excerpt_link_url }}
{%- else -%}
{{ site.baseurl }}{{ post.url }}
{%- endif -%}
{%- endcapture -%}
mejiaj marked this conversation as resolved.
Show resolved Hide resolved

<article id="{{ post.id | default: post.title | slugify }}" class="post-preview">
mejiaj marked this conversation as resolved.
Show resolved Hide resolved
<header class="post-preview__header">
<p class="post-category site-subheading">
{{ post.tags[0] }}
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
</p>

<{{ include.heading | default:"h2" }} class="post-preview__title">
mejiaj marked this conversation as resolved.
Show resolved Hide resolved
<a href="{{ excerpt_link_url }}">
{{ post.title }}
</a>
</{{ include.heading | default:"h2" }}>

{% if post.author %}
{% include post-author.html %}
{% endif %}
</header>

<div class="post-preview__content site-prose">
<p>
{{ post.lead | default: post.excerpt }}
</p>

{% include post-date.html %}
</div>
</article>
42 changes: 15 additions & 27 deletions _includes/post.html
Copy link
Contributor Author

@amyleadem amyleadem Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Developers: I separated out the post excerpt/preview part of this file into post-preview.html. I did that because it felt like the structure of the markup was different enough to warrant separate files, and I also was finding it difficult to easily read the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: Much cleaner template, nice work.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to say the same thing! Great work here Amy!

Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
{% assign post = include.post %}
<article id="{{ post.id | default: post.title | slugify }}"{% if include.excerpt %} class="post-excerpt padding-top-2 border-top-2px margin-top-4 measure-6"{% endif %}>
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
<header class="post-meta">
<p class="post-category site-subheading">
{{ post.tags[0] }}
</p>

<h1 class="post-title font-lang-11 tablet:font-lang-14 text-thin">
Copy link
Contributor Author

@amyleadem amyleadem Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Moved the styles from the utility classes into uswds-theme-custom-styles for easier style and markup management.

{% if include.excerpt %}<a href="{{ site.baseurl }}{{ post.url }}">{% endif %}
{{ post.title }}
{% if include.excerpt %}</a>{% endif %}
</h1>
<header class="post-preview__header">
<p class="post-category site-subheading">
{{ post.tags[0] }}
</p>

{% if post.author %}
<h1 class="post-title font-lang-11 tablet:font-lang-14 text-thin">
{{ post.title }}
</h1>

{% if post.author %}
<span class="post-date site-subheading">By {{ post.author }}</span>
{% endif %}
<time class="post-date site-subheading" datetime="{{ post.date | date: '%FT%T' }}">
{{ post.date | date: '%B %-d, %Y' }}
</time>
</header>
{% endif %}

<div class="post-content site-prose {% if include.excerpt == true %}{% else%}measure-4 {% endif %}margin-top-4">
{% if include.excerpt == true %}
<p class="post-excerpt">
{{ post.lead | default: post.excerpt }}
</p>
{% include post-date.html %}
</header>

<p class="post-more margin-top-2"><a href="{{ site.baseurl }}{{ post.url }}">Continue reading</a></p>
{% else %}
{{ post.content }}
{% endif %}
</div>
</article>
<div class="post-content site-prose margin-top-4">
{{ post.content }}
</div>
8 changes: 8 additions & 0 deletions _posts/2024-10-15-sunsetting-uswds-1-0.md
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Sunsetting the USWDS 1.0 documentation site
tags:
- product update
category: About
excerpt: It's been over five years since we launched USWDS 2.0 and moved on from USWDS v1. We archived the USWDS v1 documentation site a few years back, and at the end of 2024 we'll be taking it offline. Content will likely still be available via archive.org.
excerpt_link_url: https://v1.designsystem.digital.gov/
Copy link
Contributor

@mejiaj mejiaj Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quibble: Feels confusing to say we're sunsetting it and then send them to the V1 site.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi James, we'd linked to it in previous newsletters and monthly calls - to give users an opportunity to review and let us know if there were things they wanted to keep. Is there anywhere you can recommend we guide them instead? @amyleadem I'm also wondering if there might be instances where we don't link to anything from an announcement...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is an interesting thing to consider and definitely worth discussing.

I can code in an option that would let us turn off the link in the header. Here is a preview of what this post would look like without a header link:

image

Let me know if you want me to include this as an option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I do, for discussion. And I'm wondering about this post - as it ages and we take down that site, we'll need to remove that link, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A potentially new use case worth discussing. FWIW, I don't see this question as a blocker for this PR.

---
7 changes: 7 additions & 0 deletions _posts/2024-10-17-uswds-3.9.0.md
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: "Out now: USWDS 3.9.0"
tags:
- USWDS release
category: About
excerpt_link_url: https://github.com/uswds/uswds/releases/tag/v3.9.0
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
---
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: "Accessibility focus: Going beyond visual design for inclusive user experiences"
tags:
- discussion
category: About
excerpt: This National Disability Employment Awareness Month, we’re talking about how members of the design community go beyond visual design to create more inclusive user experiences. What steps are you taking to ensure that your website design is accessible to all?
excerpt_link_url: https://github.com/uswds/uswds/discussions/6109
---
16 changes: 16 additions & 0 deletions _posts/2024-11-01-web-components-are-coming.md
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Web Components are coming to USWDS
tags:
- product update
category: About
author: Dan O. Williams, James Mejia, Amy Leadem, Charlie Mahoney
excerpt: Big changes are coming to the U.S. Web Design System in a Web Components-based generation. Ideal for small teams with limited development resources, this next generation of the design system promises to be a practical, usable, powerful tool for designers and developers to do their work.
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis varius diam sapien. In non urna neque. Morbi semper, enim et consectetur pulvinar, ex arcu faucibus sem, sed volutpat leo libero id massa. Vivamus interdum lobortis augue, ut posuere felis porttitor et. Sed feugiat sit amet lectus at ullamcorper.

Aliquam sed convallis urna. Nulla laoreet ullamcorper aliquet. Fusce eu metus est. Morbi ut hendrerit ligula. Etiam sit amet ligula sollicitudin, pellentesque est vel, efficitur massa.

Pellentesque ullamcorper, ante in vestibulum imperdiet, purus sem auctor nibh, eu condimentum sem sapien eget risus. Nunc malesuada, velit quis semper accumsan, est risus auctor velit, sed faucibus nunc mauris nec nisl. Vestibulum maximus felis sed pellentesque pharetra. Pellentesque viverra dolor a semper tincidunt. Nam a arcu tortor. Curabitur interdum eros odio, nec facilisis lorem congue ut.

Donec quis eros eu erat efficitur interdum eu ut velit. Nam eget tincidunt est. Nam ornare mi non velit laoreet, at rhoncus orci hendrerit. Donec turpis nisl, lobortis a nisl eu, pulvinar aliquam eros. Etiam massa sem, fringilla et porta ut, posuere in eros. Nullam metus lectus, aliquam quis maximus sed, consequat et nisl. Mauris ultricies sed velit vel tincidunt. Nullam tempor consequat luctus.
48 changes: 28 additions & 20 deletions css/_uswds-theme-custom-styles.scss
mejiaj marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -1568,47 +1568,55 @@ iframe {
margin-bottom: units(4);
}

.post-excerpt {
margin-top: units(5);
.post-preview {
mejiaj marked this conversation as resolved.
Show resolved Hide resolved
@include u-border-top("1px", "gray-30");
@include u-margin-y(3);
@include u-measure(6);

.post-title {
margin-top: 0;
margin-bottom: 0;
.post-preview__title,
.post-preview_content,
.post-preview__header,
.post-category {
@include u-margin-y(2);
}

.post-preview__header {
@include u-margin-top(3);
}

.post-preview__title {
@include typeset("lang", "lg", 3);
@include u-text("bold");

a {
color: inherit;
text-decoration: none;

&:hover {
color: color($site-primary);
text-decoration: underline;
}
}
}

.post-category {
margin-top: 0;
}

.post-category + .post-title {
margin-top: 0;
.post-preview__content p {
@include u-font("lang", "xs");
}
} // .post-preview
amyleadem marked this conversation as resolved.
Show resolved Hide resolved

.post-content p {
margin-bottom: 0;
margin-top: units(0.5);
}
} // .post-excerpt
.post-date
.post-meta {
@include u-margin-y(2);
}

.post-date {
.post-date.site-subheading {
amyleadem marked this conversation as resolved.
Show resolved Hide resolved
display: block;
letter-spacing: normal;
text-transform: none;
}

.post-title {
@include typeset-h2;
@include u-measure(1);
@include typeset("lang", "2xl", 3);
@include u-text("thin");
}

.post-outdated-content {
Expand Down
2 changes: 1 addition & 1 deletion pages/whats-new/all-news.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ in_page_nav_headings: false
---

{% for post in site.posts %}
{% include post.html post=post excerpt=true %}
{% include post-preview.html post=post %}
{% endfor %}
4 changes: 3 additions & 1 deletion pages/whats-new/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ cards:
body: "How our growing community of government engineers, content specialists, and designers participate and contribute to improving USWDS."
linkText: "USWDS GitHub discussion"
linkUrl: "https://github.com/uswds/uswds/discussions"
in_page_nav_headings: "h2"
---

{% include site-card-list.html
Expand All @@ -42,10 +43,11 @@ cards:
listItemClasses="desktop:grid-col-6"
%}

{:.margin-top-2.text-normal.font-lang-md.text-gray-70}
## News and updates

{% for post in site.posts limit:4 %}
{% include post.html post=post excerpt=true %}
{% include post-preview.html post=post heading="h3"%}
{% endfor %}

---
Expand Down