@totemat/debug-banner
v1.2.0
Published
Webcomponent used to show the current environment of the running app.
Readme
<debug-banner>
Webcomponent used to show the current environment of the running app.
Installation
npm i @totemat/debug-bannerUsage
Use in html
<!-- Import the webcomponent -->
<script type="module">
import '@totemat/debug-banner/debug-banner.js';
</script>
<!-- Shows the banner -->
<debug-banner show></debug-banner>
<!-- Shows the banner with a custom text-->
<debug-banner text="development" show></debug-banner>
<!-- Does not show the banner -->
<debug-banner></debug-banner>Use in Angular
import '@totemat/debug-banner/debug-banner.js';
@Component({
standalone: true,
template: `
<!-- You can either use the show property to show/hide the webcomponent -->
<debug-banner text="{{environment}}" [show]="showBanner"></debug-banner>
<!-- Or use angular control flow to show/hide the webcomponent -->
@if(showBanner) {
<debug-banner text="{{environment}}" show></debug-banner>
}
<!-- This will _always_ show the banner -->
<debug-banner text="{{environment}}" show></debug-banner>
<!-- This will _never_ show the banner (show is false by default) -->
<debug-banner text="{{environment}}"></debug-banner>
...
`,
styles: [`
debug-banner {
--text-color: red;
--background-color: lightgray;
}
`],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
// other properties
})
export class MyComponent {
environment = "staging";
showBanner = true;
}
Linting and formatting
To scan the project for linting and formatting errors, run
npm run lintTo automatically fix linting and formatting errors, run
npm run formatDemoing with Storybook
To run a local instance of Storybook for your component, run
npm run storybookTo build a production version of Storybook, run
npm run storybook:buildTooling configs
For most of the tools, the configuration is in the package.json to reduce the amount of files in your project.
If you customize the configuration a lot, you can consider moving them to individual files.
Local Demo with web-dev-server
npm startTo run a local development server that serves the basic demo located in demo/index.html
