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

Patch headline eyebrow link #128

Merged
merged 4 commits into from
Jan 7, 2025
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# @UrbanInstitute/dataviz-components Changelog

## Next
- Patch: Headline eyebrows in Drupal include a link to the Story or Data tool homepage; tweaked Headline component to do the same.
- Fix: CSS Theme variable --color-green was #ffb748, which is a kind of yellow. Changed to match style guide.

## v0.12.4
Expand Down
38 changes: 26 additions & 12 deletions src/lib/Headline/Headline.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
export let description = null;

/**
* Optional eyebrow to be displayed above the headline.
* Optional eyebrow to be displayed above the headline. Determines eyebrow link.
* @type {string | null}
*/
export let eyebrow = null;
Expand Down Expand Up @@ -55,32 +55,42 @@
<div class="headline-wrap {variant}">
{#if $$slots.eyebrow}
<!--
Optional slot for custom content in the eyebrow slot.
-->
Optional slot for custom content in the eyebrow slot.
-->
<slot name="eyebrow" />
{:else if eyebrow}
<p class="headline-eyebrow">{eyebrow}</p>
{#if eyebrow.toLowerCase() == "data tool"}
<a href="https://www.urban.org/data-tools" target="_blank"
><p class="headline-eyebrow">{eyebrow}</p></a
>
{:else if eyebrow.toLowerCase() == "story"}
<a href="https://www.urban.org/stories" target="_blank"
><p class="headline-eyebrow">{eyebrow}</p></a
>
{:else}
<p class="headline-eyebrow">{eyebrow}</p>
{/if}
{/if}
{#if $$slots.headline}
<!--
Optional slot for custom content in the headline slot.
-->
Optional slot for custom content in the headline slot.
-->
<slot name="headline" />
{:else}
<h1 class="headline-page-headline">{headline}</h1>
{/if}
{#if $$slots.description}
<!--
Optional slot for custom content in the description slot.
-->
Optional slot for custom content in the description slot.
-->
<slot name="description" />
{:else if description}
<p class="headline-description">{description}</p>
{/if}
{#if $$slots.date}
<!--
Optional slot for custom content in the date slot.
-->
Optional slot for custom content in the date slot.
-->
<slot name="date" />
{:else if date}
<p class="headline-date">
Expand All @@ -91,8 +101,8 @@
</p>
{/if}
<!--
Optional slot for extra content to include below the date and above the share buttons.
-->
Optional slot for extra content to include below the date and above the share buttons.
-->
<slot name="extra" />
<hr class="headline-rule" />
</div>
Expand Down Expand Up @@ -148,4 +158,8 @@
font-size: var(--font-size-small);
text-transform: uppercase;
}
.headline-wrap p.headline-eyebrow:hover {
text-decoration: underline;
cursor: pointer;
}
</style>