Skip to content

Commit

Permalink
Merge pull request #65 from contacto-io/bug/CNTO-7295-INACTIVITY-UX-R…
Browse files Browse the repository at this point in the history
…EVIEW

bug: added compact variant for alert component
  • Loading branch information
mimanshi-plivo authored Sep 19, 2023
2 parents 6ddd2ef + 2a4c48f commit ab4f417
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"registry": "https://npm.pkg.github.com"
},
"repository": "git://github.com/contacto-io/contacto-console",
"version": "0.5.28",
"version": "0.5.32",
"main": "build/index.js",
"module": "build/index.es.js",
"files": [
Expand Down
13 changes: 11 additions & 2 deletions src/components/Alert/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ const iconMap = {
/**
* Component that is used to show alert messages on the UI
*/
export const Alert = ({ className = '', type, message, ...props }) => {
export const Alert = ({ className = '', type, message, size = 'default', ...props }) => {
return (
<div
className={['sg contacto-alert', `contacto-alert--${type}`, className].join(' ')}
className={[
'sg contacto-alert',
`contacto-alert--${type}`,
`contacto-alert--${size}`,
className,
].join(' ')}
{...props}
>
<div className="contacto-alert-icon">
Expand All @@ -43,6 +48,10 @@ Alert.propTypes = {
* The alert message to be displayed
*/
message: PropTypes.string,
/**
* Variant of alert (default/compact).
*/
size: PropTypes.oneOf(['default', 'compact']),
}

Alert.defaultProps = {}
7 changes: 7 additions & 0 deletions src/components/Alert/index.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export default {

const Template = (args) => <Alert {...args} />

export const Compact = Template.bind({})
Compact.args = {
message: 'This is a warning banner of size compact',
type: 'info',
size: 'compact',
}

export const Default = Template.bind({})
Default.args = {
message: 'This is a warning banner',
Expand Down
5 changes: 5 additions & 0 deletions src/components/Alert/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
line-height: 0;
color: var(--base-color);
background-color: var(--bg-color);

&--compact {
padding: 8px;
gap: 8px;
}

&--success {
--base-color: var(--success-color);
Expand Down

0 comments on commit ab4f417

Please sign in to comment.