Skip to content

style: observatory styling #16

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

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2a1cd51
observatory styling
argl Mar 21, 2025
b542bbf
progress bar, get context from rari,
argl Mar 24, 2025
6c0d25c
more observatory styling
argl Mar 24, 2025
ef76f93
padding calculations
argl Mar 25, 2025
41ec8b1
Merge branch 'main' into layout
argl Mar 25, 2025
400456e
linter fixes
argl Mar 25, 2025
707b1c2
light/dark colors
argl Mar 25, 2025
ab044fc
enable font features optical size and alternate characters. reworked …
argl Mar 25, 2025
16a8207
text decoration for feedback and faq links
argl Mar 25, 2025
5b5162b
error messages
argl Mar 25, 2025
3fb4052
error fix
argl Mar 25, 2025
43bf102
error display
argl Mar 26, 2025
6596f23
Merge branch 'main' into layout
argl Mar 26, 2025
ff519e3
more result styling
argl Mar 26, 2025
edcf2ea
Merge branch 'main' into layout
argl Mar 26, 2025
cc39646
type fixes
argl Mar 26, 2025
e24405a
linter fixes
argl Mar 26, 2025
950ed20
rescan button styling
argl Mar 27, 2025
e054c2f
rescan button styling
argl Mar 27, 2025
7dc1e96
Update .gitignore
caugner Mar 27, 2025
a1477bc
Merge remote-tracking branch 'origin/layout' into layout
argl Mar 27, 2025
a14e1ed
results table styles
argl Mar 27, 2025
f1cac68
Merge branch 'main' into layout
argl Mar 27, 2025
920557a
Merge branch 'main' into layout
argl Mar 27, 2025
8305613
Merge remote-tracking branch 'origin/layout' into layout
argl Mar 27, 2025
fe2da3e
responsive styles
argl Mar 28, 2025
00b51d6
Merge branch 'main' into layout
argl Mar 28, 2025
f255872
Merge branch 'main' into layout
argl Mar 28, 2025
0a4b1a0
fonts, popover in observatory
argl Mar 31, 2025
b1624a7
Merge branch 'main' into layout
argl Mar 31, 2025
e36c54a
fixes
argl Mar 31, 2025
7e60f7e
add fluent to context
argl Mar 31, 2025
c259917
type ingorance
argl Mar 31, 2025
866ae92
remove some old css rules
argl Mar 31, 2025
531e4fe
Merge branch 'main' into layout
argl Apr 8, 2025
1189c6e
linter fixes, add some types to the Rari namespace and use 'em
argl Apr 8, 2025
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
4 changes: 4 additions & 0 deletions components/content-feedback/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { LitElement, css, html } from "lit";

import { L10nMixin } from "../../l10n/mixin";
// @ts-ignore
import buttonStyles from "../button/index.css?lit";
import { Button } from "../button/index.js";

// @ts-ignore
import thumbsDown from "../icon/thumbs_down.svg?lit";
// @ts-ignore
import thumbsUp from "../icon/thumbs_up.svg?lit";

// @ts-ignore
import styles from "./index.css?lit";

