Skip to content

Commit

Permalink
feat: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Rares Herta committed Mar 23, 2023
1 parent 1355e55 commit 816ae3e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
5 changes: 4 additions & 1 deletion packages/bee-q/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,12 @@ export namespace Components {
"value": string;
}
interface BqDialog {
/**
* Hides the dialog
*/
"close": () => Promise<void>;
/**
* Method to be called to open the dialog
* Shows the dialog
*/
"open": () => Promise<void>;
/**
Expand Down
18 changes: 12 additions & 6 deletions packages/bee-q/src/components/dialog/bq-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import { h, Component, Prop, Element, Watch, State, Method, Host } from '@stenci
import { validatePropValue } from '../../shared/utils';
import { DIALOG_SIZE, DIALOG_FOOTER_VARIANT, TDialogSize, TDialogFooterVariant } from './bq-dialog.types';

/**
* @part base - The component wrapper container inside the shadow DOM
* @part container - The `<div>` container that holds the dialog content
* @part icon-close - The icon that close the dialog on click
*/

@Component({
tag: 'bq-dialog',
styleUrl: './scss/bq-dialog.scss',
Expand Down Expand Up @@ -63,12 +69,13 @@ export class BqDialog {
// Requires JSDocs for public API documentation.
// ===============================================

/** Method to be called to open the dialog */
/** Shows the dialog */
@Method()
async open() {
this.isOpen = true;
}

/** Hides the dialog */
@Method()
async close() {
this.isOpen = false;
Expand All @@ -93,7 +100,7 @@ export class BqDialog {

render() {
return (
<Host class={{ 'is-open': this.isOpen }}>
<Host class={{ 'is-open': this.isOpen }} part="base">
<div
class="overlay fixed h-full w-full bg-bg-tertiary opacity-75"
onClick={this.handleOverlayClick}
Expand All @@ -104,6 +111,7 @@ export class BqDialog {
'z-10 m-auto flex flex-col rounded-s bg-bg-primary shadow-m': true,
[`size--${this.size}`]: true,
}}
part="container"
>
<header class="bq-header">
<div class="bq-placeholder-info">
Expand All @@ -112,14 +120,12 @@ export class BqDialog {
</div>
</div>
<div class="flex flex-col pl-4">
<h3>
<slot name="title" />
</h3>
<slot name="title" />
<div class="bq-description">
<slot name="content" />
</div>
</div>
<bq-button class="cursor-auto" appearance="text" size="small" part="button-close">
<bq-button class="cursor-auto" appearance="text" size="small">
<bq-icon
class="cursor-pointer"
name="x"
Expand Down
13 changes: 7 additions & 6 deletions packages/bee-q/src/components/dialog/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

### `close() => Promise<void>`


Hides the dialog

#### Returns

Expand All @@ -27,7 +27,7 @@ Type: `Promise<void>`

### `open() => Promise<void>`

Method to be called to open the dialog
Shows the dialog

#### Returns

Expand All @@ -38,10 +38,11 @@ Type: `Promise<void>`

## Shadow Parts

| Part | Description |
| ---------------- | ----------- |
| `"button-close"` | |
| `"icon-close"` | |
| Part | Description |
| -------------- | ----------------------------------------------------- |
| `"base"` | The component wrapper container inside the shadow DOM |
| `"container"` | The `<div>` container that holds the dialog content |
| `"icon-close"` | The icon that close the dialog on click |


## Dependencies
Expand Down

0 comments on commit 816ae3e

Please sign in to comment.