Skip to content

Commit

Permalink
124 improving ux and align it with the familyco one (#125)
Browse files Browse the repository at this point in the history
* fix: ux improvements

* fix: badge renaming

* fix: colors

* fix: tests

* fix: comment store link
  • Loading branch information
davidecarpini authored Nov 30, 2023
1 parent b984755 commit 430431f
Show file tree
Hide file tree
Showing 30 changed files with 526 additions and 488 deletions.
4 changes: 2 additions & 2 deletions packages/dapp-kit-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<script crossorigin type="module" src="./index.js"></script>
</head>
<body>
<vwk-connect-button-with-modal
<vwk-vechain-dapp-connect-kit
mode="DARK"
></vwk-connect-button-with-modal>
></vwk-vechain-dapp-connect-kit>
</body>
</html>
4 changes: 2 additions & 2 deletions packages/dapp-kit-ui/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
/* eslint-disable no-undef */
import { DAppKit } from './dist';
import { DAppKitUI } from './dist';

const walletConnectOptions = {
projectId: 'a0b855ceaf109dbc8426479a4c3d38d8',
Expand All @@ -20,4 +20,4 @@ const vechainWalletKitOptions = {
usePersistence: true,
};

DAppKit.configure(vechainWalletKitOptions);
DAppKitUI.configure(vechainWalletKitOptions);
1 change: 1 addition & 0 deletions packages/dapp-kit-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"lint": "tsc --noEmit && eslint src --ext .js,.jsx,.ts,.tsx",
"purge": "yarn clean && rm -rf node_modules",
"test": "vitest run --coverage",
"test:dev": "vitest run ",
"watch": "tsup --watch"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/dapp-kit-ui/src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './close';
export * from './chevron-left';
export * from './copy';
export * from './check';
export * from './disconnect';
1 change: 1 addition & 0 deletions packages/dapp-kit-ui/src/assets/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './icons';
export * from './images';
export * from './styles';
78 changes: 78 additions & 0 deletions packages/dapp-kit-ui/src/assets/styles/button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { css } from 'lit';
import { Colors } from '../../constants/colors';

export const buttonStyle = css`
button {
font-family: 'Inter', sans-serif;
cursor: pointer;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
border: none;
border-radius: 12px;
padding: 12px;
font-size: 15px;
font-weight: 500;
width: 100%;
gap: 10px;
}
button.LIGHT {
background-color: ${Colors.XXLightGrey};
color: ${Colors.LightBlack};
}
button.LIGHT:hover {
background-color: ${Colors.XLightGrey};
}
button.LIGHT:active {
background-color: ${Colors.LightGrey};
}
button.DARK {
background-color: ${Colors.XXDarkGrey};
color: ${Colors.XXLightGrey};
}
button.DARK:hover {
background-color: ${Colors.XDarkGrey};
}
button.DARK:active {
background-color: ${Colors.DarkGrey};
}
`;

export const triggerButtonStyle = css`
button {
font-family: 'Inter', sans-serif;
cursor: pointer;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border: none;
border-radius: 12px;
padding: 12px;
}
button.LIGHT {
background-color: ${Colors.XXLightGrey};
color: ${Colors.LightBlack};
}
button.LIGHT:hover {
background-color: ${Colors.XLightGrey};
}
button.LIGHT:active {
background-color: ${Colors.LightGrey};
}
button.DARK {
background-color: ${Colors.LightBlack};
color: ${Colors.XXLightGrey};
}
button.DARK:hover {
background-color: ${Colors.XLightBlack};
}
button.DARK:active {
background-color: ${Colors.XXLightBlack};
}
`;
1 change: 1 addition & 0 deletions packages/dapp-kit-ui/src/assets/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './button';
83 changes: 0 additions & 83 deletions packages/dapp-kit-ui/src/components/address-badge.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import type { Theme, ThemeMode } from '../constants';

@customElement('vwk-connected-address-badge-with-modal')
export class AddressBadgeWithModal extends LitElement {
@customElement('vwk-connected-address-button-with-modal')
export class AddressButtonWithModal extends LitElement {
@property({ type: String })
mode: ThemeMode = 'LIGHT';

Expand All @@ -24,12 +24,12 @@ export class AddressBadgeWithModal extends LitElement {
return html`
<div>
<vwk-fonts></vwk-fonts>
<vwk-connected-address-badge
<vwk-connected-address-button
.mode=${this.mode}
.theme=${this.theme}
.address=${this.address}
.onClick=${this.handleOpen}
></vwk-connected-address-badge>
></vwk-connected-address-button>
<vwk-connected-address-modal
.mode=${this.mode}
.theme=${this.theme}
Expand All @@ -53,6 +53,6 @@ export class AddressBadgeWithModal extends LitElement {

declare global {
interface HTMLElementTagNameMap {
'vwk-connected-address-badge-with-modal': AddressBadgeWithModal;
'vwk-connected-address-button-with-modal': AddressButtonWithModal;
}
}
62 changes: 62 additions & 0 deletions packages/dapp-kit-ui/src/components/address-button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { css, html, LitElement, type TemplateResult } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { type ThemeMode } from '../constants';
import { friendlyAddress, getPicassoImage } from '../utils/account';
import { triggerButtonStyle } from '../assets';

@customElement('vwk-connected-address-button')
export class AddressButton extends LitElement {
static override styles = [
triggerButtonStyle,
css`
button {
padding: 9px 12px;
}
/* Style for the wallet address */
.wallet-address {
font-size: 14px;
margin-left: 8px;
font-family: 'Inter', sans-serif;
}
.address-icon {
width: 23px;
height: 23px;
margin-right: 4px;
border-radius: 50%;
}
`,
];

@property()
address?: string;

@property()
mode: ThemeMode = 'DARK';

@property({ type: Function })
onClick? = undefined;

render(): TemplateResult {
return html` <button
class="wallet-button ${this.mode}"
@click=${this.onClick}
>
<img
class="address-icon"
src=${getPicassoImage(this.address ?? '')}
/>
<span class="wallet-address"
>${friendlyAddress(this.address ?? '')}</span
>
</button>`;
}
}

declare global {
interface HTMLElementTagNameMap {
'vwk-connected-address-button': AddressButton;
}
}
Loading

0 comments on commit 430431f

Please sign in to comment.