136 lines
4.7 KiB
HTML
136 lines
4.7 KiB
HTML
<!DOCTYPE html>
|
|
<html dir="ltr">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Button - Basic</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
<link href="../../../../../css/ionic.bundle.css" rel="stylesheet">
|
|
<link href="../../../../../scripts/testing/styles.css" rel="stylesheet">
|
|
<script src="../../../../../scripts/testing/scripts.js"></script>
|
|
<script nomodule src="../../../../../dist/ionic/ionic.js"></script>
|
|
<script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script></head>
|
|
|
|
<body>
|
|
<ion-app>
|
|
|
|
<ion-header>
|
|
<ion-toolbar>
|
|
<ion-title>Button - Basic</ion-title>
|
|
</ion-toolbar>
|
|
</ion-header>
|
|
|
|
<ion-content class="ion-padding ion-text-center" id="content" no-bounce>
|
|
<p>
|
|
<ion-button>Default</ion-button>
|
|
<ion-button class="ion-focused">Default.focused</ion-button>
|
|
<ion-button class="ion-activated">Default.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="primary">Primary</ion-button>
|
|
<ion-button class="ion-focused" color="primary">Primary.focused</ion-button>
|
|
<ion-button class="ion-activated" color="primary">Primary.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="secondary">Secondary</ion-button>
|
|
<ion-button class="ion-focused" color="secondary">Secondary.focused</ion-button>
|
|
<ion-button class="ion-activated" color="secondary">Secondary.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="tertiary">Tertiary</ion-button>
|
|
<ion-button class="ion-focused" color="tertiary">Tertiary.focused</ion-button>
|
|
<ion-button class="ion-activated" color="tertiary">Tertiary.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="success">Success</ion-button>
|
|
<ion-button class="ion-focused" color="success">Success.focused</ion-button>
|
|
<ion-button class="ion-activated" color="success">Success.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="warning">Warning</ion-button>
|
|
<ion-button class="ion-focused" color="warning">Warning.focused</ion-button>
|
|
<ion-button class="ion-activated" color="warning">Warning.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="danger">Danger</ion-button>
|
|
<ion-button class="ion-focused" color="danger">Danger.focused</ion-button>
|
|
<ion-button class="ion-activated" color="danger">Danger.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="light">Light</ion-button>
|
|
<ion-button class="ion-focused" color="light">Light.focused</ion-button>
|
|
<ion-button class="ion-activated" color="light">Light.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="medium">Medium</ion-button>
|
|
<ion-button class="ion-focused" color="medium">Medium.focused</ion-button>
|
|
<ion-button class="ion-activated" color="medium">Medium.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button color="dark">Dark</ion-button>
|
|
<ion-button class="ion-focused" color="dark">Dark.focused</ion-button>
|
|
<ion-button class="ion-activated" color="dark">Dark.activated</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button style="--opacity: .2">Opacity: 0.2</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button expand="block" id="disabledButton" disabled onclick="clickedButton(event)">Button Disabled</ion-button>
|
|
<ion-button expand="block" color="secondary" disabled>Secondary Disabled</ion-button>
|
|
<ion-button expand="block" color="tertiary" style="--opacity: 1" disabled>Disabled opacity: 1</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button expand="block" onclick="toggleDisabled()">Toggle Disabled</ion-button>
|
|
</p>
|
|
|
|
<p>
|
|
<ion-button id="dynamicColor1" onclick="changeColor(event)">Change Color</ion-button>
|
|
<ion-button id="dynamicColor2" onclick="changeColor(event)" fill="outline">Change Color</ion-button>
|
|
</p>
|
|
|
|
</ion-content>
|
|
|
|
</ion-app>
|
|
|
|
<script>
|
|
testingColors = ['primary', 'secondary', 'danger', 'dark'];
|
|
testingColorIndex = {
|
|
dynamicColor1: 0,
|
|
dynamicColor2: 0
|
|
};
|
|
|
|
function changeColor(ev) {
|
|
el = ev.currentTarget;
|
|
|
|
testingColorIndex[el.id] = (testingColorIndex[el.id] >= testingColors.length - 1 ? 0 : testingColorIndex[el.id] + 1);
|
|
newColor = testingColors[testingColorIndex[el.id]];
|
|
|
|
el.color = newColor;
|
|
}
|
|
|
|
function toggleDisabled() {
|
|
var buttonEl = document.getElementById('disabledButton');
|
|
console.log(buttonEl);
|
|
buttonEl.disabled = !buttonEl.disabled;
|
|
}
|
|
|
|
function clickedButton(ev) {
|
|
console.log("Clicked button", ev);
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|