mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-01 01:38:07 +08:00
Screenshot for basic.html: https://imgur.com/a/HKlHFGh R=jacktfranklin@chromium.org Change-Id: Idd47a0978fbcba63fb847355032e6142e4145165 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2560754 Commit-Queue: Simon Zünd <szuend@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
73 lines
2.2 KiB
HTML
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>
|