-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created trusted resource component variant
- Loading branch information
Showing
5 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
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
41 changes: 41 additions & 0 deletions
41
themes/digital.gov/layouts/partials/core/trusted-resource.html
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,41 @@ | ||
{{/* ================== | ||
|
||
Trusted Resource Component | ||
|
||
Displays a rounded box for an an external resource, similar to a featured resource. | ||
Use front matter or a shortcode in markdown to display on page. | ||
|
||
@params {object} data - a dictionary object to display a resource | ||
- link - required to display an external link | ||
- title - required title of the resource | ||
- summary - required to display a short description for the resource | ||
*/}} | ||
{{ $link := .data.link }} | ||
{{ $title := .data.title }} | ||
{{ $summary := .data.summary }} | ||
|
||
{{- if $link -}} | ||
<div class="dg-featured-resource dg-featured-resource--trusted"> | ||
<a href="{{- $link -}}" class="dg-featured-resource__body"> | ||
<div class="dg-featured-resource__text"> | ||
<div class="dg-featured-resource__text-kicker"> | ||
<p>Trusted Resource</p> | ||
<img | ||
src="{{ "uswds/img/usa-icons/launch.svg" | relURL }}" | ||
alt="link" | ||
/> | ||
</div> | ||
<h2 class="dg-featured-resource__text-title"> | ||
{{ if $title }} | ||
{{ $title }} | ||
{{ end }} | ||
</h2> | ||
<p class="dg-featured-resource__text-description"> | ||
{{ if $summary }} | ||
{{ $summary }} | ||
{{ end }} | ||
</p> | ||
</div> | ||
</a> | ||
</div> | ||
{{- end -}} |
16 changes: 16 additions & 0 deletions
16
themes/digital.gov/layouts/shortcodes/trusted-resource.html
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,16 @@ | ||
{{/* ==== | ||
|
||
Shortcode for using a trusted-resource component. | ||
See themes/digital.gov/layouts/partials/core/trusted-resource.html | ||
|
||
@example | ||
{{< trusted-resource link = "https://www.ai.gov" title = "title to display" summary = "summary goes here" | ||
>}} | ||
|
||
*/}} | ||
{{ $title := (.Get "title" ) }} | ||
{{ $summary := (.Get "summary" ) }} | ||
{{ $link := (.Get "link" ) }} | ||
{{ $data := (dict "title" $title "summary" $summary "link" $link) }} | ||
|
||
{{ partial "core/trusted-resource.html" (dict "data" $data ) }} |
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
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