Skip to content

Commit

Permalink
Merge pull request #99 from amir78729/feat/badge-wrapper-jsDoc
Browse files Browse the repository at this point in the history
docs: add JSDoc to `badge-wrapper` component
  • Loading branch information
amir78729 authored May 28, 2024
2 parents a5d34bf + 826f02f commit f3c6b82
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/badge-wrapper/badge-wrapper.stories.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { html, TemplateResult } from "lit";
import "./index.js";
import "../badge";
import "../button";
import { html, TemplateResult } from 'lit';
import './index.js';
import '../badge';
import '../button';

export default {
title: "Badge",
component: "tap-badge-wrapper",
title: 'Badge',
component: 'tap-badge-wrapper',
argTypes: {},
};

Expand Down
2 changes: 1 addition & 1 deletion src/badge-wrapper/badge-wrapper.style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from "lit";
import { css } from 'lit';

export default css`
.wrapper {
Expand Down
6 changes: 3 additions & 3 deletions src/badge-wrapper/badge-wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { html, LitElement } from "lit";
import { html, LitElement } from 'lit';

export class BadgeWrapper extends LitElement {
render() {
return html`
<span class="wrapper">
<span class="wrapper" part="wrapper">
<slot></slot>
<slot class="badge" name="badge"></slot>
<slot class="badge" name="badge" part="badge"></slot>
</span>
`;
}
Expand Down
33 changes: 28 additions & 5 deletions src/badge-wrapper/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
import { customElement } from "lit/decorators.js";
import { BadgeWrapper } from "./badge-wrapper";
import styles from "./badge-wrapper.style";
// index.ts

@customElement("tap-badge-wrapper")
import { customElement } from 'lit/decorators.js';
import { BadgeWrapper } from './badge-wrapper';
import styles from './badge-wrapper.style';

/**
* ### Example
*
*
* ##### Simple
*
* ```html
* <tap-badge-wrapper>
* <tap-button>Click!</tap-button>
* <tap-badge slot="badge" value="99+"></tap-badge>
* </tap-badge-wrapper>
* ```
*
* @summary A wrapper component to position a badge relative to its content.
*
* @slot - The default slot for the main content.
* @slot `badge` - The slot for the badge to be positioned.
*
* @csspart `wrapper` - The container that wraps the main content and the badge.
* @csspart `badge` - The container that positions the badge.
*/
@customElement('tap-badge-wrapper')
export class TapBadgeWrapper extends BadgeWrapper {
static readonly styles = [styles];
}

declare global {
interface HTMLElementTagNameMap {
"tap-badge-wrapper": TapBadgeWrapper;
'tap-badge-wrapper': TapBadgeWrapper;
}
}

0 comments on commit f3c6b82

Please sign in to comment.