Skip to content

Commit

Permalink
Merge pull request #854 from vorth/style-link
Browse files Browse the repository at this point in the history
Support external style overrides for vzome-viewer
  • Loading branch information
vorth authored Apr 8, 2024
2 parents 9875c99 + 323058e commit 4dbc565
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions online/public/test/vzome-viewer-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

/* .select__listbox {
margin-block: 0;
padding: 4px;
} */
6 changes: 6 additions & 0 deletions online/src/viewer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ const renderViewer = ( workerClient, container, config ) =>
}

container .appendChild( document.createElement("style") ).textContent = urlViewerCSS;
// Apply external override styles to the shadow dom
const linkElem = document.createElement("link");
linkElem .setAttribute("rel", "stylesheet");
linkElem .setAttribute("href", "./vzome-viewer-styles.css");
container .appendChild( linkElem );

render( bindComponent, container );
}

Expand Down
3 changes: 2 additions & 1 deletion online/src/viewer/urlviewer.css.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export const urlViewerCSS = `
.select__listbox {
overflow-y: auto;
max-height: 360px;
padding: 8px;
margin-block: 0;
padding: 4px;
}
.select__item {
font-size: 16px;
Expand Down

0 comments on commit 4dbc565

Please sign in to comment.