forked from samuellawerentz/style-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Top banner #60
Merged
Merged
Top banner #60
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9a3939f
feat: added top banner
mimanshi-plivo a3f0dc8
fix: fixes font weight of banner content
mimanshi-plivo 66b6e80
fix: block import
mimanshi-plivo 4de33b7
fix: added new button and code review cahnges
mimanshi-plivo 2c69e9f
chore: published version 0.5.13
mimanshi-plivo 2c8df3a
fix: fixes banner css
mimanshi-plivo 5e8bc34
fix: updated with main
mimanshi-plivo 338f56c
chor: updated version to 0.5.20
mimanshi-plivo ca274a5
fix: updated with staging
mimanshi-plivo 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react' | ||
import { TopBanner, BannerType } from './' | ||
import { Button } from '../Button' | ||
|
||
export default { | ||
title: 'Components/TopBanner', | ||
component: TopBanner, | ||
argTypes: { | ||
type: { | ||
options: BannerType, | ||
control: { type: 'select' }, | ||
}, | ||
}, | ||
} | ||
|
||
const Template = (args) => <TopBanner {...args} /> | ||
|
||
export const Default = Template.bind({}) | ||
Default.args = { | ||
visible: true, | ||
content: 'This is default type banner.', | ||
} | ||
|
||
export const Success = Template.bind({}) | ||
Success.args = { | ||
visible: true, | ||
content: 'This is success type banner.', | ||
type: 'success', | ||
} | ||
|
||
export const Danger = Template.bind({}) | ||
Danger.args = { | ||
visible: true, | ||
content: 'This is danger type banner.', | ||
type: 'danger', | ||
} | ||
|
||
export const Warning = Template.bind({}) | ||
Warning.args = { | ||
visible: true, | ||
content: 'This is warning type banner.', | ||
type: 'warning', | ||
} | ||
|
||
export const BannerWithButton = Template.bind({}) | ||
BannerWithButton.args = { | ||
visible: true, | ||
content: 'This is banner with action button.', | ||
type: 'default', | ||
buttons: [ | ||
<Button | ||
label="Alert" | ||
key="button" | ||
onClick={() => alert('Banner button clicked!')} | ||
size="small" | ||
type="link" | ||
variant="underline" | ||
/>, | ||
], | ||
} | ||
|
||
export const BannerWithLoading = Template.bind({}) | ||
BannerWithLoading.args = { | ||
visible: true, | ||
content: 'This is banner with action button.', | ||
type: 'danger', | ||
loading: true, | ||
} |
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,36 @@ | ||
import React from 'react' | ||
import { Block } from '../Block/index' | ||
import { Icon } from '../Icon/index' | ||
import { Text } from '../Typography/index' | ||
import './topbanner.scss' | ||
|
||
export const BannerType = ['warning', 'danger', 'success', 'default'] | ||
export const TopBanner = ({ | ||
type = 'default', | ||
content, | ||
buttons, | ||
loading, | ||
visible, | ||
loadingText = 'Loading', | ||
}) => { | ||
return visible ? ( | ||
<Block | ||
className={`top-banner ${type}`} | ||
display="flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
> | ||
{loading && ( | ||
<Block> | ||
<Icon.Loading size={16} trackColor="white" /> | ||
</Block> | ||
)} | ||
<Text color="white">{loading ? loadingText : content}</Text> | ||
{!loading && buttons && ( | ||
<Block display="flex" className="top-banner-buttons-container"> | ||
{buttons.map((button) => button)} | ||
</Block> | ||
)} | ||
</Block> | ||
) : null | ||
} |
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,36 @@ | ||
.top-banner { | ||
height: 36px; | ||
gap: 4px; | ||
|
||
.contacto-typography--body { | ||
text-align: center; | ||
} | ||
|
||
&-buttons-container { | ||
gap: 16px; | ||
|
||
.sg.cnto-btn.contacto-button--small { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we move this style to Button.scss file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be add a new button type <Button type="link" variant="underline" color="white" /> |
||
color: white; | ||
} | ||
.sg.ant-btn.cnto-btn.contacto-button--link:hover { | ||
color: white; | ||
} | ||
} | ||
|
||
&.default { | ||
background-color: var(--primary-text-color); | ||
} | ||
|
||
&.success { | ||
background-color: var(--success-color); | ||
} | ||
|
||
&.danger { | ||
background-color: var(--danger-color); | ||
} | ||
|
||
&.warning { | ||
background-color: var(--warning-color); | ||
} | ||
} | ||
|
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
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.
Is there any hover style required?