Skip to content

Commit 99a1967

Browse files
authored
Merge pull request #107 from amir78729/docs/jsdoc/divider
docs: add JSDoc to `divider` component
2 parents c2766ee + f40f12d commit 99a1967

File tree

4 files changed

+60
-23
lines changed

4 files changed

+60
-23
lines changed

src/divider/divider.stories.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { html, TemplateResult } from "lit";
2-
import "./index.js";
1+
import { html, TemplateResult } from 'lit';
2+
import './index.js';
33

44
export default {
5-
title: "Divider",
6-
component: "tap-divider",
5+
title: 'Divider',
6+
component: 'tap-divider',
77
argTypes: {},
88
};
99

src/divider/divider.style.ts

+16-10
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
:host {
@@ -17,21 +17,27 @@ export default css`
1717
1818
:host {
1919
display: block;
20-
background-color: var(--tap-sys-color-border-primary);
20+
background-color: var(
21+
--tap-divider-background-color,
22+
var(--tap-sys-color-border-primary)
23+
);
2124
width: 100%;
22-
margin: var(--tap-sys-spacing-4) 0;
25+
margin: var(--tap-divider-margin, var(--tap-sys-spacing-4)) 0;
2326
}
2427
25-
:host([type="thin"]) {
26-
height: var(--tap-sys-spacing-1);
28+
:host([type='thin']) {
29+
height: var(--tap-divider-thin-height, var(--tap-sys-spacing-1));
2730
}
2831
29-
:host([type="medium"]) {
30-
height: var(--tap-sys-spacing-2);
32+
:host([type='medium']) {
33+
height: var(--tap-divider-medium-height, var(--tap-sys-spacing-2));
3134
}
3235
33-
:host([type="bold"]) {
34-
background-color: var(--tap-sys-color-surface-secondary);
35-
height: var(--tap-sys-spacing-4);
36+
:host([type='bold']) {
37+
background-color: var(
38+
--tap-divider-bold-background-color,
39+
var(--tap-sys-color-surface-secondary)
40+
);
41+
height: var(--tap-divider-bold-height, var(--tap-sys-spacing-4));
3642
}
3743
`;

src/divider/divider.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { LitElement } from "lit";
2-
import { property } from "lit/decorators.js";
1+
import { LitElement } from 'lit';
2+
import { property } from 'lit/decorators.js';
33

44
export class Divider extends LitElement {
5-
@property({ reflect: true }) type: "thin" | "medium" | "bold" = "medium";
5+
@property({ reflect: true }) type: 'thin' | 'medium' | 'bold' = 'medium';
66

77
connectedCallback() {
88
super.connectedCallback();
9-
this.setAttribute("role", "separator");
9+
this.setAttribute('role', 'separator');
1010
}
1111
}

src/divider/index.ts

+36-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
1-
import { customElement } from "lit/decorators.js";
2-
import { Divider } from "./divider.js";
3-
import styles from "./divider.style.js";
1+
import { customElement } from 'lit/decorators.js';
2+
import { Divider } from './divider.js';
3+
import styles from './divider.style.js';
44

5-
@customElement("tap-divider")
5+
/**
6+
* ### Example
7+
*
8+
*
9+
* ##### Simple
10+
*
11+
* ```html
12+
* <tap-divider></tap-divider>
13+
* ```
14+
*
15+
* ##### Different Types
16+
*
17+
* ```html
18+
* <tap-divider type="thin"></tap-divider>
19+
* <tap-divider type="medium"></tap-divider>
20+
* <tap-divider type="bold"></tap-divider>
21+
* ```
22+
*
23+
* @summary A divider component used to separate content.
24+
*
25+
* @prop {`'thin'` \| `'medium'` \| `'bold'`} [`type`=`'medium'`] - The thickness of the divider.
26+
*
27+
* @csspart [`divider`] - The main container for the divider.
28+
*
29+
* @cssprop [`--tap-divider-background-color`=`--tap-sys-color-border-primary`] - The background color of the divider.
30+
* @cssprop [`--tap-divider-margin`=`--tap-sys-spacing-4`] - The margin around the divider.
31+
* @cssprop [`--tap-divider-thin-height`=`--tap-sys-spacing-1`] - The height of the thin divider.
32+
* @cssprop [`--tap-divider-medium-height`=`--tap-sys-spacing-2`] - The height of the medium divider.
33+
* @cssprop [`--tap-divider-bold-background-color`=`--tap-sys-color-surface-secondary`] - The background color of the bold divider.
34+
* @cssprop [`--tap-divider-bold-height`=`--tap-sys-spacing-4`] - The height of the bold divider.
35+
*/
36+
@customElement('tap-divider')
637
export class TapDivider extends Divider {
738
static readonly styles = [styles];
839
}
940

1041
declare global {
1142
interface HTMLElementTagNameMap {
12-
"tap-divider": TapDivider;
43+
'tap-divider': TapDivider;
1344
}
1445
}

0 commit comments

Comments
 (0)