-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Notification * re-name utility to avoid rule of hooks * v0.3.0
- Loading branch information
1 parent
798a17c
commit d883620
Showing
21 changed files
with
789 additions
and
118 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import { | ||
Icon, | ||
InfoOutline, | ||
InfoFilled, | ||
AlertTriangleOutline, | ||
AlertTriangleFilled, | ||
AlertCircleOutline, | ||
AlertCircleFilled, | ||
CheckmarkCircleOutline, | ||
CheckmarkCircleFilled, | ||
} from '../icon'; | ||
import { SeverityLevel } from '../types'; | ||
|
||
type IconOptions = { | ||
/** | ||
* Whether or not the icon should be filled-in or outlined | ||
* @default true | ||
*/ | ||
filled?: boolean; | ||
}; | ||
export function getSeverityIcon( | ||
severity: SeverityLevel, | ||
{ filled }: IconOptions = { filled: true } | ||
) { | ||
let svg; | ||
switch (severity) { | ||
case 'warning': | ||
svg = filled ? <AlertTriangleFilled /> : <AlertTriangleOutline />; | ||
break; | ||
case 'info': | ||
svg = filled ? <InfoFilled /> : <InfoOutline />; | ||
break; | ||
case 'danger': | ||
svg = filled ? <AlertCircleFilled /> : <AlertCircleOutline />; | ||
break; | ||
case 'success': | ||
svg = filled ? <CheckmarkCircleFilled /> : <CheckmarkCircleOutline />; | ||
break; | ||
} | ||
return <Icon svg={svg} />; | ||
} |
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,27 @@ | ||
import { css } from '@emotion/core'; | ||
import { transparentize } from 'polished'; | ||
import theme from '../theme'; | ||
|
||
export const warningCSS = css` | ||
border: 1px solid ${theme.colors.statusWarning}; | ||
background-color: ${transparentize(0.85, theme.colors.statusWarning)}; | ||
color: ${theme.colors.statusWarning}; | ||
`; | ||
|
||
export const infoCSS = css` | ||
border: 1px solid ${theme.colors.statusInfo}; | ||
background-color: ${transparentize(0.85, theme.colors.statusInfo)}; | ||
color: ${theme.colors.statusInfo}; | ||
`; | ||
|
||
export const dangerCSS = css` | ||
border: 1px solid ${theme.colors.statusDanger}; | ||
background-color: ${transparentize(0.85, theme.colors.statusDanger)}; | ||
color: ${theme.colors.statusDanger}; | ||
`; | ||
|
||
export const successCSS = css` | ||
border: 1px solid ${theme.colors.statusSuccess}; | ||
background-color: ${transparentize(0.85, theme.colors.statusSuccess)}; | ||
color: ${theme.colors.statusSuccess}; | ||
`; |
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,21 @@ | ||
import { SeverityLevel } from '../types'; | ||
import { warningCSS, infoCSS, dangerCSS, successCSS } from './styles'; | ||
|
||
export function useSeverityStyle(severity: SeverityLevel) { | ||
let style; | ||
switch (severity) { | ||
case 'warning': | ||
style = warningCSS; | ||
break; | ||
case 'info': | ||
style = infoCSS; | ||
break; | ||
case 'danger': | ||
style = dangerCSS; | ||
break; | ||
case 'success': | ||
style = successCSS; | ||
break; | ||
} | ||
return style; | ||
} |
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,53 @@ | ||
import { css } from '@emotion/core'; | ||
import theme from '../theme'; | ||
|
||
export const buttonCSS = css` | ||
border: 1px solid ${theme.colors.dark1}; | ||
font-size: ${theme.typography.sizes.medium}; | ||
font-weight: 600; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
box-sizing: content-box; | ||
border-radius: 4px; | ||
color: ${theme.textColors.white90}; | ||
cursor: pointer; | ||
&:not([disabled]) { | ||
transition: all 0.2s ease-in-out; | ||
} | ||
&[disabled] { | ||
color: ${theme.textColors.white70}; | ||
cursor: not-allowed; | ||
} | ||
&[data-size='normal'][data-childless='false'] { | ||
padding: ${theme.spacing.padding8}px ${theme.spacing.padding16}px; | ||
} | ||
&[data-size='compact'][data-childless='false'] { | ||
padding: ${theme.spacing.padding4}px ${theme.spacing.padding8}px; | ||
} | ||
&[data-size='normal'][data-childless='true'] { | ||
padding: ${theme.spacing.padding8}px ${theme.spacing.padding8}px; | ||
} | ||
&[data-size='compact'][data-childless='true'] { | ||
padding: ${theme.spacing.padding4}px ${theme.spacing.padding4}px; | ||
} | ||
&[data-variant='primary'] { | ||
background-color: ${theme.colors.arizeBlue}; | ||
border-color: ${theme.components.button.primaryBorderColor}; | ||
&:hover:not([disabled]) { | ||
background-color: ${theme.components.button.primaryHoverBackgroundColor}; | ||
} | ||
} | ||
&[data-variant='default'] { | ||
background-color: ${theme.colors.gray500}; | ||
border-color: ${theme.components.button.defaultBorderColor}; | ||
&:hover:not([disabled]) { | ||
background-color: ${theme.components.button.defaultHoverBackgroundColor}; | ||
} | ||
} | ||
&[data-childless='false'] > i, | ||
& > .ac-spinner { | ||
margin-right: ${theme.spacing.margin4}px; | ||
} | ||
`; |
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
Oops, something went wrong.