Story 2127: Learn Page Implementation#2243
Conversation
|
Image hosting: I am working on a script to facilitate very easy uploads to S3. Should be ready today. The folder in S3 will be S3://bucketname/static/img/v3 and matches the same path as in the website-v2 repo. (/static/img/) In fact, that S3 directory already exists with some files in it. Anything in /static/ could be hosted there, but the main purpose is large images. hopefully this pull request can be revised to use the new method. |
julioest
left a comment
There was a problem hiding this comment.
Good stuff, Jeremy!
I tested across breakpoints and noticed a couple of things in the masonry section:
- Post cards and basic card have
max-width: 458px, but Figma shows488px(pre-existing inpost-cards.cssandcard.css). - The
.card-masonrygrid hasjustify-items: startandwidth: fit-content, which prevents cards from filling their columns. On tablet/mobile they end up narrow and off-center. Swapping towidth: 100%and droppingjustify-items: start(so it defaults to stretch) fixes it. Also needmax-width: 100%on.post-cardsand.basic-cardinside.card-masonryso they can stretch past their default cap.
Not sure, if we'd rather address them here or in a follow-up PR
Here's the diff of what worked on my end:
diff --git a/static/css/v3/card.css b/static/css/v3/card.css
--- a/static/css/v3/card.css
+++ b/static/css/v3/card.css
@@ -22,7 +22,7 @@
}
.basic-card {
- max-width: 458px;
+ max-width: 488px;
}
diff --git a/static/css/v3/learn-page.css b/static/css/v3/learn-page.css
--- a/static/css/v3/learn-page.css
+++ b/static/css/v3/learn-page.css
@@ -57,8 +57,12 @@
;
row-gap: var(--space-card);
column-gap: var(--space-card);
- justify-items: start;
- width: fit-content;
+ width: 100%;
+}
+
+.card-masonry .post-cards,
+.card-masonry .basic-card {
+ max-width: 100%;
}
diff --git a/static/css/v3/post-cards.css b/static/css/v3/post-cards.css
--- a/static/css/v3/post-cards.css
+++ b/static/css/v3/post-cards.css
@@ -32,7 +32,7 @@
- max-width: 458px;
+ max-width: 488px;
@@ -104,7 +104,7 @@
- max-width: 458px;
+ max-width: 488px;
I am happy to make them stretch to match the columns, the design doesn't exactly specify. However, I am curious as to the decision to change to 488px? The basic card in the figma is 459px: https://www.figma.com/design/VhZHw3RudFNMzfPEEYchE9/UI-Kit---Foundations-Delivery?node-id=286-3590&focus-id=286-3590&m=dev |
|
In Figma the post card is 488px. Maybe I'm looking at something else? |
herzog0
left a comment
There was a problem hiding this comment.
Looking very good, thanks @jlchilders11 !!
Also thanks for removing some default CSS values and fixing some typos there.
I'm only requesting changes because of the broken img url. The non-matching designs are not a high priority I'd say, so I leave it up to you.
julhoang
left a comment
There was a problem hiding this comment.
This is looking great @jlchilders11 ! I left a few requests below 🙏
templates/v3/learn_page.html
Outdated
| {% block content %} | ||
| <div class="px-large"> | ||
| <div class="learn-page-header py-large"> | ||
| <h1>Start Anywhere. Learn Everything. Build Anything</h1> |
There was a problem hiding this comment.
Would you mind adding text-primary color to this h1? I noticed the HEX code is slightly off.
Another nit: this text should be Start anywhere. Learn everything. Build anything.
|
|
||
| .learn-card__link { | ||
| font-size: var(--font-sizes-small, 14px); | ||
| font-size: var(--font-size-small); |
There was a problem hiding this comment.
This might be out-of-scope but I think this link should be its own component, see Figma here. Feel free to leave this to a separate ticket if you don't feel like adding it here!
This current link is just missing font-weight 500 and a hover color.
There was a problem hiding this comment.
It did need some updating on styling, but I'm not sure it is used elsewhere? If it is, happy to spin it off as a separate item!
There was a problem hiding this comment.
Looking at the Figma assets, it seems to me like the mobile and desktop versions are just different "crops" of the same image. So instead of loading two separate assets, we can use one image and let CSS do the cropping for us:
Code:
.square-card-image img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center; 👈🏻 add this for focal-point
display: block;
}
Results:
| Desktop | Mobile |
|---|---|
![]() |
![]() |
There was a problem hiding this comment.
So I considered this, and it works for the octopus. However, the cheetah actually wants to be cropped to the bottom, not the center. If I understand how picture elements work properly, it should only load the actual asset that matches the media query.
| {% endfor %} | ||
| </div> | ||
| <div class="py-large three-column"> | ||
| {% include 'v3/includes/_why_boost_cards.html' with why_boost_cards=why_boost_cards %} |
There was a problem hiding this comment.
I think the h2 component from this Why Boost card has the wrong font-size, it also has a default margin that doesn't really match our spacing token, would you mind adjusting those? 🙏
There was a problem hiding this comment.
I'm happy to address the font-size, but could you clarify what you mean by the spacing? Looking at the css it seems to have margin: 0 0 var(--space-large);, which matches the design.
static/css/v3/learn-page.css
Outdated
| } | ||
|
|
||
| .learn-page-header { | ||
| max-width: 488px; |
There was a problem hiding this comment.
I think this should be 50% instead to match with the Figma intention.
| } | ||
|
|
||
| .mobile-d-none { | ||
| display: none; |
There was a problem hiding this comment.
I understand this matches Figma but at the same time I'm wondering if this is an unintentional mistake from the design 🤔. Perhaps we should double-check with Henry just to be sure.
There was a problem hiding this comment.
@henryajisegiri Any opinion on this component being hidden on mobile? (The Library Categories carousel)
4564e31 to
0f68434
Compare



Issue: #2127
Summary & Context
Adds the Learn Page layout and styling. Uses dummy data to pass to the template.
Changes
v3/learn_page.htmland stylesheetv3/learn-page.cssLearnPageViewtocore/views.pyand urlpatternv3/demo/learn-page/to coreNOTE: While implemented as fully as possible using existing components, note should be taken for the "Posts from the boost community" and "The boost community" cards, as these do not seem to exist in a 1 to 1 form in the current project.
These have been implemented as
_post_cards_v3.html, which will be updated in styling as a different item.Additionally, while a header component exists, it contains significant additional styling that is not used in this page.
Screenshots
Self-review Checklist
Frontend