Skip to content

Commit

Permalink
update profile
Browse files Browse the repository at this point in the history
  • Loading branch information
SuaYoo committed Nov 26, 2024
1 parent bf8df02 commit 8958887
Show file tree
Hide file tree
Showing 10 changed files with 323 additions and 82 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "./card";
import "./data-table";
import "./desc-list";
import "./dialog";
import "./link";
import "./navigation";
import "./tab-group";
import "./tab-list";
Expand Down
50 changes: 50 additions & 0 deletions frontend/src/components/ui/link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import clsx from "clsx";
import { html } from "lit";
import { customElement, property } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";

import { BtrixElement } from "@/classes/BtrixElement";

@customElement("btrix-link")
export class Link extends BtrixElement {
@property({ type: String })
href?: HTMLAnchorElement["href"];

@property({ type: String })
target?: HTMLAnchorElement["target"];

@property({ type: String })
rel?: HTMLAnchorElement["rel"];

@property({ type: String })
variant: "primary" | "neutral" = "neutral";

render() {
if (!this.href) return;

return html`
<a
class=${clsx(
"group inline-flex items-center gap-1 transition-colors",
{
primary: "text-primary-500 hover:text-primary-600",
neutral: "text-blue-500 hover:text-blue-600",
}[this.variant],
)}
href=${this.href}
target=${ifDefined(this.target)}
rel=${ifDefined(this.rel)}
@click=${this.target === "_blank" || this.href.startsWith("http")
? () => {}
: this.navigate.link}
>
<slot></slot>
<sl-icon
slot="suffix"
name="arrow-right"
class="size-4 transition-transform group-hover:translate-x-1"
></sl-icon
></a>
`;
}
}
1 change: 1 addition & 0 deletions frontend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ export class App extends BtrixElement {

return html`<btrix-org-profile
class="w-full"
slug=${slug}
?inOrg=${this.isUserInCurrentOrg}
?preview=${orgTab && orgTab === OrgTab.ProfilePreview}
></btrix-org-profile>`;
Expand Down
7 changes: 3 additions & 4 deletions frontend/src/pages/account-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,13 @@ export class AccountSettings extends LiteElement {
<footer class="flex items-center justify-start border-t px-4 py-3">
<p class="text-neutral-600">
${msg("Help us translate Browsertrix.")}
<a
class="inline-flex items-center gap-1 text-blue-500 hover:text-blue-600"
<btrix-link
href="https://docs.browsertrix.com/develop/localization/"
target="_blank"
variant="primary"
>
${msg("Contribute to translations")}
<sl-icon slot="suffix" name="arrow-right"></sl-icon
></a>
</btrix-link>
</p>
</footer>
</section>
Expand Down
Loading

0 comments on commit 8958887

Please sign in to comment.