Skip to content

Commit

Permalink
Use icon button for add provider button
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepyfran committed Sep 22, 2024
1 parent 51077cd commit 1d937db
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/components/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from "./src/done-icon";
export * from "./src/next-icon";
export * from "./src/play-icon";
export * from "./src/plus-icon";
export * from "./src/prev-icon";
export * from "./src/pause-icon";
export * from "./src/providers";
Expand Down
31 changes: 31 additions & 0 deletions packages/components/icons/src/plus-icon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { LitElement, html } from "lit";
import { customElement, property } from "lit/decorators.js";

/**
* Icon that shows a plus icon.
*/
@customElement("plus-icon")
export class PlusIcon extends LitElement {
@property({ type: Number }) size = 24;
@property({ type: String }) color = "currentColor";

render() {
return html`
<svg
fill="none"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 ${this.size} ${this.size}"
height="${this.size}"
width="${this.size}"
>
<path d="M11 4h2v7h7v2h-7v7h-2v-7H4v-2h7V4z" fill="currentColor" />
</svg>
`;
}
}

declare global {
interface HTMLElementTagNameMap {
"plus-icon": PlusIcon;
}
}
9 changes: 7 additions & 2 deletions packages/components/provider-status/src/provider-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { LitElement, css, html, nothing } from "lit";
import { customElement, query } from "lit/decorators.js";
import { map } from "lit/directives/map.js";
import { Match } from "effect";
import { ButtonType, type EchoDialog } from "@echo/components-ui-atoms";
import "@echo/components-icons";
import "@echo/components-add-provider";
import "@echo/components-ui-atoms";
import type { EchoDialog } from "@echo/components-ui-atoms";

/**
* Component that displays the status of all active providers.
Expand Down Expand Up @@ -78,7 +78,12 @@ export class AllProvidersStatusBar extends LitElement {
</div>
`,
)}
<button @click=${this._onAddProviderClick}>+</button>
<echo-button
.type=${ButtonType.Icon}
@click=${this._onAddProviderClick}
>
<plus-icon title="Add provider"></plus-icon>
</echo-button>
</div>
${this._renderAddProviderModal()}
`,
Expand Down
4 changes: 4 additions & 0 deletions packages/components/ui-atoms/src/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export class EchoButton extends LitElement {

static styles = css`
button {
display: flex;
height: 100%;
align-items: center;
justify-content: center;
background-color: var(--button-background-color);
color: var(--button-text-color);
font-family: var(--font-family);
Expand Down

0 comments on commit 1d937db

Please sign in to comment.