astro/packages/astro/components/Debug.astro
Fred K. Schott c82ceff7eb fix #1778
2021-11-18 22:21:58 -08:00

56 lines
1.1 KiB
Text

---
import Code from './Code.astro';
const key = Object.keys(Astro.props)[0];
const value = Astro.props[key];
---
<div class="debug">
<div class="debug-header">
<h2 class="debug-title"><span class="debug-label">Debug</span> <span class="debug-name">"{key}"</span></h2>
</div>
<Code code={JSON.stringify(value, null, 2)} />
</div>
<style>
.debug {
font-size: 14px;
padding: 1rem 1.5rem;
background: white;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.debug-header, pre {
margin: -1rem -1.5rem 1rem;
padding: 0.25rem 0.75rem;
}
.debug-header {
background: #FF1639;
border-radius: 4px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.debug-title {
font-size: 1em;
color: white;
margin: 0.5em 0;
}
.debug-label {
font-weight: bold;
text-transform: uppercase;
margin-right: 0.75em;
}
pre {
border: 1px solid #eee;
padding: 1rem 0.75rem;
border-radius: 4px;
border-top-left-radius: 0;
border-top-right-radius: 0;
font-size: 14px;
}
</style>