Skip to content

Commit f3c6b82

Browse files
authored
Merge pull request #99 from amir78729/feat/badge-wrapper-jsDoc
docs: add JSDoc to `badge-wrapper` component
2 parents a5d34bf + 826f02f commit f3c6b82

File tree

4 files changed

+38
-15
lines changed

4 files changed

+38
-15
lines changed

src/badge-wrapper/badge-wrapper.stories.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { html, TemplateResult } from "lit";
2-
import "./index.js";
3-
import "../badge";
4-
import "../button";
1+
import { html, TemplateResult } from 'lit';
2+
import './index.js';
3+
import '../badge';
4+
import '../button';
55

66
export default {
7-
title: "Badge",
8-
component: "tap-badge-wrapper",
7+
title: 'Badge',
8+
component: 'tap-badge-wrapper',
99
argTypes: {},
1010
};
1111

src/badge-wrapper/badge-wrapper.style.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { css } from "lit";
1+
import { css } from 'lit';
22

33
export default css`
44
.wrapper {

src/badge-wrapper/badge-wrapper.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { html, LitElement } from "lit";
1+
import { html, LitElement } from 'lit';
22

33
export class BadgeWrapper extends LitElement {
44
render() {
55
return html`
6-
<span class="wrapper">
6+
<span class="wrapper" part="wrapper">
77
<slot></slot>
8-
<slot class="badge" name="badge"></slot>
8+
<slot class="badge" name="badge" part="badge"></slot>
99
</span>
1010
`;
1111
}

src/badge-wrapper/index.ts

+28-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
1-
import { customElement } from "lit/decorators.js";
2-
import { BadgeWrapper } from "./badge-wrapper";
3-
import styles from "./badge-wrapper.style";
1+
// index.ts
42

5-
@customElement("tap-badge-wrapper")
3+
import { customElement } from 'lit/decorators.js';
4+
import { BadgeWrapper } from './badge-wrapper';
5+
import styles from './badge-wrapper.style';
6+
7+
/**
8+
* ### Example
9+
*
10+
*
11+
* ##### Simple
12+
*
13+
* ```html
14+
* <tap-badge-wrapper>
15+
* <tap-button>Click!</tap-button>
16+
* <tap-badge slot="badge" value="99+"></tap-badge>
17+
* </tap-badge-wrapper>
18+
* ```
19+
*
20+
* @summary A wrapper component to position a badge relative to its content.
21+
*
22+
* @slot - The default slot for the main content.
23+
* @slot `badge` - The slot for the badge to be positioned.
24+
*
25+
* @csspart `wrapper` - The container that wraps the main content and the badge.
26+
* @csspart `badge` - The container that positions the badge.
27+
*/
28+
@customElement('tap-badge-wrapper')
629
export class TapBadgeWrapper extends BadgeWrapper {
730
static readonly styles = [styles];
831
}
932

1033
declare global {
1134
interface HTMLElementTagNameMap {
12-
"tap-badge-wrapper": TapBadgeWrapper;
35+
'tap-badge-wrapper': TapBadgeWrapper;
1336
}
1437
}

0 commit comments

Comments
 (0)