Skip to content

Instantly share code, notes, and snippets.

@rootasjey
Last active November 23, 2018 19:14
Show Gist options
  • Save rootasjey/a238aa2cf228a4cf88e5b241ae7640da to your computer and use it in GitHub Desktop.
Save rootasjey/a238aa2cf228a4cf88e5b241ae7640da to your computer and use it in GitHub Desktop.
Example module which places visual elements according to device detection
// App
/**
* Return horizontal icon position.
*/
export function getIconX() {
const hPos = {
Ionic: 290,
Versa: 250,
};
return hPos[deviceType];
}
/**
* Return vertical icon position.
*/
export function getIconY({ metricNumber }) {
const vPos = {
Ionic: {
0: 20,
1: 77,
2: 120,
3: 165,
4: 210,
},
Versa: {
0: 30,
1: 90,
2: 150,
3: 200,
4: 255,
},
};
return vPos[deviceType][metricNumber];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment