X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Ftracker%2FToggleIcon.js;h=6dee8180f7be7bfdb3a80dc5819c26b68776f1ee;hb=9a4e2305bb37cb8c62e3ad332f4a2bf45f720a18;hp=98ae93240d0656087f0dd17719c9af89a9b80da1;hpb=60fd718e3b558eaea02a8d64bd6aac74be91f782;p=alttp.git
diff --git a/resources/js/components/tracker/ToggleIcon.js b/resources/js/components/tracker/ToggleIcon.js
index 98ae932..6dee818 100644
--- a/resources/js/components/tracker/ToggleIcon.js
+++ b/resources/js/components/tracker/ToggleIcon.js
@@ -19,11 +19,12 @@ import {
} from '../../helpers/tracker';
import { useTracker } from '../../hooks/tracker';
-const ToggleIcon = ({ controller, className, icons, svg }) => {
+const ToggleIcon = ({ controller, className, icons, svg, transform }) => {
const { setManualState, state } = useTracker();
const activeController = controller || ToggleIcon.nullController;
const active = activeController.getActive(state, icons);
const defaultIcon = activeController.getDefault(state, icons);
+ const icon = active || defaultIcon || icons[0];
const classNames = ['toggle-icon'];
if (active) {
classNames.push('active');
@@ -36,6 +37,7 @@ const ToggleIcon = ({ controller, className, icons, svg }) => {
if (svg) {
return {
activeController.handlePrimary(state, setManualState, icons);
e.preventDefault();
@@ -46,8 +48,9 @@ const ToggleIcon = ({ controller, className, icons, svg }) => {
e.preventDefault();
e.stopPropagation();
}}
+ transform={transform}
>
-
+
;
}
return ({
+ getActive: firstIcon,
+ getDefault: firstIcon,
+ handlePrimary: doNothing,
+ handleSecondary: () => removePin(pin),
+});
+
ToggleIcon.simpleController = {
getActive: highestActive,
getDefault: firstIcon,
@@ -295,6 +305,7 @@ ToggleIcon.propTypes = {
}),
icons: PropTypes.arrayOf(PropTypes.string),
svg: PropTypes.bool,
+ transform: PropTypes.string,
};
export default ToggleIcon;