mirror of
https://github.com/Cian-H/invenio-theme-iform.git
synced 2025-12-23 05:01:58 +00:00
Added react component to keep logo hover state synced
This commit is contained in:
@@ -8,6 +8,7 @@ import React from "react";
|
|||||||
// called on document ready
|
// called on document ready
|
||||||
$(function () {
|
$(function () {
|
||||||
importZammadScript();
|
importZammadScript();
|
||||||
|
syncLogoHover();
|
||||||
});
|
});
|
||||||
|
|
||||||
function importZammadScript() {
|
function importZammadScript() {
|
||||||
@@ -45,10 +46,41 @@ window.toggleVisibility = toggleVisibility;
|
|||||||
const headerSearchbar = document.getElementById("header-search-bar");
|
const headerSearchbar = document.getElementById("header-search-bar");
|
||||||
const searchBarOptions = JSON.parse(headerSearchbar.dataset.options);
|
const searchBarOptions = JSON.parse(headerSearchbar.dataset.options);
|
||||||
|
|
||||||
|
// Synchronises the hover states of the subcomponents of the logo
|
||||||
|
export function syncLogoHover() {
|
||||||
|
const logoGrad = document.getElementById("int-header-logo-grad");
|
||||||
|
const logoText = document.getElementById("int-header-logo-text");
|
||||||
|
|
||||||
|
const originalFillGrad = logoGrad.getAttribute("fill");
|
||||||
|
const originalColorGrad = logoGrad.getAttribute("color");
|
||||||
|
const originalFillText = logoText.getAttribute("fill");
|
||||||
|
const originalColorText = logoText.getAttribute("color");
|
||||||
|
|
||||||
|
logoGrad.addEventListener("mouseover", () => {
|
||||||
|
logoText.setAttribute("fill", "@primaryLinkHoverBackground");
|
||||||
|
logoText.setAttribute("color", "@primaryLinkHoverBackground");
|
||||||
|
});
|
||||||
|
logoGrad.addEventListener("mouseout", () => {
|
||||||
|
logoText.setAttribute("fill", originalFillText);
|
||||||
|
logoText.setAttribute("color", originalColorText);
|
||||||
|
});
|
||||||
|
|
||||||
|
logoText.addEventListener("mouseover", () => {
|
||||||
|
logoGrad.setAttribute("fill", "@primaryLinkHoverBackground");
|
||||||
|
logoGrad.setAttribute("color", "@primaryLinkHoverBackground");
|
||||||
|
});
|
||||||
|
logoText.addEventListener("mouseout", () => {
|
||||||
|
logoGrad.setAttribute("fill", originalFillGrad);
|
||||||
|
logoGrad.setAttribute("color", originalColorGrad);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.syncLogoHover = syncLogoHover;
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<MultipleOptionsSearchBar
|
<MultipleOptionsSearchBar
|
||||||
options={searchBarOptions}
|
options={searchBarOptions}
|
||||||
placeholder={i18next.t("Search records...")}
|
placeholder={i18next.t("Search records...")}
|
||||||
/>,
|
/>,
|
||||||
headerSearchbar
|
headerSearchbar,
|
||||||
);
|
);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 16 KiB |
Reference in New Issue
Block a user