Files
react-native-devtools-frontend/front_end/component_docs/report/basic.html
T
2020-11-30 07:12:48 +00:00

73 lines
2.2 KiB
HTML

<!--
Copyright 2020 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Basic ReportView example</title>
<style>
#container {
width: 80%;
border: 1px solid black;
padding: 20px;
height: 300px;
}
</style>
</head>
<body>
<div id="container">
</div>
<script type="module">
import * as ComponentHelpers from '../../component_helpers/component_helpers.js';
import * as Components from '../../ui/components/components.js'
import * as LitHtml from '../../third_party/lit-html/lit-html.js';
ComponentHelpers.ComponentServerSetup.setup().then(() => renderComponent());
const exampleRenderHelper = (name, value) => LitHtml.html`
<devtools-report-row>
<span slot="name">${name}</span>
<span slot="value">${value}</span>
</devtools-report-row>
`;
const renderComponent = () => {
LitHtml.render(LitHtml.html`
<style>
devtools-report {
--name-column-width: 300px;
}
.source-code {
font-family: monospace;
}
</style>
<devtools-report>
<devtools-report-section .data=${{sectionTitle: 'Section 1'}}>
<devtools-report-row>
<span slot="name">Basic plain text field</span>
<span slot="value">And this is the value</span>
</devtools-report-row>
<devtools-report-row>
<span slot="name">A field with a code value</span>
<span slot="value" class="source-code">SomeCodeValue</span>
</devtools-report-row>
</devtools-report-section>
<devtools-report-section .data=${{sectionTitle: 'Section 2'}}>
${exampleRenderHelper('Using a small helper', 'to render report rows')}
</devtools-report-section>
</devtools-report>
`, document.getElementById('container'));
};
</script>
</body>
</html>