2021-04-03 17:26:43 +00:00
|
|
|
import { t } from "@lingui/macro";
|
2021-03-17 21:19:31 +00:00
|
|
|
import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
|
|
|
|
import PFAvatar from "@patternfly/patternfly/components/Avatar/avatar.css";
|
|
|
|
import { ifDefined } from "lit-html/directives/if-defined";
|
2021-03-17 16:11:39 +00:00
|
|
|
|
|
|
|
@customElement("ak-form-static")
|
|
|
|
export class FormStatic extends LitElement {
|
|
|
|
|
2021-03-17 21:19:31 +00:00
|
|
|
@property()
|
|
|
|
userAvatar?: string;
|
|
|
|
|
|
|
|
@property()
|
|
|
|
user = "";
|
|
|
|
|
2021-03-17 16:11:39 +00:00
|
|
|
static get styles(): CSSResult[] {
|
2021-03-17 21:19:31 +00:00
|
|
|
return [PFAvatar, css`
|
2021-03-17 16:11:39 +00:00
|
|
|
/* Form with user */
|
|
|
|
.form-control-static {
|
|
|
|
margin-top: var(--pf-global--spacer--sm);
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
}
|
2021-03-17 21:19:31 +00:00
|
|
|
.form-control-static .avatar {
|
2021-03-17 16:11:39 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.form-control-static img {
|
|
|
|
margin-right: var(--pf-global--spacer--xs);
|
|
|
|
}
|
|
|
|
.form-control-static a {
|
|
|
|
padding-top: var(--pf-global--spacer--xs);
|
|
|
|
padding-bottom: var(--pf-global--spacer--xs);
|
|
|
|
line-height: var(--pf-global--spacer--xl);
|
|
|
|
}
|
|
|
|
`];
|
|
|
|
}
|
|
|
|
|
|
|
|
render(): TemplateResult {
|
|
|
|
return html`
|
|
|
|
<div class="form-control-static">
|
2021-03-17 21:19:31 +00:00
|
|
|
<div class="avatar">
|
2021-04-03 17:26:43 +00:00
|
|
|
<img class="pf-c-avatar" src="${ifDefined(this.userAvatar)}" alt="${t`User's avatar`}">
|
2021-03-17 21:19:31 +00:00
|
|
|
${this.user}
|
|
|
|
</div>
|
2021-03-17 16:11:39 +00:00
|
|
|
<slot name="link"></slot>
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|