Skip to content

Commit

Permalink
Feat #7 - Added space-around and flex-end to styleguide. Adjusted sto…
Browse files Browse the repository at this point in the history
…ries. Added icon for closing banner
  • Loading branch information
mishevong committed Mar 23, 2021
1 parent bc7dd9c commit 7bce962
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
41 changes: 16 additions & 25 deletions src/components/Banner/Banner.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { ev as NotificationTypes } from '@dassana-io/web-utils'
import React from 'react'
import { Banner, BannerProps } from '.'
import { Meta, Story } from '@storybook/react'
import { createUseStyles } from 'react-jss'
import { ev as NotificationTypes } from '@dassana-io/web-utils'

const useStyles = createUseStyles({
test: {
backgroundColor: 'red'
}
})

export default {
argTypes: {
Expand All @@ -21,45 +14,43 @@ export default {

const Template: Story<BannerProps> = args => <Banner {...args} />

export const Test = Template.bind({})
Test.args = {
children: 'this is a long ass message',
title: 'hello',
type: NotificationTypes.info
}

export const Error = Template.bind({})
Error.args = {
children: 'This is an alert for information',
title: 'Information',
children:
'Once we receive an alert we scan it against policy risk rules. The rules are evaluated in order from top to bottom. The first rule that matches determines the risk of the alert. Updating a rule will not impact the past alerts. However you can use past alerts as a reference to edit rules such that future alerts get your desired risk classification.',
title: 'Error',
type: NotificationTypes.error
}

export const Info = Template.bind({})
Info.args = {
children: 'This is an alert for information',
title: 'Information',
children:
'Once we receive an alert we scan it against policy risk rules. The rules are evaluated in order from top to bottom. The first rule that matches determines the risk of the alert. Updating a rule will not impact the past alerts. However you can use past alerts as a reference to edit rules such that future alerts get your desired risk classification.',
title: 'Info',
type: NotificationTypes.info
}

export const Success = Template.bind({})
Success.args = {
children: 'This is an alert for information',
title: 'Information',
children:
'Once we receive an alert we scan it against policy risk rules. The rules are evaluated in order from top to bottom. The first rule that matches determines the risk of the alert. Updating a rule will not impact the past alerts. However you can use past alerts as a reference to edit rules such that future alerts get your desired risk classification.',
title: 'Success',
type: NotificationTypes.success
}

export const Warning = Template.bind({})
Warning.args = {
children: 'This is an alert for information',
title: 'Information',
children:
'Once we receive an alert we scan it against policy risk rules. The rules are evaluated in order from top to bottom. The first rule that matches determines the risk of the alert. Updating a rule will not impact the past alerts. However you can use past alerts as a reference to edit rules such that future alerts get your desired risk classification.',
title: 'Warning',
type: NotificationTypes.warning
}

export const NoIcon = Template.bind({})
NoIcon.args = {
children: 'This is an alert for information',
children:
'Once we receive an alert we scan it against policy risk rules. The rules are evaluated in order from top to bottom. The first rule that matches determines the risk of the alert. Updating a rule will not impact the past alerts. However you can use past alerts as a reference to edit rules such that future alerts get your desired risk classification.',
showIcon: false,
title: 'Information',
title: 'No Icon',
type: NotificationTypes.success
}
5 changes: 4 additions & 1 deletion src/components/Banner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import cn from 'classnames'
import { createUseStyles } from 'react-jss'
import { faTimes } from '@fortawesome/free-solid-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { mappedTypesToIcons } from 'components/NotificationV2/utils'
import { ev as NotificationTypes } from '@dassana-io/web-utils'
Expand Down Expand Up @@ -43,7 +44,9 @@ export const Banner: FC<BannerProps> = ({
)}
<p>{title}</p>
</div>
<div onClick={() => toggleRender()}>close</div>
<div onClick={() => toggleRender()}>
<FontAwesomeIcon icon={faTimes} />
</div>
</div>
<div>{children}</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions src/components/assets/styles/styleguide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ export const styleguide = {
display: 'flex',
justifyContent: 'flex-end'
},
flexJustifyStart: {
display: 'flex',
justifyContent: 'flex-start'
},
flexSpaceAround: {
display: 'flex',
justifyContent: 'space-around'
},
flexSpaceBetween: {
display: 'flex',
justifyContent: 'space-between'
Expand Down

0 comments on commit 7bce962

Please sign in to comment.