@triptease/tt-navbar 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent tt-navbar following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "tt-navbar",
6
- "version": "0.0.2",
6
+ "version": "0.0.4",
7
7
  "type": "module",
8
8
  "main": "dist/src/index.js",
9
9
  "module": "dist/src/index.js",
package/src/TtNavbar.ts CHANGED
@@ -1,27 +1,23 @@
1
- import { html, css, LitElement } from 'lit';
1
+ import { html, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
+ import { styles } from './styles.js';
3
4
 
4
5
  export class TtNavbar extends LitElement {
5
- static styles = css`
6
- :host {
7
- display: block;
8
- padding: 25px;
9
- color: var(--tt-navbar-text-color, #000);
10
- }
11
- `;
6
+ static styles = styles;
12
7
 
13
- @property({ type: String }) header = 'Hey there';
14
-
15
- @property({ type: Number }) counter = 5;
16
-
17
- __increment() {
18
- this.counter += 1;
19
- }
8
+ @property()
9
+ onNavigate: (e: MouseEvent) => void = () => {
10
+ // Do nothing by default
11
+ };
20
12
 
21
13
  render() {
22
14
  return html`
23
- <h2>${this.header} Nr. ${this.counter}!</h2>
24
- <button @click=${this.__increment}>increment</button>
15
+ <nav id=${this.id}>
16
+ <a href="/">Dashboard</a>
17
+ <a href="/campaigns">Campaigns</a>
18
+ <a href="/channels">Channels</a>
19
+ <a href="/guest-insights/zxd47KQGAP">Guest insights</a>
20
+ </nav>
25
21
  `;
26
22
  }
27
23
  }
package/src/styles.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { css } from 'lit';
2
+
3
+ export const styles = css``;
@@ -1,32 +1,5 @@
1
- import { html } from 'lit';
2
- import { fixture, expect } from '@open-wc/testing';
3
- import { TtNavbar } from '../src/TtNavbar.js';
4
1
  import '../src/tt-navbar.js';
5
2
 
6
3
  describe('TtNavbar', () => {
7
- it('has a default header "Hey there" and counter 5', async () => {
8
- const el = await fixture<TtNavbar>(html`<tt-navbar></tt-navbar>`);
9
4
 
10
- expect(el.header).to.equal('Hey there');
11
- expect(el.counter).to.equal(5);
12
- });
13
-
14
- it('increases the counter on button click', async () => {
15
- const el = await fixture<TtNavbar>(html`<tt-navbar></tt-navbar>`);
16
- el.shadowRoot!.querySelector('button')!.click();
17
-
18
- expect(el.counter).to.equal(6);
19
- });
20
-
21
- it('can override the header via attribute', async () => {
22
- const el = await fixture<TtNavbar>(html`<tt-navbar header="attribute header"></tt-navbar>`);
23
-
24
- expect(el.header).to.equal('attribute header');
25
- });
26
-
27
- it('passes the a11y audit', async () => {
28
- const el = await fixture<TtNavbar>(html`<tt-navbar></tt-navbar>`);
29
-
30
- await expect(el).shadowDom.to.be.accessible();
31
- });
32
5
  });