/**
Expand Down
8 changes: 4 additions & 4 deletions components/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function Content(context) {

/**
* @param {Fred.Context} context
* @param {import("@mdn/rari").Section} section
* @param {Rari.Section} section
* @returns {Lit.TemplateResult}
*/
export function Section(context, { type, value }) {
Expand All @@ -40,7 +40,7 @@ export function Section(context, { type, value }) {
}

/**
* @param {import("@mdn/rari").Prose} section
* @param {Rari.Prose} section
* @returns {Lit.TemplateResult}
*/
function Prose({ id, title, content, isH3 }) {
Expand All @@ -53,7 +53,7 @@ function Prose({ id, title, content, isH3 }) {
}

/**
* @param {import("@mdn/rari").Compat} section
* @param {Rari.Compat} section
* @returns {Lit.TemplateResult}
*/
function BCD({ id, title, query, isH3 }) {
Expand All @@ -66,7 +66,7 @@ function BCD({ id, title, query, isH3 }) {

/**
* @param {Fred.Context} context
* @param {import("@mdn/rari").SpecificationSection} section
* @param {Rari.SpecificationSection} section
*/
function SpecificationsSection(context, { id, title, specifications, isH3 }) {
const level = isH3 ? 3 : 2;
Expand Down
3 changes: 2 additions & 1 deletion components/heading-anchor/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { nothing } from "lit";
import { ifDefined } from "lit/directives/if-defined.js";
import { html as hh, unsafeStatic } from "lit/static-html.js";

import "./index.css";
Expand All @@ -10,6 +11,6 @@ import "./index.css";
*/
export function Heading(level, id, title) {
return id
? hh`<${unsafeStatic("h" + level)} id=${id} class="heading"><a class="heading-anchor" href="#${id}">${title}</a></${unsafeStatic("h" + level)}>`
? hh`<${unsafeStatic("h" + level)} id=${ifDefined(id)} class="heading"><a class="heading-anchor" href="#${id}">${title}</a></${unsafeStatic("h" + level)}>`
: nothing;
}
41 changes: 39 additions & 2 deletions components/icon/feedback.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions components/icon/message-question.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions components/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@import "logo/index.css";
@import "menu/index.css";
@import "navigation/index.css";
@import "observatory-layout/index.css";
@import "page-layout/index.css";
@import "quick-search/index.css";
@import "reference-layout/index.css";
Expand Down
96 changes: 96 additions & 0 deletions components/observatory-layout/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/* Observatory main layout */

.obs-layout {
/* colors */

--text-primary: light-dark(#1b1b1b, #ffffff);
--text-secondary: light-dark(#4e4e4e, #cdcdcd);

--observatory-bg: light-dark(rgb(242 242 245 / 100%), rgb(52 52 52 / 100%));
--observatory-bg-code: light-dark(#e1e1e1, #4d4d4d);
--observatory-bg-secondary: light-dark(
rgb(255 255 255 / 100%),
rgb(0 0 0 / 100%)
);
--observatory-color: light-dark(#000000, #ffffff);
--observatory-color-secondary: light-dark(
rgb(105 105 105 / 100%),
rgb(249 249 251 / 100%)
);
--observatory-inverse-color: light-dark(
rgb(255 255 255 / 100%),
rgb(27 27 27)
);
--observatory-inverse-color-secondary: light-dark(
rgb(179 179 179 / 100%),
rgb(105 105 105 / 100%)
);
--observatory-accent: light-dark(#5a23d7, #a388ff);
--observatory-accent-light: light-dark(#5a23d7aa, #a388ffaa);
--observatory-border: light-dark(
rgb(228 228 246 / 100%),
rgb(105 105 105 / 100%)
);
--observatory-border-accent: light-dark(
rgb(90 35 215 / 100%),
rgb(163 136 255 / 100%)
);
--observatory-pass-icon-bg: light-dark(
rgb(229 250 230 / 100%),
rgb(38 92 61 / 100%)
);
--observatory-pass-icon-color: light-dark(
rgb(0 121 54 / 100%),
rgb(138 255 163 / 100%)
);
--observatory-fail-icon-bg: light-dark(
rgb(250 229 229 / 100%),
rgb(92 38 38 / 100%)
);
--observatory-fail-icon-color: light-dark(
rgb(211 0 56 / 100%),
rgb(255 121 155 / 100%)
);
--observatory-table-bg: light-dark(rgb(255 255 255 / 100%), rgb(27 27 27));
--observatory-table-bg-alternate: light-dark(#f9f9fb, #212121);
--observatory-table-header-bg: light-dark(
rgb(249 249 251 / 100%),
rgb(27 27 27)
);
--observatory-grade-a-bg: light-dark(#d2fadd, #265c3d);
--observatory-grade-a-border: light-dark(#017a37, #89fca1);
--observatory-grade-b-bg: light-dark(#e8fad2, #52662a);
--observatory-grade-b-border: light-dark(#547a01, #d5fc88);
--observatory-grade-c-bg: light-dark(#faf8d2, #66602a);
--observatory-grade-c-border: light-dark(#7a7001, #fcf988);
--observatory-grade-d-bg: light-dark(#fae8d2, #5c3d26);
--observatory-grade-d-border: light-dark(#a65001, #ff6a00);
--observatory-grade-f-bg: light-dark(#fad2d2, #5c2626);
--observatory-grade-f-border: light-dark(#aa0000, #fc8888);
--observatory-arrow-down-color: light-dark(
rgb(158 0 39 / 100%),
rgb(255 112 127 / 100%)
);
--observatory-arrow-up-color: light-dark(
rgb(0 121 54 / 100%),
rgb(0 255 106 / 100%)
);

--form-invalid-color: light-dark(#d30038, #ff97a0);

--font-body: inter, var(--font-fallback);

/* icons */
--alert-circle-img: url("../../observatory/assets/alert-circle.svg");
}

/*
.obs-layout--landing {
}

.obs-layout__content {
}

.obs-layout__toc {
}
*/
37 changes: 37 additions & 0 deletions components/observatory-layout/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { html } from "lit";

import "./index.css";
import { Landing } from "../../observatory/landing/index";
import { Results } from "../../observatory/results/index";

/**
* @import { TemplateResult } from "lit"
*/

/**
* @param {Fred.Context<Rari.SpaPage>} context
* @returns {TemplateResult}
*/
export function ObservatoryLayoutLanding(context) {
return html`
<div class="obs-layout obs-layout--landing">
<div class="obs-layout__content obs-layout__content--landing">
${Landing(context)}
</div>
</div>
`;
}

/**
* @param {Fred.Context<Rari.SpaPage>} context
* @returns {TemplateResult}
*/
export function ObservatoryLayoutResult(context) {
return html`
<div class="obs-layout obs-layout--results">
<div class="obs-layout__content obs-layout__content--results">
${Results(context)}
</div>
</div>
`;
}
6 changes: 4 additions & 2 deletions components/page-layout/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
z-index: 100;
}

/* .page-layout__main {
/*
.page-layout__main {
}

.page-layout__footer {
} */
}
*/
55 changes: 55 additions & 0 deletions components/progress-bar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { LitElement, css, html } from "lit";

/**
* This is an indefinite progress bar that can be used to indicate that a process is ongoing. It is used in Observatory.
* CSS variables:
* --progress-color: The color of the progress bar. Default is #aaa
* --border-radius: The border radius of the progress bar. Default is 0
*/
export class ProgressBar extends LitElement {
static styles = css`
:host {
display: block;
}

.progress-bar {
width: 100%;
height: 20px;
background-color: var(--background-color, #eee);
overflow: hidden;
position: relative;
border-radius: var(--border-radius, 0);
}

.progress-bar::before {
content: "";
position: absolute;
top: 0;
left: -200%;
width: 200%;
height: 100%;
background: linear-gradient(
to right,
transparent 0%,
var(--progress-color, #aaa) 50%,
transparent 100%
);
animation: scan 2s infinite alternate ease-in-out;
}

@keyframes scan {
from {
left: -200%;
}
to {
left: 100%;
}
}
`;

render() {
return html`<div class="progress-bar"></div>`;
}
}

customElements.define("mdn-progress-bar", ProgressBar);
4 changes: 2 additions & 2 deletions entry.ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Doc } from "./pages/doc/index.js";
import { Generic } from "./pages/generic/index.js";
import { HomePage } from "./pages/home/index.js";
import {
ObservatoryBody,
ObservatoryLanding,
ObservatoryResults,
} from "./pages/observatory/index.js";
import { Search } from "./pages/search/index.js";
Expand Down Expand Up @@ -87,7 +87,7 @@ export async function render(path, ssrManifest, clientManifest, page) {
case "SpaObservatoryAnalyze":
return ObservatoryResults(context);
case "SpaObservatoryLanding":
return ObservatoryBody(context);
return ObservatoryLanding(context);
case "SpaPlay":
return PageLayout(context, "TODO: Playground");
case "SpaPlusAiHelp":
Expand Down
3 changes: 3 additions & 0 deletions observatory/assets/alert-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 0 additions & 12 deletions observatory/assets/lines.svg

This file was deleted.

Loading