mirror of
https://github.com/FJurmanovic/wallet-web.git
synced 2026-02-06 14:18:08 +00:00
fixed menu items
This commit is contained in:
@@ -56,7 +56,7 @@ class AppLinkElement extends BaseComponentElement {
|
||||
class="btn btn-link btn-disabled${this.className ? ` ${this.className}` : ''}"
|
||||
data-target="app-link.main"
|
||||
style="color:grey"
|
||||
>${this.title}</a
|
||||
><span class="link-text">${this.title}</span></a
|
||||
>`
|
||||
: html`<a
|
||||
class="btn btn-link${this.className ? ` ${this.className}` : ''}"
|
||||
@@ -64,7 +64,7 @@ class AppLinkElement extends BaseComponentElement {
|
||||
app-action="click:app-link#goTo"
|
||||
href="${this.to}"
|
||||
style="text-decoration: underline; cursor: pointer;"
|
||||
>${this.title}</a
|
||||
><span class="link-text">${this.title}</span></a
|
||||
>`}`;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -99,20 +99,24 @@ class AppMenuElement extends BaseComponentElement {
|
||||
render = (): TemplateResult => {
|
||||
const { isAuth, totalWallets, walletData } = this;
|
||||
|
||||
const regularMenu = (path: string, title: string, action?: string): TemplateResult => {
|
||||
const regularMenu = (path: string, title: string, action?: string, className?: string): TemplateResult => {
|
||||
if (action) {
|
||||
return html` <menu-item data-path="${path}" data-customaction="${action}">${title}</menu-item> `;
|
||||
return html`
|
||||
<menu-item class="${className || ''}" data-path="${path}" data-customaction="${action}">${title}</menu-item>
|
||||
`;
|
||||
}
|
||||
return html`<menu-item data-path="${path}">${title}</menu-item>`;
|
||||
return html`<menu-item class="${className || ''}" data-path="${path}">${title}</menu-item>`;
|
||||
};
|
||||
const menuButton = (title: string, action?: string): TemplateResult => {
|
||||
return html` <div class="menu-item --retract" data-target="menu-item.itemEl">
|
||||
<button class="btn btn-link" data-target="app-link.main" app-action="${action}">${title}</button>
|
||||
<button class="btn btn-link" data-target="app-link.main" app-action="${action}">
|
||||
${title}<span class="pseudo"></span>
|
||||
</button>
|
||||
</div>`;
|
||||
};
|
||||
const authMenu = (path: string, title: string, action?: string): TemplateResult => {
|
||||
const authMenu = (path: string, title: string, action?: string, className?: string): TemplateResult => {
|
||||
if (isAuth) {
|
||||
return regularMenu(path, title, action);
|
||||
return regularMenu(path, title, action, className);
|
||||
}
|
||||
return html``;
|
||||
};
|
||||
@@ -125,21 +129,25 @@ class AppMenuElement extends BaseComponentElement {
|
||||
const renderWallets = (wallets: Array<any>) => {
|
||||
if (isAuth && totalWallets > 0) {
|
||||
return html`<div class="menu-item divider"></div>
|
||||
${wallets.map((wallet) => regularMenu(`/wallet/${wallet.id}`, wallet.name))}`;
|
||||
${wallets.map((wallet) => regularMenu(`/wallet/${wallet.id}`, wallet.name, '', '--wallet'))}`;
|
||||
}
|
||||
return html``;
|
||||
};
|
||||
const menuHeader = (title) => html`<div class="menu-item menu-header">${title}</div>`;
|
||||
const menuHeader = (title) =>
|
||||
html`<div class="menu-item menu-header"><span class="link-text">${title}</span></div>`;
|
||||
|
||||
return html`
|
||||
<div data-target="app-menu.sidebar">
|
||||
${menuHeader(__CONFIG__.appName)} ${regularMenu('/', 'Home')}
|
||||
${authMenu('/history', 'Transaction History', 'click:app-menu#modalTransaction')}
|
||||
${authMenu('/subscriptions', 'Subscriptions', 'click:app-menu#modalSubscription')}
|
||||
${authMenu('/wallet/all', 'My Wallets', 'click:app-menu#modalWallet')} ${renderWallets(walletData)}
|
||||
<span class="menu-item divider"></span>
|
||||
${authMenu('/logout', 'Logout')} ${notAuthMenu('/login', 'Login')}
|
||||
${notAuthMenu('/register', 'Register')}${menuButton('Retract', 'click:menu-layout#retractMenu')}
|
||||
<div class="content">
|
||||
${menuHeader(__CONFIG__.appName)} ${regularMenu('/', 'Home')}
|
||||
${authMenu('/history', 'Transaction History', 'click:app-menu#modalTransaction')}
|
||||
${authMenu('/subscriptions', 'Subscriptions', 'click:app-menu#modalSubscription')}
|
||||
${authMenu('/wallet/all', 'My Wallets', 'click:app-menu#modalWallet')} ${renderWallets(walletData)}
|
||||
<span class="menu-item divider"></span>
|
||||
${authMenu('/logout', 'Logout', '', '--logout')} ${notAuthMenu('/login', 'Login')}
|
||||
${notAuthMenu('/register', 'Register')}
|
||||
</div>
|
||||
<div class="footer">${menuButton('Retract', 'click:menu-layout#retractMenu')}</div>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ class MenuItemElement extends BaseComponentElement {
|
||||
render = (): TemplateResult => {
|
||||
return html`
|
||||
<div class="${this.current ? 'selected ' : ''}menu-item" data-target="menu-item.itemEl">
|
||||
<app-link data-to="${this.path}">${this.title}</app-link>
|
||||
<app-link class="${this.className}" data-to="${this.path}">${this.title}</app-link>
|
||||
${this.customaction
|
||||
? html`<div data-target="menu-item.customButton" app-action="${this.customaction}">+</div>`
|
||||
: html``}
|
||||
|
||||
Reference in New Issue
Block a user