0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Koenig - Fix misaligned toolbar arrow in Night Shift

refs https://github.com/TryGhost/Ghost/issues/9623
This commit is contained in:
Kevin Ansfield 2018-06-15 10:29:10 +01:00
parent 496c3b586c
commit cf572e3508

View file

@ -278,17 +278,22 @@ export default Component.extend({
// style is by adding a style element to the head // style is by adding a style element to the head
this._removeStyleElement(); // reset to base styles this._removeStyleElement(); // reset to base styles
if (tickPosition !== 50) { if (tickPosition !== 50) {
this._addStyleElement(`left: calc(${tickPosition}% - ${TICK_ADJUSTMENT}px)`); this._addStyleElement(tickPosition);
} }
// update the toolbar position // update the toolbar position
this.setProperties(newPosition); this.setProperties(newPosition);
}, },
_addStyleElement(styles) { _addStyleElement(tickPosition) {
let beforeStyle = `left: calc(${tickPosition}% - ${TICK_ADJUSTMENT + 2}px);`;
let afterStyle = `left: calc(${tickPosition}% - ${TICK_ADJUSTMENT}px);`;
let styleElement = document.createElement('style'); let styleElement = document.createElement('style');
styleElement.id = `${this.elementId}-style`; styleElement.id = `${this.elementId}-style`;
styleElement.innerHTML = `#${this.elementId} > ul:after { ${styles} }`; styleElement.innerHTML = `
#${this.elementId} > ul:before { ${beforeStyle} }
#${this.elementId} > ul:after { ${afterStyle} }
`;
document.head.appendChild(styleElement); document.head.appendChild(styleElement);
}, },