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

feat: new about page #12069

Merged
merged 31 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f23ff16
chore: move copy to external generic-content repo
LeoMcA Oct 31, 2024
a374ad8
wip(about): first draft of about page
LeoMcA Oct 31, 2024
87ababf
wip(about): add our partners tab
LeoMcA Nov 8, 2024
91b8b00
wip(about): various design fixes
LeoMcA Nov 11, 2024
c8704a4
wip(about): fix sass deprecation
LeoMcA Nov 11, 2024
9bc4cec
Merge remote-tracking branch 'origin/main' into new-about-page
LeoMcA Nov 12, 2024
88e5e1b
wip(about): various updates inc. updating images to mdn.dev
LeoMcA Nov 13, 2024
22700df
wip(about): scroll to top of tab and add glean ping
LeoMcA Nov 14, 2024
9a7a5f0
wip(about): add border and fix react errors
LeoMcA Nov 19, 2024
480933c
Merge remote-tracking branch 'origin/main' into new-about-page
LeoMcA Nov 22, 2024
cbff4ec
fix(about): make external links open in new tab and lazy load images
LeoMcA Nov 22, 2024
93d8534
fix(about): fix problems in responsive team profiles
LeoMcA Nov 27, 2024
c3866ac
Merge remote-tracking branch 'origin/main' into new-about-page
LeoMcA Nov 27, 2024
f5519dd
wip(about): various fixes inc subgrid stuff
LeoMcA Nov 28, 2024
9761551
Merge remote-tracking branch 'origin/main' into new-about-page
LeoMcA Nov 28, 2024
2e76945
fix(generic-content): ssr about and community page
LeoMcA Nov 28, 2024
ade5d6f
fix(generic-content): ssr community page
LeoMcA Nov 28, 2024
3d37cee
fix(generic-content): fix lint
LeoMcA Nov 28, 2024
66072d1
Merge remote-tracking branch 'origin/main' into generic-content
LeoMcA Nov 28, 2024
c914636
Merge remote-tracking branch 'origin/generic-content' into new-about-…
LeoMcA Nov 28, 2024
7e1933d
Merge remote-tracking branch 'upstream/main' into new-about-page
fiji-flo Nov 29, 2024
6c396d4
feat(about): histroy images from md + id=content
fiji-flo Dec 2, 2024
335a12e
fix(about): focus states (#12225)
fiji-flo Dec 4, 2024
86451cd
wip(about): migrate custom elements to ts in jsdoc
LeoMcA Dec 4, 2024
99d3e9d
fix(about): allow clicking links to other parts of the page within bi…
LeoMcA Dec 4, 2024
34ec25b
Merge remote-tracking branch 'origin/main' into generic-content
LeoMcA Dec 6, 2024
62d8bce
remove generic content PAT, repo is public
LeoMcA Dec 6, 2024
df7fc69
delete newly added file from copy
LeoMcA Dec 6, 2024
e993a01
Merge branch 'generic-content' into new-about-page
LeoMcA Dec 6, 2024
6bf3a2e
Merge remote-tracking branch 'origin/main' into new-about-page
LeoMcA Dec 6, 2024
8c1709f
fix tsc
LeoMcA Dec 6, 2024
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
10 changes: 9 additions & 1 deletion build/spas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ import {
} from "../libs/env/index.js";
import { isValidLocale } from "../libs/locale-utils/index.js";
import { DocFrontmatter, DocParent, NewsItem } from "../libs/types/document.js";
import { getSlugByBlogPostUrl, makeTOC } from "./utils.js";
import {
getSlugByBlogPostUrl,
injectLoadingLazyAttributes,
makeTOC,
postProcessExternalLinks,
} from "./utils.js";
import { findByURL } from "../content/document.js";
import { buildDocument } from "./index.js";
import { findPostBySlug } from "./blog.js";
Expand Down Expand Up @@ -309,6 +314,8 @@ export async function buildSPAs(options: {
};
const [$] = await kumascript.render(url, {}, d);
wrapTables($);
postProcessExternalLinks($);
injectLoadingLazyAttributes($);
const [sections] = await extractSections($);
const toc = makeTOC({ body: sections });

Expand Down Expand Up @@ -355,6 +362,7 @@ export async function buildSPAs(options: {
OBSERVATORY_TITLE
);
await buildStaticPages(path.join(GENERIC_CONTENT_ROOT, "community"));
await buildStaticPages(path.join(GENERIC_CONTENT_ROOT, "about"));
}

// Build all the home pages in all locales.
Expand Down
282 changes: 282 additions & 0 deletions client/src/about/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,282 @@
@use "../ui/vars" as *;
@use "../ui/atoms/button/mixins" as button;

@mixin theme-setup {
.light & {
@content (light);
}

.dark & {
@content (dark);
}

// OS Default.
:root:not(.light):not(.dark) & {
@media (prefers-color-scheme: light) {
@content (light);
}

@media (prefers-color-scheme: dark) {
@content (dark);
}
}
}

@mixin layout {
h2,
h3,
p {
margin: 0;
}

h2,
h3 {
color: var(--layout-text-primary);

a {
color: unset;
text-decoration: none;
}
}

a {
text-decoration: underline;

&:hover {
text-decoration: none;
}
}

p + p {
margin-top: 1.5rem;
}

section {
margin-left: auto;
margin-right: auto;
max-width: var(--max-width);
padding-left: var(--gutter);
padding-right: var(--gutter);
width: 100%;
}

h2 {
font-size: 2rem;
font-weight: 600;
margin-bottom: 1rem;

@media (max-width: $screen-md) {
font-size: 1.375rem;
}
}
}

@mixin header {
background: linear-gradient(
to top,
var(--header-next-section-bg, transparent) 0%,
var(--header-next-section-bg, transparent)
calc(var(--header-stats-height) / 2),
var(--header-bg) calc(var(--header-stats-height) / 2),
var(--header-bg) 100%
);

@media (max-width: $screen-md) {
padding-top: 1rem;
}

section {
padding-top: 5rem;

@media (max-width: $screen-md) {
padding-top: 0;
}
}

h1 {
color: var(--header-text-primary);
font-size: 2.5rem;
margin-bottom: 1rem;

@media (max-width: $screen-md) {
font-size: 2rem;
}
}

p {
color: var(--header-text-secondary);
margin-bottom: 1.5rem;
}

+ section {
margin-top: 4.56rem;

@media (max-width: $screen-md) {
margin-top: 2rem;
}
}
}

@mixin stats {
background: var(--stats-bg);
border-radius: 0.5rem;
box-shadow: var(--stats-box-shadow);
color: var(--stats-text-primary);
display: flex;
gap: 1rem;
justify-content: space-around;
margin-top: 5em;
padding: 1rem;
position: relative;
text-align: center;
z-index: 2;

@media (max-width: $screen-md) {
flex-wrap: wrap;
margin-top: 2rem;
}

li {
align-items: baseline;
column-gap: 1rem;
display: flex;
flex-wrap: wrap;
justify-content: center;
min-width: 7.75rem;
overflow-wrap: anywhere;

@media (max-width: $screen-md) {
align-items: center;
flex: 1;
flex-direction: column;
justify-content: flex-start;
}

strong {
align-items: center;
background: var(--stats-stat-bg);
border-radius: 50%;
color: var(--stats-stat-text);
display: inline-flex;
height: 3.75rem;
justify-content: center;
width: 3.75rem;
}
}
}

@mixin section {
column-gap: min(5rem, 5vw);
display: grid;
grid-template-columns: 4fr 6fr;

@media (max-width: $screen-md) {
display: block;
}

> * {
min-width: 0;
}
}

@mixin boxes {
display: grid;
gap: 2rem;
grid-auto-rows: 1fr;
grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));

li {
align-items: center;
background: var(--boxes-bg);
border: 1px solid var(--boxes-border);
border-radius: 0.5rem;
box-shadow: var(--boxes-shadow);
display: flex;
flex-direction: column;
gap: 1.5rem;
justify-content: space-between;
padding: 1.5rem;
text-align: center;

h3,
h4,
h5,
h6 {
align-self: stretch;
background: var(--boxes-header-bg);
border-radius: 0.5rem 0.5rem 0 0;
color: var(--boxes-header-color);
font-size: 1.25rem;
font-weight: 500;
margin: -1.5rem;
margin-bottom: 0;
padding: 1.5rem;
}

p {
color: var(--boxes-main-color);
margin: 0;
}
}
}

