forked from flyerman/lace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(staking): enable success and failure steps in staking drawer (#267)
* chore(all): fix gitignore pattern * feat(staking): enable success and failure steps in staking drawer * feat(staking): add different staking error icon for popupView --------- Co-authored-by: Szymon Masłowski <szymon.maslowski@iohk.io>
- Loading branch information
1 parent
75855e2
commit 3e62376
Showing
16 changed files
with
473 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ coverage | |
/.cache | ||
|
||
# Nix | ||
result* | ||
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
packages/staking/src/features/drawer/ResultMessage.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
@import '../../../../../packages/common/src/ui/styles/theme.scss'; | ||
@import '../../../../../packages/common/src/ui/styles/abstracts/typography'; | ||
|
||
.content { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
gap: size_unit(4); | ||
|
||
.title { | ||
color: var(--text-color-primary); | ||
font-size: var(--heading); | ||
font-weight: 700; | ||
line-height: size_unit(5); | ||
letter-spacing: -0.015em; | ||
text-align: center; | ||
margin-bottom: 0 !important; | ||
|
||
max-width: 435px; | ||
|
||
@media (max-width: $breakpoint-popup) { | ||
font-size: var(--heading); | ||
line-height: size_unit(4); | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.description { | ||
color: var(--text-color-secondary) !important; | ||
font-size: var(--body); | ||
font-weight: 500; | ||
line-height: size_unit(3); | ||
text-align: center; | ||
margin-bottom: 0 !important; | ||
max-width: 450px; | ||
padding: 10px; | ||
|
||
@media (max-width: $breakpoint-popup) { | ||
max-width: 260px; | ||
padding: 0; | ||
font-size: var(--body); | ||
line-height: size_unit(3); | ||
margin-bottom: 0; | ||
} | ||
} | ||
.vertical { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: size_unit(2); | ||
} | ||
.img { | ||
height: size_unit(14); | ||
width: size_unit(14); | ||
@media (max-width: $breakpoint-popup) { | ||
width: size_unit(11); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import ExclamationSmall from './exclamation-circle-small.svg'; | ||
import Exclamation from './exclamation-circle.svg'; | ||
import styles from './ResultMessage.module.scss'; | ||
import Success from './success-staking.svg'; | ||
|
||
type Status = 'success' | 'error'; | ||
|
||
const iconByStatus: Record<Status, React.FC<React.SVGProps<SVGSVGElement>>> = { | ||
error: Exclamation, | ||
success: Success, | ||
}; | ||
|
||
// TODO discuss with design team if we can have 1 error icon and just manipulate its size | ||
const popupViewIconByStatus: Record<Status, React.FC<React.SVGProps<SVGSVGElement>>> = { | ||
...iconByStatus, | ||
error: ExclamationSmall, | ||
}; | ||
|
||
export interface ResultMessageProps { | ||
status?: Status; | ||
title: React.ReactNode; | ||
description: React.ReactNode; | ||
popupView?: boolean; | ||
} | ||
|
||
export const ResultMessage = ({ | ||
status = 'success', | ||
title, | ||
description, | ||
popupView, | ||
}: ResultMessageProps): React.ReactElement => { | ||
const Icon = popupView ? popupViewIconByStatus[status] : iconByStatus[status]; | ||
|
||
return ( | ||
<div className={styles.content} data-testid="result-message-content"> | ||
<Icon className={styles.img} data-testid="result-message-img" /> | ||
<div className={styles.vertical}> | ||
<h4 className={styles.title} data-testid="result-message-title"> | ||
{title} | ||
</h4> | ||
<h5 className={styles.description} data-testid="result-message-description"> | ||
{description} | ||
</h5> | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
packages/staking/src/features/drawer/TransactionComplete.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
@import '../../../../../packages/common/src/ui/styles/theme.scss'; | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
height: 100%; | ||
} | ||
|
||
.header { | ||
.title { | ||
align-items: center; | ||
color: var(--text-color-black); | ||
display: flex; | ||
font-size: var(--heading); | ||
font-weight: bold; | ||
line-height: size_unit(4); | ||
} | ||
.subTitle { | ||
color: var(--text-color-secondary); | ||
font-size: var(--bodyLarge); | ||
font-weight: 600; | ||
line-height: size_unit(3); | ||
margin-top: size_unit(2); | ||
} | ||
} | ||
|
||
.password { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.footer { | ||
.confirmBtn { | ||
width: 100%; | ||
} | ||
} | ||
|
||
.footerFail { | ||
display: flex; | ||
gap: size_unit(2); | ||
justify-content: space-between; | ||
flex-direction: column-reverse; | ||
} | ||
|
||
.popupView { | ||
&.container { | ||
.header { | ||
padding-left: size_unit(3); | ||
padding-right: size_unit(3); | ||
.title { | ||
font-weight: 700; | ||
font-size: var(-subHeading); | ||
line-height: size_unit(4); | ||
} | ||
.subTitle { | ||
font-size: var(--body); | ||
margin-top: size_unit(2); | ||
} | ||
} | ||
img { | ||
max-width: initial; | ||
max-height: initial; | ||
} | ||
&.fail { | ||
img { | ||
width: 100px; | ||
max-width: initial; | ||
} | ||
} | ||
.footer, | ||
.footerFail { | ||
box-shadow: 0px -2px 4px rgba(0, 0, 0, 0.05); | ||
padding: size_unit(2) size_unit(3) 0px size_unit(3); | ||
} | ||
} | ||
} | ||
|
||
.containerFail { | ||
display: flex; | ||
align-items: center; | ||
height: 80%; | ||
justify-content: center; | ||
} |
Oops, something went wrong.