Skip to content

Commit

Permalink
feat(components): add "componentLoad" event to SwirlBox
Browse files Browse the repository at this point in the history
  • Loading branch information
Sqrrl committed Jan 27, 2025
1 parent f46a903 commit 38ad9d2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/wet-tables-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@getflip/swirl-components": minor
"@getflip/swirl-components-angular": minor
"@getflip/swirl-components-react": minor
---

Add "componentLoad" event to swirl-box
15 changes: 14 additions & 1 deletion packages/swirl-components/src/components/swirl-box/swirl-box.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { Component, Element, h, Host, Prop, State } from "@stencil/core";
import {
Component,
Element,
Event,
EventEmitter,
h,
Host,
Prop,
State,
} from "@stencil/core";
import classnames from "classnames";

export type SwirlBoxBorderColor = "default" | "strong";
Expand Down Expand Up @@ -72,13 +81,17 @@ export class SwirlBox {
@Prop() width?: string;
@Prop() zIndex?: string;

@Event() componentLoad: EventEmitter<void>;

@State() scrollState = {
scrollable: false,
scrolledToBottom: false,
scrolledToTop: false,
};

componentDidLoad() {
this.componentLoad.emit();

queueMicrotask(() => {
this.updateScrollState();
});
Expand Down

0 comments on commit 38ad9d2

Please sign in to comment.