Skip to content

Commit

Permalink
refactor: use named export and function
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Jul 23, 2024
1 parent e97c95b commit c0ff28a
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import DotConnectElement from "./dc-element.js";
import { DotConnectElement } from "./dc-element.js";
import { css, html } from "lit";
import { customElement, property } from "lit/decorators.js";

@customElement("dc-circular-progress-indicator")
export default class CircularProgressIndicator extends DotConnectElement {
export class CircularProgressIndicator extends DotConnectElement {
static override readonly styles = [
super.styles,
css`
Expand Down
4 changes: 2 additions & 2 deletions packages/dot-connect/src/elements/components/dc-dialog.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { close as closeIcon } from "../../icons/index.js";
import DotConnectElement from "./dc-element.js";
import { DotConnectElement } from "./dc-element.js";
import { effect, signal } from "@lit-labs/preact-signals";
import { css, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import { ref } from "lit/directives/ref.js";

@customElement("dc-dialog")
export default class Dialog extends DotConnectElement {
export class Dialog extends DotConnectElement {
static override get styles() {
return [
super.styles,
Expand Down
4 changes: 1 addition & 3 deletions packages/dot-connect/src/elements/components/dc-element.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { SignalWatcher } from "@lit-labs/preact-signals";
import { LitElement, css, type CSSResultGroup } from "lit";

export default abstract class DotConnectElement extends SignalWatcher(
LitElement,
) {
export abstract class DotConnectElement extends SignalWatcher(LitElement) {
static override readonly styles: CSSResultGroup = css`
* {
--headline-font-family: var(--dc-headline-font-family, Unbounded);
Expand Down
4 changes: 2 additions & 2 deletions packages/dot-connect/src/elements/components/dc-list-item.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import "./dc-circular-progress-indicator.js";
import DotConnectElement from "./dc-element.js";
import { DotConnectElement } from "./dc-element.js";
import { css, html } from "lit";
import { customElement, property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { styleMap } from "lit/directives/style-map.js";

@customElement("dc-list-item")
export default class ListItem extends DotConnectElement {
export class ListItem extends DotConnectElement {
static override readonly styles = [
super.styles,
css`
Expand Down
4 changes: 2 additions & 2 deletions packages/dot-connect/src/elements/components/dc-qr-code.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { wallet as walletIcon } from "../../icons/index.js";
import DotConnectElement from "./dc-element.js";
import { DotConnectElement } from "./dc-element.js";
import { TemplateResult, css, html, svg } from "lit";
import { customElement, property } from "lit/decorators.js";
import { styleMap } from "lit/directives/style-map.js";
Expand All @@ -10,7 +10,7 @@ import {
} from "qrcode";

@customElement("dc-qr-code")
export default class QrCode extends DotConnectElement {
export class QrCode extends DotConnectElement {
@property()
ecl: QRCodeErrorCorrectionLevel = "M";

Expand Down
8 changes: 4 additions & 4 deletions packages/dot-connect/src/elements/dc-connection-button.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {
wallets as walletsIcon,
wallet as walletIcon,
users as usersIcon,
wallet as walletIcon,
wallets as walletsIcon,
} from "../icons/index.js";
import { observableSignal } from "../observable-signal.js";
import { accounts$, connectedWallets$ } from "../stores.js";
import DotConnectElement from "./components/dc-element.js";
import { DotConnectElement } from "./components/dc-element.js";
import "./dc-connection-dialog.js";
import { signal } from "@lit-labs/preact-signals";
import { css, html } from "lit";
import { customElement } from "lit/decorators.js";

@customElement("dc-connection-button")
export default class ConnectionButton extends DotConnectElement {
export class ConnectionButton extends DotConnectElement {
static override styles = [
super.styles,
css`
Expand Down
4 changes: 2 additions & 2 deletions packages/dot-connect/src/elements/dc-connection-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { SupportedWallet } from "../types.js";
import { getDownloadUrl } from "../utils.js";
import { InjectedWalletInfo, WalletConfig } from "../wallets/types.js";
import "./components/dc-dialog.js";
import DotConnectElement from "./components/dc-element.js";
import { DotConnectElement } from "./components/dc-element.js";
import "./components/dc-list-item.js";
import "./components/dc-qr-code.js";
import { computed, effect, signal } from "@lit-labs/preact-signals";
Expand Down Expand Up @@ -257,7 +257,7 @@ export class DownloadableWallet extends DotConnectElement {
}

@customElement("dc-connection-dialog")
export default class ConnectionDialog extends DotConnectElement {
export class ConnectionDialog extends DotConnectElement {
static override get styles() {
return [
super.styles,
Expand Down
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/close.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IconProps } from "./types.js";
import { html } from "lit";

const close = ({ size = 24 }: IconProps) =>
html`<svg
export function close({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 29 29"
Expand All @@ -26,5 +26,4 @@ const close = ({ size = 24 }: IconProps) =>
></path>
</g>
</svg>`;

export default close;
}
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/connected.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IconProps } from "./types.js";
import { html } from "lit";

const connected = ({ size = 24 }: IconProps) =>
html`<svg
export function connected({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 29 29"
Expand Down Expand Up @@ -31,5 +31,4 @@ const connected = ({ size = 24 }: IconProps) =>
></path>
</g>
</svg>`;

export default connected;
}
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/disconnected.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IconProps } from "./types.js";
import { html } from "lit";

const disconnected = ({ size = 24 }: IconProps) =>
html`<svg
export function disconnected({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 28 28"
Expand Down Expand Up @@ -32,5 +32,4 @@ const disconnected = ({ size = 24 }: IconProps) =>
<path d="M2.99982 2L24.9998 26" fill="none" data-nofill="true"></path>
</g>
</svg>`;

export default disconnected;
}
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/download.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IconProps } from "./types.js";
import { html } from "lit";

const download = ({ size = 24 }: IconProps) =>
html`<svg
export function download({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 28 28"
Expand All @@ -20,5 +20,4 @@ const download = ({ size = 24 }: IconProps) =>
data-nofill="true"
></path>
</svg>`;

export default download;
}
16 changes: 8 additions & 8 deletions packages/dot-connect/src/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export { default as close } from "./close.js";
export { default as connected } from "./connected.js";
export { default as disconnected } from "./disconnected.js";
export { default as download } from "./download.js";
export { default as qrCode } from "./qr-code.js";
export { default as users } from "./users.js";
export { default as wallet } from "./wallet.js";
export { default as wallets } from "./wallets.js";
export { close } from "./close.js";
export { connected } from "./connected.js";
export { disconnected } from "./disconnected.js";
export { download } from "./download.js";
export { qrCode } from "./qr-code.js";
export { users } from "./users.js";
export { wallet } from "./wallet.js";
export { wallets } from "./wallets.js";
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/qr-code.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IconProps } from "./types.js";
import { html } from "lit";

const qrCode = ({ size = 24 }: IconProps) =>
html`<svg
export function qrCode({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 28 29"
Expand Down Expand Up @@ -34,5 +34,4 @@ const qrCode = ({ size = 24 }: IconProps) =>
<path d="M22.0002 16.375H16.0002V22.375H22.0002V16.375Z"></path>
<path d="M12.0001 16.375H6.00012V22.375H12.0001V16.375Z"></path>
</svg>`;

export default qrCode;
}
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/users.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IconProps } from "./types.js";
import { html } from "lit";

const users = ({ size = 24 }: IconProps) =>
html`<svg
export function users({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 28 28"
Expand All @@ -19,5 +19,4 @@ const users = ({ size = 24 }: IconProps) =>
></path>
</g>
</svg>`;

export default users;
}
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IconProps } from "./types.js";
import { html } from "lit";

const wallet = ({ size = 24 }: IconProps) =>
html`<svg
export function wallet({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 28 28"
Expand All @@ -21,5 +21,4 @@ const wallet = ({ size = 24 }: IconProps) =>
<circle cx="18" cy="14" r="1"></circle>
</g>
</svg>`;

export default wallet;
}
7 changes: 3 additions & 4 deletions packages/dot-connect/src/icons/wallets.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { IconProps } from "./types.js";
import { html } from "lit";

const wallets = ({ size = 24 }: IconProps) =>
html`<svg
export function wallets({ size = 24 }: IconProps) {
return html`<svg
width=${size}
height=${size}
viewBox="0 0 28 28"
Expand All @@ -22,5 +22,4 @@ const wallets = ({ size = 24 }: IconProps) =>
<path d="M15.0181 16.0181L15 16" stroke-miterlimit="10"></path>
</g>
</svg>`;

export default wallets;
}

0 comments on commit c0ff28a

Please sign in to comment.