Skip to content

Commit

Permalink
Refresh: Add springboard component (Fix #15305) (#15448)
Browse files Browse the repository at this point in the history
* Refresh: Add springboard component (Fix #15305)

- add springboard component
- use springboard component for links to media about AI
- update launchpad component to use same technique for the partial top/bottom borders
- add and use variables for transition easing and speed
  • Loading branch information
stephaniehobson authored Nov 20, 2024
1 parent 696d846 commit e775d32
Show file tree
Hide file tree
Showing 24 changed files with 406 additions and 24 deletions.
44 changes: 44 additions & 0 deletions bedrock/base/templates/macros-m24.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,47 @@
</a>
</div>
{%- endmacro %}

{#
Springboard Item
HTML Import: {% from "macros-m24.html" import springboard_item with context %}
CSS Import: @import '[path to]/m24/foo';
Description: The springboard component links off to media (i.e. articles, podcasts, and videos) on other sites. Each item is a row.
Macro Parameters:
author: Author of the media.
class: String providing modifier class(es) to the item.
image: Thumbnail image. Can pass an <img> element, resp_img or picture Python helpers.
link_attributes: A generic parameter to add any extra attributes to the CTA link, such as target, rel, or data attributes for GA tracking. Note that the quotes will pass through unescaped.
link_url (Required): String or url helper function provides href value for item.
preview: Blurb / summary of the media.
topic: One or two word topic of the item. Perhaps one of the things the item is "tagged" with if it's a blog post.
type: (Should be translated) Type of media the item links to. Probably one of podcast, article, video.
type_icon: (Do not translate) Last word of the icon class. Must be configured in the CSS. Currently supports: podcast, article, video.
#}
{% macro springboard_item(
author=None,
class=None,
image=None,
link_attributes=None,
link_url=None,
preview=None,
topic=None,
type=None,
type_icon=''
) -%}

<li class="m24-c-springboard-item {{ class }}">
<a href="{{ link_url }}" class="m24-c-springboard-link" {{ link_attributes }}>
<div class="m24-c-springboard-thumb">
{{ image }}
</div>
<div class="m24-c-springboard-type">
{% if type_icon %}<span class="m24-c-springboard-icon m24-c-springboard-icon-{{ type_icon|lower }}"></span>{% endif %}
{{ type }}
</div>
<div class="m24-c-springboard-author">{{ author }}</div>
<div class="m24-c-springboard-topic">{{ topic }}</div>
<div class="m24-c-springboard-preview">{{ preview }}</div>
</a>
</li>
{%- endmacro %}
1 change: 1 addition & 0 deletions bedrock/mozorg/templates/mozorg/home/home-m24.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
{% include 'mozorg/home/includes/m24/products.html'%}
{% include 'mozorg/home/includes/m24/donate.html'%}
{% include 'mozorg/home/includes/m24/ai-grid.html'%}
{% include 'mozorg/home/includes/m24/media-springboard.html'%}
{% include 'mozorg/home/includes/m24/showcase.html'%}
{% include 'mozorg/home/includes/m24/resources-grid.html'%}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{% from "macros-m24.html" import grid_tile with context %}

<section class="m24-section-ai m24-t-dark m24-t-transition-01 m24-t-transition-next">
<section class="m24-section-ai m24-t-dark">
<div class="m24-c-content">
<header class="m24-c-intro">
<h2 class="m24-c-intro-title">Join the movement: <br>AI for the people</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{#
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.
#}

{% from "macros-m24.html" import grid_tile, springboard_item with context %}

<section class="m24-c-content m24-t-transition-01 m24-t-transition-next" id="media">
<h3 class="m24-c-intro-title m24-t-lg">You, AI and the internet — what’s really going on?</h3>
<ul class="m24-c-springboard" id="ai-media">
<li class="m24-c-springboard-item m24-c-springboard-headings">
<div class="m24-c-springboard-link">
<div class="m24-c-springboard-thumb">
</div>
<div class="m24-c-springboard-type">Type</div>
<div class="m24-c-springboard-author">Author</div>
<div class="m24-c-springboard-topic">Topic</div>
<div class="m24-c-springboard-preview">Intro</div>
</a>
</li>
{{ springboard_item(
link_url='https://blog.mozilla.org/en/mozilla/mozilla-anonym-raising-the-bar-for-privacy-preserving-digital-advertising/',
type='Article',
type_icon='article',
topic='Artificial Intelligence',
author='Laura Chambers',
preview='Introducing Anonym: Raising the bar for privacy-preserving digital advertising.',
image=resp_img(
url="img/home/2024/media/chambers.jpg",
optional_attributes={
"loading": "lazy",
"alt": "",
"height": "32",
"width": "32"
})
) }}
{{ springboard_item(
link_url='https://blog.mozilla.org/en/mozilla/keeping-genai-technologies-secure-is-a-shared-responsibility/',
type='Article',
type_icon='article',
topic='Privacy & Security',
author='Saoud Khalifah',
preview='Keeping GenAI technologies secure is a shared responsibility.',
image=resp_img(
url="img/home/2024/media/khalifah.jpg",
optional_attributes={
"loading": "lazy",
"alt": "",
"height": "32",
"width": "32"
})
) }}
{{ springboard_item(
link_url="https://irlpodcast.org/season7/episode5/",
type='Podcast',
type_icon='podcast',
topic='Artificial Intelligence',
author='IRL Podcast',
preview='From Hollywood to Hip Hop, artists are negotiating consent for use of AI in the creative industries. Bridget Todd speaks to artists who are pushing the boundaries.',
image=resp_img(
url="img/home/2024/media/irl-green.png",
optional_attributes={
"loading": "lazy",
"alt": "",
"height": "32",
"width": "32"
})
) }}
{{ springboard_item(
link_url="https://blog.mozilla.org/en/products/firefox/new-mozilla-docuseries-firefox-presents-launch/",
type='Video',
type_icon='video',
topic='News',
author='Rebecca Smith',
preview='Mozilla celebrates groundbreaking creators in new docuseries ‘Firefox Presents’.',
image=resp_img(
url="img/home/2024/media/smith.jpg",
optional_attributes={
"loading": "lazy",
"alt": "",
"height": "32",
"width": "32"
})
) }}
{{ springboard_item(
link_url="https://irlpodcast.org/season7/episode4/",
type='Podcast',
type_icon='podcast',
topic='Artificial Intelligence',
author='IRL Podcast',
preview='Big tech’s power over language, means power over people. Bridget Todd talks to language community leaders paving the way for voice AI in their own languages and dialects.',
image=resp_img(
url="img/home/2024/media/irl-pink.png",
optional_attributes={
"loading": "lazy",
"alt": "",
"height": "32",
"width": "32"
})
) }}
{{ springboard_item(
link_url="https://irlpodcast.org/season7/episode3/",
type='Podcast',
type_icon='podcast',
topic='Artificial Intelligence',
author='IRL Podcast',
preview='Why does it so often feel like we’re part of a mass AI experiment? What is the responsible way to test new technologies? Bridget Todd explores what it means to live with unproven AI systems that impact millions of people as they roll out across public life.',
image=resp_img(
url="img/home/2024/media/irl-orange.png",
optional_attributes={
"loading": "lazy",
"alt": "",
"height": "32",
"width": "32"
})
) }}
{{ springboard_item(
link_url="https://blog.mozilla.org/en/internet-culture/kids-mental-health-screen-time-technology/",
type='Article',
type_icon='article',
topic='Privacy & Security',
author='Kristina Bravo',
preview='Kids are growing up in a very online world. What’s a concerned parent to do?',
image=resp_img(
url="img/home/2024/media/bravo.jpg",
optional_attributes={
"loading": "lazy",
"alt": "",
"height": "32",
"width": "32"
})
) }}
</ul>
</section>
1 change: 1 addition & 0 deletions media/css/m24/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@import 'gallery';
@import 'showcase';
@import 'launchpad';
@import 'springboard';
@import 'theme';
@import 'transition';

Expand Down
37 changes: 21 additions & 16 deletions media/css/m24/launchpad.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,32 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

$logo-spacing: calc(32px + #{$spacer-md});
$launchpad-logo-width: 32px;
$launchpad-logo-spacing: calc($launchpad-logo-width + #{$spacer-lg});

.m24-c-launchpad {
margin: $spacer-xl 0;
}

.m24-c-launchpad-item {
border-bottom: $border-width solid $m24-color-light-gray;
margin-bottom: 0;
.m24-c-launchpad-item:first-child {
border-top: $border-width solid transparent; // accommodates negative margin needed for @include short-dividers();
}

.m24-c-content &:last-child {
margin-bottom: 0;
}
}

.m24-c-launchpad-link {
@include short-dividers($m24-color-light-gray);
@include grid;
background-color: $m24-color-white;
color: $m24-color-black;
display: grid;
gap: $spacer-2xs $grid-gutter;
margin-left: calc($container-padding * -1);
margin-right: calc($container-padding * -1);
padding: $spacer-sm $container-padding;
position: relative;
text-decoration: none;
transition: background-color 100ms ease-in-out;
transition: background-color $fast $bezier;

&:hover,
&:link:active, // override protocol
Expand All @@ -48,8 +53,8 @@ $logo-spacing: calc(32px + #{$spacer-md});
(left, $container-padding, auto),
(right, auto, $container-padding),
));
background-size: 32px auto;
width: 48px;
background-size: $launchpad-logo-width auto;
width: $launchpad-logo-width;
}

&::after {
Expand All @@ -62,8 +67,8 @@ $logo-spacing: calc(32px + #{$spacer-md});
background-image: url('/media/img/icons/m24-small/arrow-right.svg');
background-size: 18px auto;
transition-duration: 100ms;
transition-timing-function: ease-in-out;
width: 32px;
transition-timing-function: $bezier;
width: $launchpad-logo-width;
}

&:focus-visible::after,
Expand Down Expand Up @@ -102,8 +107,8 @@ $logo-spacing: calc(32px + #{$spacer-md});

.m24-c-launchpad-title {
@include bidi((
(padding-left, $logo-spacing, 0),
(padding-right, 0, $logo-spacing),
(padding-left, $launchpad-logo-spacing, 0),
(padding-right, 0, $launchpad-logo-spacing),
));
color: $m24-color-black;
display: inline-block;
Expand All @@ -117,7 +122,7 @@ $logo-spacing: calc(32px + #{$spacer-md});
color: $m24-color-dark-gray;
font-size: $text-body-lg;
grid-column: 1 / span 11;
padding-left: $logo-spacing;
padding-left: $launchpad-logo-spacing;
}

@media #{$mq-lg} {
Expand All @@ -127,7 +132,7 @@ $logo-spacing: calc(32px + #{$spacer-md});
}

.m24-c-launchpad-info {
grid-column: 4 / 11;
grid-column: 4 / 12;
padding-left: 0;
align-content: end;
}
Expand Down
Loading

0 comments on commit e775d32

Please sign in to comment.