Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
Merge 27abee8 into 86af033
Browse files Browse the repository at this point in the history
  • Loading branch information
plbabin committed Apr 9, 2019
2 parents 86af033 + 27abee8 commit 3c5101d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/BlankSlate/BlankSlate.css.js
Expand Up @@ -7,8 +7,8 @@ import Text from '../Text'
import Illo from '../Illo'

export const IlloUI = styled(Illo)`
padding-bottom: 18px;
margin: 0;
margin-bottom: 18px;
align-self: center;
`

Expand Down
5 changes: 4 additions & 1 deletion src/components/BlankSlate/BlankSlate.tsx
Expand Up @@ -12,6 +12,7 @@ interface Props {
message?: string | React.ReactNode
title?: string
illoName?: string
illoSize?: number
lightBackground?: boolean
alignTop?: boolean
}
Expand All @@ -20,13 +21,15 @@ class BlankSlate extends React.PureComponent<Props> {
static defaultProps = {
lightBackground: false,
alignTop: false,
illoSize: 80,
}

render() {
const {
className,
children,
illoName,
illoSize,
title,
message,
lightBackground,
Expand All @@ -43,7 +46,7 @@ class BlankSlate extends React.PureComponent<Props> {

return (
<BlankSlateUI {...getValidProps(rest)} className={componentClassName}>
{illoName && <IlloUI name={illoName} size="80" />}
{illoName && <IlloUI name={illoName} size={illoSize} />}
{title && <HeadingUI size="h3">{title}</HeadingUI>}
{message && <TextUI>{message}</TextUI>}
</BlankSlateUI>
Expand Down
9 changes: 9 additions & 0 deletions src/components/BlankSlate/__tests__/BlankSlate.test.tsx
Expand Up @@ -78,4 +78,13 @@ describe('Illo', () => {
const component = wrapper.find(IlloUI)
expect(component.length).toBeFalsy()
})

test('Render illo size if set in props', () => {
const wrapper = mount(
<BlankSlate illoName="chatListBlankSlate" illoSize={90} />
)
const o = wrapper.find(IlloUI)

expect(o.first().prop('size')).toBe(90)
})
})
2 changes: 2 additions & 0 deletions src/components/Illo/illos.all.js
Expand Up @@ -7,6 +7,7 @@ import lock from '../../illos/lock.svg'
import plane from '../../illos/plane.svg'
import search from '../../illos/search.svg'
import tick from '../../illos/tick.svg'
import spotMiscEmpty from '../../illos/spot-misc-empty.svg'

export default {
bulb,
Expand All @@ -17,5 +18,6 @@ export default {
lock,
plane,
search,
'spot-misc-empty': spotMiscEmpty,
tick,
}
2 changes: 1 addition & 1 deletion src/components/Illo/styles/Illo.css.js
Expand Up @@ -6,7 +6,7 @@ import forEach from '../../../styles/utilities/forEach'
import { BEM } from '../../../utilities/classNames'

export const ILLO_DEFAULT_SIZE = 40
export const ILLO_SIZES = [ILLO_DEFAULT_SIZE, 60, 72, 80]
export const ILLO_SIZES = [ILLO_DEFAULT_SIZE, 60, 72, 80, 90]

const bem = BEM('.c-Illo')

Expand Down
3 changes: 2 additions & 1 deletion src/components/Illo/types.js
Expand Up @@ -2,4 +2,5 @@ export type IlloSize =
| '40'
| '60'
| '72'
| '80'
| '80'
| '90'
1 change: 1 addition & 0 deletions src/illos/spot-misc-empty.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions stories/BlankSlate.stories.js
Expand Up @@ -20,7 +20,7 @@ const message = () =>
`No results found for "boopable". Please try another search term.`
)
const title = (title = 'No Customers yet') => text('title', title)
const illoName = (illoName = 'chatListBlankSlate') => text('illoName', illoName)
const illoName = (illoName = 'spot-misc-empty') => text('illoName', illoName)

const htmlMessage = (
<span>
Expand Down Expand Up @@ -53,6 +53,7 @@ stories.add('Illo', () => {
title: title(''),
illoName: illoName(),
message: htmlMessage,
illoSize: 90,
}
return <BlankSlate {...getKnobsProps()} {...props} />
})
Expand All @@ -68,6 +69,7 @@ stories.add('Light background', () => {
illoName: illoName(),
lightBackground: boolean('lightBackground', true),
message: htmlMessage,
illoSize: 90,
}
return <BlankSlate {...props} />
})
Expand All @@ -81,7 +83,12 @@ storiesHsApp.addDecorator(
storiesHsApp.addDecorator(withHsApp)

storiesHsApp.add('default', () => {
const props = { title: title(), illoName: illoName(), message: htmlMessage }
const props = {
title: title(),
illoName: illoName(),
message: htmlMessage,
illoSize: number('illoSize', 90),
}
return <BlankSlate {...getKnobsProps()} {...props} />
})

Expand All @@ -92,6 +99,7 @@ storiesHsApp.add('Light background', () => {
lightBackground: boolean('lightBackground', true),
alignTop: boolean('alignTop', false),
message: htmlMessage,
illoSize: 90,
}
return (
<div style={{ height: '800px' }}>
Expand All @@ -107,6 +115,7 @@ storiesHsApp.add('Align top', () => {
lightBackground: boolean('lightBackground', true),
alignTop: boolean('alignTop', true),
message: htmlMessage,
illoSize: 90,
}

return (
Expand Down

0 comments on commit 3c5101d

Please sign in to comment.