This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #572 from B77Mills/AddAuthorBiosBlock
Add author bios block for bottom of content pages
- Loading branch information
Showing
6 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/marko-web-theme-monorail/components/blocks/author-bios.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import defaultValue from "@parameter1/base-cms-marko-core/utils/default-value"; | ||
|
||
$ const { authors } = input; | ||
$ const title = defaultValue(input.title, "About the Author"); | ||
$ const pluralTitle = defaultValue(input.pluralTitle, "About the Authors"); | ||
|
||
<if(authors)> | ||
<marko-web-node-list | ||
inner-justified=true | ||
flush-x=true | ||
flush-y=false | ||
modifiers=["author-bios"] | ||
> | ||
<@header> | ||
<if(authors.lenngth > 1)> | ||
${pluralTitle} | ||
</if> | ||
<else> | ||
${title} | ||
</else> | ||
</@header> | ||
<@nodes nodes=authors> | ||
<@slot|{ node }|> | ||
<theme-author-bio-node node=node /> | ||
</@slot> | ||
</@nodes> | ||
</marko-web-node-list> | ||
</if> |
3 changes: 3 additions & 0 deletions
3
packages/marko-web-theme-monorail/components/blocks/marko.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/marko-web-theme-monorail/components/nodes/author-bio.marko
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { buildImgixUrl } from "@parameter1/base-cms-image"; | ||
import defaultValue from "@parameter1/base-cms-marko-core/utils/default-value"; | ||
import { getAsObject } from "@parameter1/base-cms-object-path"; | ||
|
||
$ const node = getAsObject(input, "node"); | ||
$ const blockName = defaultValue(input.blockName, "author-bio-node"); | ||
$ const cta = defaultValue(input.cta, "View Bio"); | ||
|
||
<marko-web-block name=blockName> | ||
$ const { primaryImage } = node; | ||
<if(primaryImage && primaryImage.src)> | ||
$ const src = buildImgixUrl(primaryImage.src, { | ||
w: 96, | ||
h: 96, | ||
crop: "faces", | ||
fit: "crop", | ||
}); | ||
$ const srcset = [`${buildImgixUrl(src, { dpr: 2 })} 2x`]; | ||
<marko-web-img | ||
src=src | ||
srcset=srcset | ||
alt=primaryImage.alt | ||
class="author-bio-node__image" | ||
link={ href: node.siteContext.path } | ||
/> | ||
</if> | ||
<marko-web-element block-name=blockName name="details"> | ||
<marko-web-content-name block-name=blockName obj=node link=true /> | ||
<marko-web-content-title block-name=blockName obj=node /> | ||
<marko-web-content-teaser block-name=blockName obj=node /> | ||
<marko-web-link | ||
class=`${blockName}__cta btn btn-primary` | ||
href=node.siteContext.path | ||
title=`View ${node.name}'s Bio` | ||
> | ||
${cta} | ||
</marko-web-link> | ||
</marko-web-element> | ||
</marko-web-block> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/marko-web-theme-monorail/scss/components/_author-bio-node.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
.node-list { | ||
&--author-bios { | ||
background-color: $gray-200; | ||
padding-left: map-get($spacers, block); | ||
padding-right: map-get($spacers, block); | ||
margin-bottom: map-get($spacers, block); | ||
} | ||
} | ||
.author-bio-node { | ||
display: flex; | ||
align-items: center; | ||
margin-top: 17px; | ||
|
||
&__image { | ||
$size: 96px; | ||
width: $size; | ||
height: $size; | ||
margin-right: 10px; | ||
border-radius: $size; | ||
} | ||
|
||
&__content-name { | ||
@include skin-typography($style: "author-content-page", $link-style: "primary"); | ||
} | ||
|
||
&__content-teaser { | ||
@include media-breakpoint-down(md) { | ||
display: none; | ||
} | ||
} | ||
|
||
&__cta { | ||
margin-top: map-get($spacers, 2); | ||
} | ||
} | ||
|
||
.inline-author-bio { | ||
&__content-body { | ||
margin-bottom: 18px; | ||
font-size: 16px; | ||
font-style: italic; | ||
|
||
@include media-breakpoint-up(md) { | ||
font-size: 18px; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters