fix button widget params types
This commit is contained in:
parent
b8313765d3
commit
ceb1f1e7c2
@ -5,12 +5,12 @@ import OpenQuizButton from "./OpenQuizButton";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
|
||||
type Props = ComponentPropsWithoutRef<typeof OpenQuizButton>;
|
||||
type ButtonWidgetProps = Omit<ComponentPropsWithoutRef<typeof OpenQuizButton>, "fixedSide">;
|
||||
|
||||
export class ButtonWidget {
|
||||
root: Root | undefined;
|
||||
|
||||
constructor(props: Props & {
|
||||
constructor(props: ButtonWidgetProps & {
|
||||
selector: string;
|
||||
/**
|
||||
* In seconds, null - polling disabled
|
||||
@ -38,7 +38,7 @@ export class ButtonWidget {
|
||||
});
|
||||
}
|
||||
|
||||
render(props: Props) {
|
||||
render(props: ButtonWidgetProps) {
|
||||
this.root?.render(<OpenQuizButton {...props} />);
|
||||
}
|
||||
|
||||
@ -47,11 +47,13 @@ export class ButtonWidget {
|
||||
}
|
||||
}
|
||||
|
||||
type ButtonWidgetFixedProps = Omit<ComponentPropsWithoutRef<typeof OpenQuizButton>, "selector">;
|
||||
|
||||
export class ButtonWidgetFixed {
|
||||
root: Root | undefined;
|
||||
element = document.createElement("div");
|
||||
|
||||
constructor(props: Props) {
|
||||
constructor(props: ButtonWidgetFixedProps) {
|
||||
this.element.style.setProperty("display", "none");
|
||||
document.body.appendChild(this.element);
|
||||
|
||||
@ -60,7 +62,7 @@ export class ButtonWidgetFixed {
|
||||
this.render(props);
|
||||
}
|
||||
|
||||
render(props: Props) {
|
||||
render(props: ButtonWidgetFixedProps) {
|
||||
this.root?.render(createPortal(<OpenQuizButton {...props} />, document.body));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user