Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle and refactor alerts #1429

Merged
merged 3 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions src/app/components/AlertBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,48 @@ import { Box } from 'grommet/es6/components/Box'
import { Text } from 'grommet/es6/components/Text'
import * as React from 'react'

export type AlertBoxColor = 'status-error' | 'status-warning' | 'status-ok' | 'status-ok-weak'

interface Props {
color: 'status-error' | 'status-warning' | 'status-ok'
color: AlertBoxColor
children: React.ReactNode
}

const mapColor = {
'status-error': {
color: 'status-error',
background: 'status-error-background',
},
'status-warning': {
color: 'status-warning',
background: 'status-warning-background',
},
'status-ok': {
color: 'status-ok',
background: 'status-ok-background',
},
'status-ok-weak': {
color: 'status-ok-weak',
background: 'status-ok-weak-background',
},
}

export function AlertBox(props: Props) {
return (
<Box
border={{
color: props.color,
color: mapColor[props.color].color,
side: 'left',
size: '3px',
}}
background={{
color: props.color,
opacity: 'weak',
color: mapColor[props.color].background,
}}
pad={{ horizontal: 'small', vertical: 'xsmall' }}
pad={{ horizontal: 'small', vertical: 'small' }}
>
<Text weight="bold">{props.children}</Text>
<Text weight="bold" size="12px">
{props.children}
</Text>
</Box>
)
}
17 changes: 6 additions & 11 deletions src/app/components/BuildPreviewBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Trans, useTranslation } from 'react-i18next'
import { Alert } from 'grommet-icons/es6/icons/Alert'
import { Info } from 'grommet-icons/es6/icons/Info'
import { Box } from 'grommet/es6/components/Box'
import { Text } from 'grommet/es6/components/Text'
import { AlertBox } from 'app/components/AlertBox'
import { buildPreviewBannerZIndex } from '../../../styles/theme/elementSizes'
import { AnchorLink } from '../AnchorLink'
Expand All @@ -13,7 +12,6 @@ export const BuildPreviewBanner = () => {
if (!process.env.REACT_APP_BUILD_PREVIEW) {
return (
<Box
background={{ color: 'white' }}
style={{
position: 'sticky',
top: 0,
Expand All @@ -23,7 +21,7 @@ export const BuildPreviewBanner = () => {
<AlertBox color="status-ok">
<Box direction="row" gap="small" align="center" justify="center">
<Info color="status-ok" size="20px" />
<Text size="12px">
<span>
<Trans
i18nKey="banner.domainMoved"
t={t}
Expand All @@ -32,7 +30,7 @@ export const BuildPreviewBanner = () => {
}}
defaults="Oasis Wallet has a new home at <NewLink />."
/>
</Text>
</span>
</Box>
</AlertBox>
</Box>
Expand All @@ -41,7 +39,6 @@ export const BuildPreviewBanner = () => {

return (
<Box
background={{ color: 'white' }}
style={{
position: 'sticky',
top: 0,
Expand All @@ -51,12 +48,10 @@ export const BuildPreviewBanner = () => {
<AlertBox color="status-warning">
<Box direction="row" gap="small" align="center" justify="center">
<Alert color="status-warning" size="20px" />
<Text size="12px">
{t(
'buildPreview',
'Please note this is an experimental build of Oasis Wallet and that data that is shown might be incorrect.',
)}
</Text>
{t(
'buildPreview',
'Please note this is an experimental build of Oasis Wallet and that data that is shown might be incorrect.',
)}
</Box>
</AlertBox>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/TransactionStatus/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const TransactionStatus = memo((props: Props) => {
</AlertBox>
)}
{success && (
<AlertBox color="status-ok">
<AlertBox color="status-ok-weak">
{t(
'account.sendTransaction.success',
'Transaction successfully sent. The transaction might take up to a minute to appear on your account.',
Expand Down
6 changes: 4 additions & 2 deletions src/app/pages/AccountPage/Features/AccountSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export function AccountSummary({ address, balance, walletAddress, walletIsOpen }
<>
<Box margin={{ bottom: 'small' }}>
{walletIsOpen && walletAddress === address && (
<AlertBox color="status-ok">{t('account.summary.yourAccount', 'This is your account.')}</AlertBox>
<AlertBox color="status-ok-weak">
{t('account.summary.yourAccount', 'This is your account.')}
</AlertBox>
)}
{walletIsOpen && walletAddress !== address && (
<AlertBox color="status-warning">
Expand All @@ -116,7 +118,7 @@ export function AccountSummary({ address, balance, walletAddress, walletIsOpen }
t={t}
components={{ HomeLink: <AnchorLink to="/" /> }}
values={{ ticker }}
defaults="To send, receive, stake and swap {{ticker}} tokens, <HomeLink>open your wallet!</HomeLink>"
defaults="To send, receive, stake and swap {{ticker}} tokens, <HomeLink>open your wallet</HomeLink>."
/>
</AlertBox>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,15 @@ exports[`<AccountPage /> should match snapshot 1`] = `
display: flex;
box-sizing: border-box;
max-width: 100%;
background-color: rgba(76,212,169,0.25);
background-color: rgba(198,245,234,1);
color: #444444;
border-left: solid 3px #4cd4a9;
min-width: 0;
min-height: 0;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
padding-left: 12px;
padding-right: 12px;
padding-top: 6px;
padding-bottom: 6px;
padding: 12px;
}

.c5 {
Expand Down Expand Up @@ -381,8 +379,8 @@ exports[`<AccountPage /> should match snapshot 1`] = `
}

.c4 {
font-size: 18px;
line-height: 24px;
font-size: 12px;
line-height: normal;
font-weight: bold;
}

Expand Down Expand Up @@ -667,15 +665,7 @@ exports[`<AccountPage /> should match snapshot 1`] = `

@media only screen and (max-width:768px) {
.c3 {
padding-left: 6px;
padding-right: 6px;
}
}

@media only screen and (max-width:768px) {
.c3 {
padding-top: 3px;
padding-bottom: 3px;
padding: 6px;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,15 @@ exports[`<CreateWalletPage /> should match snapshot 1`] = `
display: flex;
box-sizing: border-box;
max-width: 100%;
background-color: rgba(244,206,75,0.25);
background-color: rgba(241,230,201,1);
color: #444444;
border-left: solid 3px #f4ce4b;
min-width: 0;
min-height: 0;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
padding-left: 12px;
padding-right: 12px;
padding-top: 6px;
padding-bottom: 6px;
padding: 12px;
}

.c20 {
Expand Down Expand Up @@ -316,8 +314,8 @@ exports[`<CreateWalletPage /> should match snapshot 1`] = `
}

.c19 {
font-size: 18px;
line-height: 24px;
font-size: 12px;
line-height: normal;
font-weight: bold;
}

Expand Down Expand Up @@ -585,15 +583,7 @@ exports[`<CreateWalletPage /> should match snapshot 1`] = `

@media only screen and (max-width:768px) {
.c18 {
padding-left: 6px;
padding-right: 6px;
}
}

@media only screen and (max-width:768px) {
.c18 {
padding-top: 3px;
padding-bottom: 3px;
padding: 6px;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ exports[`<TransactionConfirmation /> should render EVMc withdraw variant compone

}

@media only screen and (max-width:768px) {

}

<span
class="c0"
data-testid="paraTime-content-description"
Expand Down Expand Up @@ -181,17 +177,15 @@ exports[`<TransactionConfirmation /> should render component 1`] = `
display: flex;
box-sizing: border-box;
max-width: 100%;
background-color: rgba(255,170,21,0.1);
background-color: status-warning-background;
color: #444444;
border-left: solid 3px #FFAA15;
min-width: 0;
min-height: 0;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
padding-left: 12px;
padding-right: 12px;
padding-top: 6px;
padding-bottom: 6px;
padding: 12px;
}

.c9 {
Expand Down Expand Up @@ -346,8 +340,8 @@ exports[`<TransactionConfirmation /> should render component 1`] = `
}

.c8 {
font-size: 18px;
line-height: 24px;
font-size: 12px;
line-height: normal;
font-weight: bold;
}

Expand Down Expand Up @@ -450,15 +444,7 @@ exports[`<TransactionConfirmation /> should render component 1`] = `

@media only screen and (max-width:768px) {
.c7 {
padding-left: 6px;
padding-right: 6px;
}
}

@media only screen and (max-width:768px) {
.c7 {
padding-top: 3px;
padding-bottom: 3px;
padding: 6px;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ exports[`<TransactionError /> should render EVMc withdraw variant component 1`]

}

@media only screen and (max-width:768px) {

}

<span
class="c0"
data-testid="paraTime-content-description"
Expand Down Expand Up @@ -190,17 +186,15 @@ exports[`<TransactionError /> should render component 1`] = `
display: flex;
box-sizing: border-box;
max-width: 100%;
background-color: rgba(179,0,0,0.1);
background-color: status-error-background;
color: #444444;
border-left: solid 3px #B30000;
min-width: 0;
min-height: 0;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
padding-left: 12px;
padding-right: 12px;
padding-top: 6px;
padding-bottom: 6px;
padding: 12px;
}

.c11 {
Expand Down Expand Up @@ -264,8 +258,8 @@ exports[`<TransactionError /> should render component 1`] = `
}

.c9 {
font-size: 18px;
line-height: 24px;
font-size: 12px;
line-height: normal;
font-weight: bold;
}

Expand Down Expand Up @@ -368,15 +362,7 @@ exports[`<TransactionError /> should render component 1`] = `

@media only screen and (max-width:768px) {
.c8 {
padding-left: 6px;
padding-right: 6px;
}
}

@media only screen and (max-width:768px) {
.c8 {
padding-top: 3px;
padding-bottom: 3px;
padding: 6px;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ export const ValidatorStatus = (props: Props) => {
label: t('validator.statusActive', 'Active'),
}),
inactive: () => ({
icon: <StatusCritical color="status-critical" />,
icon: <StatusCritical color="status-error" />,
label: t('validator.statusInactive', 'Inactive'),
}),
unknown: () => ({
icon: <StatusUnknown color="status-critical" />,
icon: <StatusUnknown color="status-error" />,
label: t('validator.statusUnknown', 'Unknown'),
}),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ exports[`<ValidatorList /> list should match snapshot 1`] = `
flex: 0 0 auto;
width: 24px;
height: 24px;
fill: #FF4040;
stroke: #FF4040;
fill: #ff4212;
stroke: #ff4212;
}

.c21 g {
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"total": "Total"
},
"noTransactionFound": "No transactions found.",
"noWalletIsOpen": "To send, receive, stake and swap {{ticker}} tokens, <HomeLink>open your wallet!</HomeLink>",
"noWalletIsOpen": "To send, receive, stake and swap {{ticker}} tokens, <HomeLink>open your wallet</HomeLink>.",
"notYourAccount": "This is not your account.",
"yourAccount": "This is your account."
},
Expand Down
Loading