24 lines
792 B
TypeScript
24 lines
792 B
TypeScript
import { GefestElement } from "../modules/Gefest/element";
|
|
import { SupportedStyles } from "../styles";
|
|
|
|
export abstract class DefaultElement extends GefestElement {
|
|
style: SupportedStyles | (() => SupportedStyles) | null = null;
|
|
constructor(content: (GefestElement | string)[] | string) {
|
|
super(content);
|
|
}
|
|
|
|
build(isFromStyle?: boolean): string {
|
|
if (!this.style) throw new Error("Setup style is required");
|
|
return super.build(isFromStyle);
|
|
}
|
|
}
|
|
|
|
export class DefaultRoundedButton extends DefaultElement {
|
|
constructor(btnContent : GefestElement | string) {
|
|
super([ btnContent ]);
|
|
this.setAttribute("type", "button");
|
|
this.addClass("btn");
|
|
this.addClass("rounded-circle");
|
|
this.addClass("border");
|
|
}
|
|
} |