-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(suite): Replace NotificationCard component with Banner (#15604)
- Loading branch information
Showing
13 changed files
with
93 additions
and
258 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
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
174 changes: 0 additions & 174 deletions
174
packages/suite/src/components/suite/NotificationCard.tsx
This file was deleted.
Oops, something went wrong.
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
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
29 changes: 8 additions & 21 deletions
29
packages/suite/src/components/wallet/WalletLayout/AccountBanners/ContextMessage.tsx
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 |
---|---|---|
@@ -1,40 +1,27 @@ | ||
import styled from 'styled-components'; | ||
|
||
import { Link } from '@trezor/components'; | ||
import { Banner } from '@trezor/components'; | ||
import { selectContextMessageContent, Context } from '@suite-common/message-system'; | ||
|
||
import { NotificationCard } from 'src/components/suite'; | ||
import { useSelector } from 'src/hooks/suite'; | ||
import { selectLanguage } from 'src/reducers/suite/suiteReducer'; | ||
|
||
type ContextMessageProps = { | ||
context: (typeof Context)[keyof typeof Context]; | ||
}; | ||
|
||
const StyledNotificationCard = styled(NotificationCard)` | ||
margin-bottom: 0; | ||
`; | ||
|
||
export const ContextMessage = ({ context }: ContextMessageProps) => { | ||
const language = useSelector(selectLanguage); | ||
const message = useSelector(state => selectContextMessageContent(state, context, language)); | ||
|
||
return message ? ( | ||
<StyledNotificationCard | ||
button={ | ||
message.cta | ||
? { | ||
children: ( | ||
<Link variant="nostyle" href={message.cta.link}> | ||
{message.cta.label} | ||
</Link> | ||
), | ||
} | ||
: undefined | ||
} | ||
<Banner | ||
variant={message.variant === 'critical' ? 'destructive' : message.variant} | ||
rightContent={ | ||
message.cta ? ( | ||
<Banner.Button href={message.cta.link}>{message.cta.label}</Banner.Button> | ||
) : undefined | ||
} | ||
> | ||
{message.content} | ||
</StyledNotificationCard> | ||
</Banner> | ||
) : null; | ||
}; |
Oops, something went wrong.