@mixin stairs {
--stairs-icon-size: 3.125rem;
--stairs-step-indent: 3.125rem;
--stairs-step-gap: 4rem;

li {
--stairs-padding-left: calc(var(--stairs-step-indent) * var(--nth-child));
align-items: center;
display: flex;
gap: 1rem;
padding-left: var(--stairs-padding-left);
position: relative;

@media (max-width: $screen-md) {
--stairs-step-indent: 0;
--stairs-padding-left: var(--stairs-icon-size);
--stairs-step-gap: 1rem;
}

&:not(:last-of-type) {
margin-bottom: var(--stairs-step-gap);
}

&::before {
background: var(--stairs-color);
content: "";
display: block;
flex-shrink: 0;
height: var(--stairs-icon-size);
margin-left: calc(-1 * var(--stairs-icon-size));
mask-image: var(--stairs-icon);
mask-position: center;
mask-repeat: no-repeat;
mask-size: 80%;
width: var(--stairs-icon-size);
}

&:not(:last-of-type)::after {
--height: calc(var(--stairs-step-gap) * 1.2);
background: linear-gradient(to bottom, var(--stairs-color), transparent);
bottom: calc(-1 * var(--height));
content: "";
display: block;
height: var(--height);
left: calc(var(--stairs-padding-left) - 50px);
mask: url("../assets/lines.svg");
mask-position: center;
mask-repeat: no-repeat;
mask-size: contain;
position: absolute;
width: calc(var(--stairs-icon-size) + var(--stairs-step-indent));
}
}

@for $i from 1 through 4 {
li:nth-child(#{$i}) {
--nth-child: #{$i};
}
}
}
76 changes: 76 additions & 0 deletions client/src/about/custom-elements.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { LitElement } from "lit";

