Skip to content
27 changes: 26 additions & 1 deletion components/playground/element.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,35 @@
grid-area: runner;
overflow: hidden;

mdn-play-runner {
mdn-play-runner,
.overlay-run-button {
flex-grow: 1;
border: var(--border);
border-radius: 0.25rem;

&.hidden {
display: none;
}
}

.overlay-run-button {
border-color: currentcolor;
}

.overlay-run-button--header {
font-size: clamp(1.5rem, 3vw, 3rem);

svg {
width: clamp(1.5rem, 3vw, 3rem) !important;
height: clamp(1.5rem, 3vw, 3rem) !important;
vertical-align: bottom;
}
}

.overlay-run-button--body {
margin-top: 0.5rem;
line-height: var(--font-line-normal);
color: var(--color-text-secondary);
}

.playground__console {
Expand Down
20 changes: 19 additions & 1 deletion components/playground/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createRef, ref } from "lit/directives/ref.js";

import { L10nMixin } from "../../l10n/mixin.js";
import { gleanClick } from "../../utils/glean.js";
import circlePlay from "../icon/circle-play.svg?lit";
import warningIcon from "../icon/triangle-alert.svg?lit";
import { globalUser } from "../user/context.js";

Expand Down Expand Up @@ -66,6 +67,7 @@ export class MDNPlayground extends L10nMixin(LitElement) {
this._autoRun = true;
controller.runOnChange = true;
this._storeSession();
this.requestUpdate();
}
}
}
Expand Down Expand Up @@ -402,7 +404,23 @@ ${"```"}`,
</menu>
</aside>`
: nothing}
<mdn-play-runner></mdn-play-runner>
${this._autoRun
? nothing
: html`<mdn-button
class="overlay-run-button"
@click=${this._run}
variant="plain"
>
<div class="overlay-run-button--header">
${circlePlay} ${this.l10n("playground-run")`Run`}
</div>
<div class="overlay-run-button--body">
${this.l10n.raw({ id: "playground-user-shared-warning" })}
</div>
</mdn-button>`}
<mdn-play-runner
class=${this._autoRun ? nothing : "hidden"}
></mdn-play-runner>
<div class="playground__console">
<div>${this.l10n("playground-console")`Console`}</div>
<mdn-play-console></mdn-play-console>
Expand Down
2 changes: 2 additions & 0 deletions l10n/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ baseline-unsupported-in = Not widely supported in { $browsers }
baseline-supported-and-unsupported-in = Supported in { $supported }, but not widely supported in { $unsupported }

homepage-hero-title = Resources for Developers,<br> by Developers

playground-user-shared-warning = This is a user-shared playground.<br>Always inspect the code before running it.
homepage-hero-description = Documenting <a data-l10n-name="css">CSS</a>, <a data-l10n-name="html">HTML</a>, and <a data-l10n-name="js">JavaScript</a>, since 2005.

not-found-title = Page not found
Expand Down
1 change: 1 addition & 0 deletions l10n/locales/fr.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ playground-share = Partager
playground-clear = Effacer
playground-reset = Réinitialiser
playground-seeing-something-inappropriate = Voir quelque chose d'inapproprié ?
playground-user-shared-warning = Il s'agit d'un terrain d'essai partagé par un·e utilisateur·ice.<br>Inspectez toujours le code avant de l'exécuter.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @mdn/fr-content for review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍🏻

playground-console = Console
playground-share-markdown = Partager le Markdown
playground-copy-markdown-to-clipboard = Copier le Markdown dans le presse-papiers
Expand Down
1 change: 1 addition & 0 deletions l10n/template.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ baseline-supported-in = Supported in { $browsers }
baseline-unsupported-in = Not widely supported in { $browsers }
baseline-supported-and-unsupported-in = Supported in { $supported }, but not widely supported in { $unsupported }
homepage-hero-title = Resources for Developers,<br> by Developers
playground-user-shared-warning = This is a user-shared playground.<br>Always inspect the code before running it.
homepage-hero-description = Documenting <a data-l10n-name="css">CSS</a>, <a data-l10n-name="html">HTML</a>, and <a data-l10n-name="js">JavaScript</a>, since 2005.
not-found-title = Page not found
not-found-description = Sorry, the page <code data-l10n-name="url">{ $url }</code> could not be found.
Expand Down