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

feat: add post summary micro variant #967

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
104 changes: 104 additions & 0 deletions docs/product/components/post-summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,110 @@ <h3 class="s-post-summary--content-title">
</div>
</div>


{% header "h3", "Micro" %}
<!-- TODO: Update copy for Micro -->
<p class="stacks-copy">There are compact views where it’s appropriate to reduce the amount of information within the post summary. The micro view forces the smallest breakpoint layout in any context, stacking the meta data on top and putting everything into a single column.</p>
<div class="stacks-preview">
{% highlight html %}
<div class="s-post-summary s-post-summary__micro">
<div class="s-post-summary--stats">
<div class="s-post-summary--stats-item">
@Svg.CheckmarkSm
<span class="s-post-summary--stats-item-number">
</span>
<span class="s-post-summary--stats-item-unit">
answers
</span>
</div>
</div>
<div class="s-post-summary--content">
<h3 class="s-post-summary--content-title">
<a href="…">…</a>
</h3>
<div class="s-post-summary--meta">
<div class="s-user-card s-user-card__micro">
<time class="s-user-card--time">…</time>
</div>
</div>
<a href="#" class="s-btn s-btn__muted s-post-summary--content-menu-button">
{% icon "EllipsisVertical" %}
</a>
</div>
</div>
{% endhighlight %}
<div class="stacks-preview--example p0">
<div class="s-post-summary s-post-summary__micro">
<div class="s-post-summary--stats">
<div class="s-post-summary--stats-item">
<span class="s-post-summary--stats-item-number">
0
</span>
<span class="s-post-summary--stats-item-unit">
answers
</span>
</div>
</div>
<div class="s-post-summary--content">
<h3 class="s-post-summary--content-title">
<a href="#">Clicking through a viewpager2?</a>
</h3>
</div>
</div>
<div class="s-post-summary s-post-summary__micro">
<div class="s-post-summary--stats">
<div class="s-post-summary--stats-item has-answers">
<span class="s-post-summary--stats-item-number">
1
</span>
<span class="s-post-summary--stats-item-unit">
answer
</span>
</div>
</div>
<div class="s-post-summary--content">
<h3 class="s-post-summary--content-title">
<a href="#">What permissions does github_token require for releases from a github action</a>
</h3>
<div class="s-post-summary--meta">
<div class="s-user-card s-user-card__minimal">
<time class="s-user-card--time">Apr 1</time>
</div>
</div>
<a href="#" class="s-btn s-btn__muted s-post-summary--content-menu-button">
{% icon "EllipsisVertical" %}
</a>
</div>
</div>
<div class="s-post-summary s-post-summary__micro">
<div class="s-post-summary--stats">
<div class="s-post-summary--stats-item has-answers has-accepted-answer">
<span class="s-post-summary--stats-item-number">
32
</span>
<span class="s-post-summary--stats-item-unit">
answer
</span>
</div>
</div>
<div class="s-post-summary--content">
<h3 class="s-post-summary--content-title">
<a href="#">Parentheses is Invalid Bash</a>
</h3>
<div class="s-post-summary--meta">
<div class="s-user-card s-user-card__minimal">
<time class="s-user-card--time">Mar 25, 2022</time>
</div>
</div>
<a href="#" class="s-btn s-btn__muted s-post-summary--content-menu-button">
{% icon "EllipsisVertical" %}
</a>
</div>
</div>
</div>
</div>

{% header "h3", "Legacy" %}
<p class="stacks-copy">If you only need to display the original three stats and don’t need to interleave different content types, a legacy layout may be appropriate. This view is considered deprecated and will not receive updates. Care will be needed to move bounties to within the title block.</p>
<div class="stacks-preview">
Expand Down
58 changes: 57 additions & 1 deletion lib/css/components/post-summary.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
}

#stacks-internals #screen-md({
flex-direction: column;
&:not(.s-post-summary__micro) {
flex-direction: column;
}
});

&.s-post-summary__minimal {
Expand All @@ -35,6 +37,60 @@
}
}

&.s-post-summary__micro {
align-items: center;
border-bottom: none;
gap: var(--su12);
padding: var(--su8) var(--su12);

.s-post-summary--stats {
align-items: center;
flex-direction: row;
font-size: var(--fs-caption);
margin: 0;
width: auto;

.s-post-summary--stats-item {
border-radius: var(--br-sm);
padding: calc(var(--su2) + var(--su1)) var(--su4);
width: calc(var(--su32) + var(--su6));

&:not(.has-answers) {
border: 1px solid var(--black-150);
}
}
}
.s-post-summary--stats-item-unit {
.v-visible-sr;
}
.s-post-summary--content {
align-items: center;
display: flex;
flex-direction: row;
gap: var(--su12);
}
.s-post-summary--content-title{
flex-grow: 1;
font-size: var(--fs-body1);
margin-bottom: 0;

a {
.v-truncate2;
}
}
.s-post-summary--content-menu-button {
margin: calc(var(--su6) * -1);
inset: initial;
padding: var(--su6) !important;
position: relative !important;
}
.s-post-summary--meta {
.s-user-card {
flex-wrap: nowrap;
}
}
}

&.s-post-summary__legacy {
padding-left: 0; // Since stats have padding, we don't need it on the parent

Expand Down