-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added new banner component to show messages in Bazecor (#536)
Co-authored-by: Thiago Hernandez <thiago.hernandez@gmail.com>
- Loading branch information
1 parent
dd8b15f
commit 7b2d529
Showing
6 changed files
with
84 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from "react"; | ||
|
||
import Styled from "styled-components"; | ||
|
||
interface BannerProps { | ||
variant?: "warning" | "danger" | "success" | "info"; | ||
children: React.ReactNode; | ||
icon?: React.ReactNode; | ||
} | ||
const BannerWrapper = Styled.div` | ||
border-radius: 8px; | ||
padding: 24px; | ||
color: ${({ theme }) => theme.styles.banner.textWarning}; | ||
.banner-inner { | ||
display: flex; | ||
grid-gap: 24px; | ||
} | ||
p { | ||
font-weight: 401; | ||
font-size: 0.85em; | ||
} | ||
p:last-of-type { | ||
margin-bottom: 0; | ||
} | ||
&.warning { | ||
background: ${({ theme }) => theme.styles.banner.backgroundWarning}; | ||
border: 1px solid rgba(255, 159, 67,0.25); | ||
.banner-icon { | ||
background: ${({ theme }) => theme.styles.banner.svgBackgroundWarning}; | ||
} | ||
} | ||
.banner-icon { | ||
display: flex; | ||
flex: 0 0 42px; | ||
width: 42px; | ||
height: 42px; | ||
border-radius: 50%; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
`; | ||
|
||
const Banner = ({ variant = "info", icon, children }: BannerProps) => ( | ||
<BannerWrapper className={`${variant}`}> | ||
<div className="banner-inner"> | ||
{icon && <div className="banner-icon">{icon}</div>} | ||
<div className="banner-content">{children}</div> | ||
</div> | ||
</BannerWrapper> | ||
); | ||
|
||
export default Banner; |
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,3 @@ | ||
import Banner from "./Banner"; | ||
|
||
export { Banner }; |
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