-
Notifications
You must be signed in to change notification settings - Fork 8
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
banner view implemented #213
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
72d1464
banner view implemented
iamavishkar ae61027
code changes as per recent review
iamavishkar 00c7c12
usage of banner view
iamavishkar 1421ca7
Banner View Webpack config changed
vishal753 d1cd74b
.babelrc config changed
vishal753 1ebf8f3
Merge branch 'embedded' into DEV-103-BannerView
devcsomnicg 8f01a76
[MOB-7175]: add new filter method that leaves in JSON only messages (…
mprew97 7ab20a0
ver bump (#240)
mprew97 482da79
Merge branch 'embedded' of into DEV-103-BannerView
hani329 6156a85
Merge branch 'Iterable:main' into DEV-103-BannerView
devcsomnicg 622536c
Merge branch 'embedded' of into DEV-103-BannerView
hani329 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,111 @@ | ||
import React, { CSSProperties } from "react"; | ||
interface IBannerProps { | ||
heading: string; | ||
body: string; | ||
buttonText: string; | ||
logo: string; | ||
buttonStyles?: CSSProperties; | ||
bannerStyles?: CSSProperties; | ||
logoStyles?: CSSProperties; | ||
headingStyles?: CSSProperties; | ||
bodyStyles?: CSSProperties; | ||
buttonClickHandler?: Function; | ||
} | ||
|
||
const Banner = (props: IBannerProps) => { | ||
const { | ||
heading, | ||
body, | ||
buttonText, | ||
logo, | ||
bannerStyles, | ||
buttonStyles, | ||
logoStyles, | ||
headingStyles, | ||
bodyStyles, | ||
buttonClickHandler, | ||
} = props; | ||
|
||
const defaultBannerStyles = { | ||
display: "flex", | ||
alignItems: "center", | ||
backgroundColor: "#ffffff", | ||
padding: "20px", | ||
margin: "20px", | ||
borderRadius: "8px", | ||
boxShadow: "0 2px 6px rgba(0, 0, 0, 0.3)", | ||
}; | ||
const defaultHeadingStyles = { | ||
fontSize: "25px", | ||
marginBottom: "20px", | ||
marginRight: "20px", | ||
}; | ||
const defaultBodyStyles = { | ||
fontSize: "16px", | ||
marginBottom: "20px", | ||
marginRight: "20px", | ||
}; | ||
const defaultButtonStyles = { | ||
backgroundColor: "#6c016cf5", | ||
color: "#fff", | ||
padding: "10px 20px", | ||
border: "none", | ||
borderRadius: "40px", | ||
cursor: "pointer", | ||
marginBottom: "20px", | ||
}; | ||
const defaultLogoStyles = { | ||
width: "100%", | ||
height: "auto", | ||
}; | ||
|
||
return ( | ||
<div | ||
className="banner-container" | ||
style={{ ...defaultBannerStyles, ...bannerStyles }} | ||
> | ||
<div className="content-container "> | ||
<h2 style={{ ...defaultHeadingStyles, ...headingStyles }}>{heading}</h2> | ||
<p style={{ ...defaultBodyStyles, ...bodyStyles }}>{body}</p> | ||
<button | ||
style={{ ...defaultButtonStyles, ...buttonStyles }} | ||
onClick={ | ||
buttonClickHandler as React.MouseEventHandler<HTMLButtonElement> | ||
} | ||
> | ||
{buttonText} | ||
</button> | ||
</div> | ||
<div style={{ marginRight: "20px" }}> | ||
<img | ||
src={logo} | ||
alt="Logo" | ||
style={{ ...defaultLogoStyles, ...logoStyles }} | ||
/> | ||
</div> | ||
|
||
<style> | ||
{` | ||
@media (max-width: 600px) { | ||
.banner-container { | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
.banner-container > .content-container { | ||
margin-bottom: 20px; | ||
order: 2; | ||
max-width:75%; | ||
} | ||
.banner-container > div:last-child { | ||
order: 1; | ||
margin-bottom: 0; | ||
} | ||
} | ||
`} | ||
</style> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Banner; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd really like to find a decent library to implement granular css styles like this. can this not be passed in directly to the
style
props same as the others? As much as possible, would prefer to pull this out of the actual component tree.