This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
/
codepen.js
49 lines (45 loc) 路 1.66 KB
/
codepen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const codepenHtml = (element, name) => {
/* eslint-disable no-useless-escape */
const html = `
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Lyne Components Sandbox: ${name}</title>
<!--
Since font-face declarations can not be made within the shadow DOM, also
self-contained/encapsulated web components need to define the font-face
declarations outside of the shadow DOM until this will be allowed/this bug is solved
https://bugs.chromium.org/p/chromium/issues/detail?id=336876
-->
<style>
@font-face {
font-family: 'SBBWeb Bold';
src: url('https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Bold.woff2') format('woff2'),
url('https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Bold.woff') format('woff');
font-display: swap;
}
@font-face {
font-family: 'SBBWeb Light';
src: url('https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Light.woff2') format('woff2'),
url('https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Light.woff') format('woff');
font-display: swap;
}
@font-face {
font-family: 'SBBWeb Roman';
src: url('https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Roman.woff2') format('woff2'),
url('https://cdn.app.sbb.ch/fonts/v1_6_subset/SBBWeb-Roman.woff') format('woff');
font-display: fallback;
}
</style>
<script type='module' src='https://unpkg.com/@sbb-esta/lyne-components/dist/lyne-components/lyne-components.esm.js'><\/script>
</head>
<body>
${element}
</body>
</html>
`;
/* eslint-enable no-useless-escape */
return html;
};
export default codepenHtml;