-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(interactive-examples): support HTML examples (#12633)
- Loading branch information
Showing
28 changed files
with
817 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// This is a custom Jest transformer turning raw imports into empty strings. | ||
// http://facebook.github.io/jest/docs/en/webpack.html | ||
|
||
const transform = { | ||
process() { | ||
return { code: "module.exports = '';" }; | ||
}, | ||
getCacheKey() { | ||
// The output is always the same. | ||
return "rawTransform"; | ||
}, | ||
}; | ||
|
||
export default transform; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@font-face { | ||
font-family: "Inter"; | ||
src: | ||
url("/shared-assets/fonts/Inter.var.woff2") | ||
format("woff2 supports variations"), | ||
url("/shared-assets/fonts/Inter.var.woff2") format("woff2-variations"); | ||
font-weight: 1 999; | ||
font-stretch: 75% 100%; | ||
font-style: oblique 0deg 20deg; | ||
font-display: swap; | ||
} | ||
|
||
/* fonts used by the examples rendered inside the shadow dom. Because | ||
@font-face does not work in shadow dom: | ||
http://robdodson.me/at-font-face-doesnt-work-in-shadow-dom/ */ | ||
@font-face { | ||
font-family: "Fira Sans"; | ||
src: | ||
local("FiraSans-Regular"), | ||
url("/shared-assets/fonts/FiraSans-Regular.woff2") format("woff2"); | ||
} | ||
|
||
@font-face { | ||
font-family: "Fira Sans"; | ||
font-weight: normal; | ||
font-style: oblique; | ||
src: | ||
local("FiraSans-SemiBoldItalic"), | ||
url("/shared-assets/fonts/FiraSans-SemiBoldItalic.woff2") format("woff2"); | ||
} | ||
|
||
@font-face { | ||
font-family: "Dancing Script"; | ||
src: url("/shared-assets/fonts/dancing-script/dancing-script-regular.woff2") | ||
format("woff2"); | ||
} | ||
|
||
@font-face { | ||
font-family: molot; | ||
src: url("/shared-assets/fonts/molot.woff2") format("woff2"); | ||
} | ||
|
||
@font-face { | ||
font-family: rapscallion; | ||
src: url("/shared-assets/fonts/rapscall.woff2") format("woff2"); | ||
} | ||
|
||
body { | ||
background-color: #fff; | ||
font: | ||
400 1rem/1.1876 Inter, | ||
BlinkMacSystemFont, | ||
"Segoe UI", | ||
"Roboto", | ||
"Oxygen", | ||
"Ubuntu", | ||
"Cantarell", | ||
"Fira Sans", | ||
"Droid Sans", | ||
"Helvetica Neue", | ||
sans-sans; | ||
color: #15141aff; | ||
font-size: 0.9rem; | ||
line-height: 1.5; | ||
padding: 2rem 1rem 1rem; | ||
min-width: min-content; | ||
} | ||
|
||
body math { | ||
font-size: 1.5rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
window.addEventListener("click", (event) => { | ||
// open links in parent frame if they have no `_target` set | ||
const target = event.target; | ||
if (target instanceof HTMLAnchorElement) { | ||
const hrefAttr = target.getAttribute("href"); | ||
const targetAttr = target.getAttribute("target"); | ||
if (hrefAttr && !hrefAttr.startsWith("#") && !targetAttr) { | ||
target.target = "_parent"; | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@use "../../ui/vars" as *; | ||
|
||
interactive-example { | ||
display: block; | ||
height: 444px; | ||
margin: 1rem 0; | ||
|
||
&[height="shorter"] { | ||
height: 364px; | ||
} | ||
|
||
&[height="taller"] { | ||
height: 654px; | ||
} | ||
|
||
&[height="tabbed-shorter"] { | ||
height: 351px; | ||
margin-top: 1.5rem; | ||
} | ||
|
||
&[height="tabbed-standard"] { | ||
height: 421px; | ||
} | ||
|
||
&[height="tabbed-taller"] { | ||
height: 631px; | ||
} | ||
|
||
@media (max-width: $screen-lg) { | ||
height: 513px; | ||
|
||
&[height="shorter"] { | ||
height: 433px; | ||
} | ||
|
||
&[height="taller"] { | ||
height: 725px; | ||
} | ||
|
||
&[height="tabbed-shorter"] { | ||
height: 487px; | ||
} | ||
|
||
&[height="tabbed-standard"] { | ||
height: 548px; | ||
} | ||
|
||
&[height="tabbed-taller"] { | ||
height: 774px; | ||
} | ||
} | ||
} |
Oops, something went wrong.