Skip to content

Commit b50ef78

Browse files
committed
Merge branch 'development' into ic/fix-addr-table
2 parents 4811f3e + d8cd247 commit b50ef78

File tree

9 files changed

+92
-9
lines changed

9 files changed

+92
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
- [Fixed trimmed address not showing in address-table](https://github.com/multiversx/mx-sdk-dapp-ui/pull/273)
11+
- [Added minimize/maximize action for toasts](https://github.com/multiversx/mx-sdk-dapp-ui/pull/272)
1112
- [Eslint and prettierrc fixes](https://github.com/multiversx/mx-sdk-dapp-ui/pull/270)
1213
- [Refactored sign transactions panel internal components](https://github.com/multiversx/mx-sdk-dapp-ui/pull/267)
1314

src/common/Icon/Icon.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { CopyIcon } from './components/CopyIcon';
2323
import { HourglassIcon } from './components/HourglassIcon';
2424
import { LayersIcon } from './components/LayersIcon';
2525
import { LockIcon } from './components/LockIcon';
26+
import { MaximizeIcon } from './components/MaximizeIcon';
27+
import { MinimizeIcon } from './components/MinimizeIcon';
2628
import { PencilIcon } from './components/PencilIcon';
2729
import { SpinnerIcon } from './components/SpinnerIcon';
2830
import { TriangularWarningIcon } from './components/TriangularWarningIcon';
@@ -112,6 +114,12 @@ export const Icon = ({ name, ...properties }: IconPropsType) => {
112114
case 'arrow-right':
113115
return <ArrowRightIcon />;
114116

117+
case 'minimize':
118+
return <MinimizeIcon />;
119+
120+
case 'maximize':
121+
return <MaximizeIcon />;
122+
115123
default:
116124
console.error(`No data for the ${name} icon.`);
117125
return null;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { h } from '@stencil/core';
2+
3+
const styles = {
4+
maximizeIcon: 'mvx:text-inherit',
5+
} satisfies Record<string, string>;
6+
7+
export const MaximizeIcon = ({ class: className }: { class?: string }) => (
8+
<svg
9+
xmlns="http://www.w3.org/2000/svg"
10+
width="20"
11+
height="20"
12+
viewBox="0 0 448 512"
13+
fill="currentColor"
14+
class={{ [styles.maximizeIcon]: true, [className]: Boolean(className) }}
15+
>
16+
<path d="M32 32C14.3 32 0 46.3 0 64l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 32zM64 352c0-17.7-14.3-32-32-32S0 334.3 0 352l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3 32-32s-14.3-32-32-32l-64 0 0-64zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3 32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 64-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96z" />
17+
</svg>
18+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './MaximizeIcon';
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { h } from '@stencil/core';
2+
3+
const styles = {
4+
minimizeIcon: 'mvx:text-inherit',
5+
} satisfies Record<string, string>;
6+
7+
export const MinimizeIcon = ({ class: className }: { class?: string }) => (
8+
<svg
9+
xmlns="http://www.w3.org/2000/svg"
10+
width="20"
11+
height="20"
12+
viewBox="0 0 448 512"
13+
fill="currentColor"
14+
class={{ [styles.minimizeIcon]: true, [className]: Boolean(className) }}
15+
>
16+
<path
17+
d="M160 64c0-17.7-14.3-32-32-32S96 46.3 96 64l0 64-64 0c-17.7 0-32
18+
14.3-32 32s14.3 32 32 32l96 0c17.7 0 32-14.3 32-32l0-96zM32 320c-17.7 0-32
19+
14.3-32 32s14.3 32 32 32l64 0 0 64c0 17.7 14.3 32 32 32s32-14.3
20+
32-32l0-96c0-17.7-14.3-32-32-32l-96 0zM352 64c0-17.7-14.3-32-32-32s-32
21+
14.3-32 32l0 96c0 17.7 14.3 32 32 32l96 0c17.7 0 32-14.3
22+
32-32s-14.3-32-32-32l-64 0 0-64zM320 320c-17.7 0-32 14.3-32
23+
32l0 96c0 17.7 14.3 32 32 32s32-14.3 32-32l0-64 64 0c17.7 0 32-14.3
24+
32-32s-14.3-32-32-32l-96 0z"
25+
/>
26+
</svg>
27+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './MinimizeIcon';

src/common/Icon/icon.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export enum IconNamesEnum {
2727
arrowsRotate = 'arrows-rotate',
2828
spinner = 'spinner',
2929
arrowRight = 'arrow-right',
30+
minimize = 'minimize',
31+
maximize = 'maximize',
3032
}
3133

3234
export type IconPropsType = JSXBase.IntrinsicElements['svg'] & {

src/components/functional/toasts-list/toast-list.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,19 @@
1818
}
1919

2020
.view-all-button-container {
21-
@apply mvx:absolute mvx:-bottom-12 mvx:right-0 mvx:z-1;
21+
@apply mvx:absolute mvx:-bottom-12 mvx:right-0 mvx:z-1 mvx:flex;
2222
}
2323

24+
.minimize-button,
25+
.maximize-button,
2426
.view-all-button {
2527
@apply mvx:backdrop-blur-2xl mvx:py-2 mvx:px-4 mvx:text-base mvx:font-normal mvx:leading-6 mvx:cursor-pointer;
2628
@apply mvx:ease-in-out mvx:transition-opacity mvx:duration-200;
2729
border-radius: 100px;
2830
border: 2px solid var(--mvx-border-color-secondary);
2931
background: var(--mvx-bg-color-primary);
3032
color: var(--mvx-text-color-primary);
33+
min-height: 44px;
3134

3235
&:hover {
3336
@apply mvx:opacity-80;

src/components/functional/toasts-list/toast-list.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import { Component, h, Method, State } from '@stencil/core';
2+
import { Icon } from 'common/Icon';
3+
import { IconNamesEnum } from 'common/Icon/icon.types';
24
import { ConnectionMonitor } from 'utils/ConnectionMonitor';
35
import type { IEventBus } from 'utils/EventBus';
46
import { EventBus } from 'utils/EventBus';
@@ -18,6 +20,7 @@ export class ToastList {
1820
@State() transactionToasts: ITransactionToast[] = [];
1921
@State() customToasts: CustomToastType[] = [];
2022
@State() isVisible: boolean = true;
23+
@State() isMinimized: boolean = false;
2124

2225
@Method()
2326
async getEventBus() {
@@ -80,24 +83,40 @@ export class ToastList {
8083
this.customToasts = [...payload];
8184
};
8285

86+
private readonly toggleMinimize = () => {
87+
this.isMinimized = !this.isMinimized;
88+
};
89+
8390
private resetState() {
8491
this.transactionToasts = [];
8592
this.customToasts = [];
8693
this.isVisible = true;
94+
this.isMinimized = false;
8795
}
8896

8997
render() {
9098
const hasTransactionToasts = this.transactionToasts?.length > 0;
9199

100+
const toastListClasses = {
101+
'toast-list': true,
102+
'toast-list-bottom': hasTransactionToasts,
103+
'hidden': !this.isVisible,
104+
};
105+
106+
if (this.isMinimized && hasTransactionToasts) {
107+
return (
108+
<div class={toastListClasses} id="toast-list">
109+
<div class="view-all-button-container">
110+
<button class="maximize-button" onClick={this.toggleMinimize} aria-label="Maximize Toasts">
111+
<Icon name={IconNamesEnum.maximize} />
112+
</button>
113+
</div>
114+
</div>
115+
);
116+
}
117+
92118
return (
93-
<div
94-
class={{
95-
'toast-list': true,
96-
'toast-list-bottom': hasTransactionToasts,
97-
'hidden': !this.isVisible,
98-
}}
99-
id="toast-list"
100-
>
119+
<div class={toastListClasses} id="toast-list">
101120
{this.customToasts?.map(toast => (
102121
<mvx-generic-toast toast={toast} onDeleteToast={() => this.handleCustomToastDelete(toast.toastId)} />
103122
))}
@@ -108,6 +127,9 @@ export class ToastList {
108127

109128
{hasTransactionToasts && (
110129
<div class="view-all-button-container">
130+
<button class="minimize-button" onClick={this.toggleMinimize} aria-label="Minimize Toasts">
131+
<Icon name={IconNamesEnum.minimize} />
132+
</button>
111133
<button class="view-all-button" onClick={this.handleViewAllClick}>
112134
View All
113135
</button>

0 commit comments

Comments
 (0)