Include Gerrit's `shared-styles` in `Owned Files` tab Add common Gerrit's styles to `Owned Files` components so that they get consistently styled e.g. links are highlighted in the same color etc. Bug: Issue 384100207 Change-Id: I80360f56f425d36b7b129694dabe7ad99e82cf55
diff --git a/owners/web/gr-owned-files.ts b/owners/web/gr-owned-files.ts index 8324225..29f8b7a 100644 --- a/owners/web/gr-owned-files.ts +++ b/owners/web/gr-owned-files.ts
@@ -15,7 +15,15 @@ * limitations under the License. */ -import {css, html, LitElement, PropertyValues, nothing, CSSResult} from 'lit'; +import { + css, + html, + LitElement, + PropertyValues, + nothing, + CSSResult, + unsafeCSS, +} from 'lit'; import {ifDefined} from 'lit/directives/if-defined.js'; import {OwnersMixin} from './owners-mixin'; import {customElement, property} from 'lit/decorators'; @@ -84,7 +92,13 @@ } static commonStyles(): CSSResult[] { - return [window?.Gerrit?.styles.font as CSSResult]; + const template = document.querySelector( + 'dom-module#shared-styles > template' + ) as HTMLTemplateElement; + const sharedStyles = css` + ${unsafeCSS(template?.content?.querySelector('style')?.textContent)} + `; + return [sharedStyles, window?.Gerrit?.styles.font as CSSResult]; } private computeOwnedFiles() {