export class MDNImageHistory extends LitElement {
createRenderRoot() {
return this;
}

firstUpdated() {
this.renderRoot.querySelectorAll("img").forEach((img) => {
const regex = /@([0-9]+(?:\.[0-9]+)?)(?=x\.[a-z]+$)/;
const match = img.src.match(regex);
if (match?.[1]) {
const baseRes = parseFloat(match[1]);
const dpis = [1, 2];
img.srcset = dpis
.map(
(dpi) => `${img.src.replace(regex, `@${baseRes * dpi}`)} ${dpi}x`
)
.join(", ");
}
});
}
}

customElements.define("mdn-image-history", MDNImageHistory);

export class TeamMember extends LitElement {
_setID() {
const hx = this.querySelector("h4, h5");
const panel = hx?.closest(".tabpanel");
if (hx && panel) {
const id = `${panel.id.replace("-panel", "")}_${hx.id}`;
if (this.id !== id) {
this.id = id;
}
}
}

/** @param {FocusEvent} ev */
_focusin({ currentTarget }) {
if (currentTarget instanceof HTMLElement) {
window.history.pushState({}, "", `#${currentTarget.id}`);
this.scrollIntoView({ block: "nearest", inline: "nearest" });
}
}

/** @param {MouseEvent} ev */
_mousedown(ev) {
if (ev.target instanceof HTMLAnchorElement) {
ev.preventDefault();
}
}

createRenderRoot() {
return this;
}

connectedCallback() {
super.connectedCallback();
this.tabIndex = 0;
this._setID();
this.addEventListener("mousedown", this._mousedown);
this.addEventListener("focusin", this._focusin);
if (window.location.hash === `#${this.id}`) {
setTimeout(() => this.focus(), 0);
}
}

disconnectedCallback() {
super.disconnectedCallback();
this.removeEventListener("mousedown", this._mousedown);
this.removeEventListener("focusin", this._focusin);
}
}

customElements.define("team-member", TeamMember);
Loading
Loading