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(front): enhances post summary with markdown and typefaces for em… #794

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion front/src/lib/components/posts/Post.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@
title={updatedAt ? `Updated ${up}` : false}>{pub}</time
>
{#if summary}
<p class="summary">{summary}</p>
<div class="summary">
<SvelteMarkdown
source={summary}
renderers={{ link: Link, heading: PostHeading }}
on:parsed={handleParsed}
/>
</div>
{/if}
{#if content}
{#each content as c, i}
Expand Down
4 changes: 2 additions & 2 deletions front/src/lib/styles/base/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
}

.post {
.summary::first-letter {
.summary p::first-letter {
color: var(--highlight-clr);
}
.pubdate {
Expand Down Expand Up @@ -688,7 +688,7 @@
@media screen and (max-width: 639px) {
background-color: var(--bg-clr);
}
.summary::first-letter {
.summary p::first-letter {
color: var(--highlight-clr);
}
.pubdate {
Expand Down
71 changes: 47 additions & 24 deletions front/src/lib/styles/pages/post.css
Original file line number Diff line number Diff line change
Expand Up @@ -177,25 +177,8 @@
}
}
}

.post .summary {
@apply dg--font-lb;
text-wrap: pretty;
margin: 0;
padding: 1.5rem 1rem 1rem 1rem;
font-size: 1.2rem;
font-size: 1rem;
text-indent: 0;
@media screen and (min-width: 480px) {
padding-right: 1.75rem;
padding-left: 1.75rem;
}
@media screen and (min-width: 640px) {
font-size: 1.2rem;
}
}
@supports (initial-letter: 2) {
.post .summary::first-letter {
.post .summary p::first-letter {
@apply dg--font-lbb;
-webkit-initial-letter: 2;
initial-letter: 2;
Expand All @@ -205,7 +188,7 @@
}
}
@supports not (initial-letter: 2) {
.post .summary::first-letter {
.post .summary p::first-letter {
@apply dg--font-lbb;
vertical-align: middle;
float: left;
Expand Down Expand Up @@ -240,11 +223,6 @@
@media screen and (min-width: 768px) {
margin-bottom: -2rem;
}
a {
transition-duration: var(--transition-duration);
transition-property: border, color;
transition-timing-function: var(--transition-timing-function);
}
.post-heading {
position: relative;
.heading-anchor-link {
Expand Down Expand Up @@ -279,6 +257,51 @@
}
}
}
.summary {
@apply dg--font-lb;
text-wrap: pretty;
margin: 0;
padding: 1.5rem 1rem 1rem 1rem;
font-size: 1.2rem;
font-size: 1rem;
text-indent: 0;
@media screen and (min-width: 480px) {
padding-right: 1.75rem;
padding-left: 1.75rem;
}
@media screen and (min-width: 640px) {
font-size: 1.2rem;
}
p {
margin: 0;
em {
font-family: var(--font-lb);
}
strong,
em strong,
strong em {
font-weight: 700;
font-family: var(--font-lbb);
}
}
}
p {
em {
font-family: var(--font-psxl);
}
strong {
font-family: var(--font-psb);
}
strong em,
em strong {
font-family: var(--font-psb);
}
}
a {
transition-duration: var(--transition-duration);
transition-property: border, color;
transition-timing-function: var(--transition-timing-function);
}
h2:first-of-type {
margin-top: 0;
padding-top: 1rem;
Expand Down
Loading