import { experimentOn } from '@islavi/ng2-component-lab'; const buttonTypes = ['primary', 'secondary', 'link', 'alert']; const buttonSizes = ['large', 'medium', 'small', 'x-small', 'default']; const experiment = experimentOn('Button'); experiment.group("Default button", [ { id: "defaultButton", showSource: true, description: `Default button, does not need to supply type or size.
The size of the button set to 'default' so it will shrink or expand according to the content. `, context: { buttonClicked: ():void => { window.alert("OK"); } }, title: "Default button", template: ` ` } ]); buttonTypes.forEach((buttonType) => { [false, true].forEach((buttonDisabled) => { experiment.group(`Button ${buttonType} ${buttonDisabled ? ' disabled' : ''}`, [ { id: `Button ${buttonType}${buttonDisabled ? ' disabled' : ''}`, showSource: true, context: { buttonClicked: ():void => { window.alert("OK"); } }, title: `Button ${buttonType}${buttonDisabled ? ' disabled' : ''}`, template: buttonSizes.map((buttonSize) => `
${buttonSize}

`).join('\n') } ]); }); }); experiment.group("Buttons with icons", [ { id: "buttonsWithIcons", showSource: true, description: `Buttons with icons forward`, context: { buttonClicked: (): void => { window.alert("OK"); } }, title: "Button with icons", template: ` ` } ]); experiment.group("Buttons with spinners", [ { id: "buttonsWithSpinnersRight", showSource: true, description: `Click the button to see the spinner shows for 2 seconds`, context: { buttonClicked: (button): void => { button.show_spinner = true; setTimeout(() => {button.show_spinner = false},2000); }, }, title: "Button with spinner on the right", template: ` ` }, { id: "buttonsWithSpinnersLeft", showSource: true, description: `Click the button to see the spinner shows for 2 seconds`, context: { buttonClicked: (button): void => { button.show_spinner = true; setTimeout(() => {button.show_spinner = false},2000); }, }, title: "Button with spinner on the left", template: ` ` } ]); export default experiment;