/**
* @description An abstract class for creating button
* @param btn {HTMLButtonElement Object}
*/
class BtnFactory {
const btn
constructor(props) {
if (new.target === Btn) {
throw new TypeError("Cannot construct Abstract instances directly")
}
this.props.btn = new HTMLButtonElement()
}
}
/**
* @description A factory class for creating
* a square button
*
* @param btn {HTMLButtonElement Object}
*/
class SquareBtnFactory extends BtnFactory {
constructor() {
super(props)
}
create() {
const { btn } = this.props
btn.classList.add('square')
return btn
}
}
/**
* @description A factory class for creating
* a circle button
*
* @param btn {HTMLButtonElement Object}
*/
class CircleBtnFactory extends BtnFactory {
constructor() {
super (props)
}
create() {
const { btn } = this.props
btn.classList.add('circle')
return btn
}
}