Skip to content

Commit

Permalink
Add storybook to github pages to travis
Browse files Browse the repository at this point in the history
  • Loading branch information
jducro committed Oct 7, 2019
1 parent 54ccac3 commit 568ae27
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 24 deletions.
17 changes: 12 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ branches:
only:
- master
deploy:
provider: npm
api_key: '${NPM_TOKEN}'
skip_cleanup: true
on:
tags: true
- provider: npm
email: '[email protected]'
api_key: '${NPM_TOKEN}'
skip_cleanup: true
on:
tags: true
- provider: script
skip_cleanup: true
script:
- lerna run --scope @deskpro/content-editor-storybook deploy-storybook -- -- --ci
on:
branch: master
8 changes: 4 additions & 4 deletions src/components/picker/nimble-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export default class NimblePicker extends React.PureComponent {
continue
}

if (props.emojisToShowFilter) {
if (props.iconsToShowFilter) {
let newEmojis = []

const { icons } = category
for (let emojiIndex = 0; emojiIndex < icons.length; emojiIndex++) {
const emoji = icons[emojiIndex]
if (props.emojisToShowFilter(this.data.emojis[emoji] || emoji)) {
if (props.iconsToShowFilter(this.data.emojis[emoji] || emoji)) {
newEmojis.push(emoji)
}
}
Expand Down Expand Up @@ -452,7 +452,7 @@ export default class NimblePicker extends React.PureComponent {
color,
native,
backgroundImageFn,
emojisToShowFilter,
iconsToShowFilter,
showPreview,
showColorPicker,
emojiTooltip,
Expand Down Expand Up @@ -491,7 +491,7 @@ export default class NimblePicker extends React.PureComponent {
onSearch={this.handleSearch}
data={this.data}
i18n={this.i18n}
emojisToShowFilter={emojisToShowFilter}
iconsToShowFilter={iconsToShowFilter}
include={include}
exclude={exclude}
custom={this.CUSTOM_CATEGORY.emojis}
Expand Down
6 changes: 3 additions & 3 deletions src/components/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class Search extends React.PureComponent {

this.props.onSearch(
this.iconIndex.search(value, {
emojisToShowFilter: this.props.emojisToShowFilter,
iconsToShowFilter: this.props.iconsToShowFilter,
maxResults: this.props.maxResults,
include: this.props.include,
exclude: this.props.exclude,
Expand Down Expand Up @@ -117,13 +117,13 @@ export default class Search extends React.PureComponent {
Search.propTypes /* remove-proptypes */ = {
onSearch: PropTypes.func,
maxResults: PropTypes.number,
emojisToShowFilter: PropTypes.func,
iconsToShowFilter: PropTypes.func,
autoFocus: PropTypes.bool,
}

Search.defaultProps = {
onSearch: () => {},
maxResults: 75,
emojisToShowFilter: null,
iconsToShowFilter: null,
autoFocus: false,
}
14 changes: 7 additions & 7 deletions src/utils/icon-index/__tests__/emoji-index.test.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import emojiIndex from '../icon-index.js'
import iconIndex from '../icon-index.js'

test('should work', () => {
expect(emojiIndex.search('wheelchair')).toEqual([
expect(iconIndex.search('wheelchair')).toEqual([
'accessible-icon',
'crutch',
'wheelchair',
])
})

test('should filter only emojis we care about, exclude pineapple', () => {
let emojisToShowFilter = (data) => {
test('should filter only icons we care about, exclude pineapple', () => {
let iconsToShowFilter = (data) => {
data !== 'deskpro'
}
expect(emojiIndex.search('desk', { emojisToShowFilter })).not.toContain(
expect(iconIndex.search('desk', { iconsToShowFilter })).not.toContain(
'deskpro',
)
})

test('can search for thinking_face', () => {
expect(emojiIndex.search('fort awesome')).toEqual([
expect(iconIndex.search('fort awesome')).toEqual([
'fort-awesome',
'fort-awesome-alt',
])
})

test('can search for smile-beam', () => {
expect(emojiIndex.search('deskp')).toEqual(['deskpro'])
expect(iconIndex.search('deskp')).toEqual(['deskpro'])
})
6 changes: 3 additions & 3 deletions src/utils/icon-index/nimble-icon-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class NimbleIconIndex {

search(
value,
{ emojisToShowFilter, maxResults, include, exclude, custom = [] } = {},
{ iconsToShowFilter, maxResults, include, exclude, custom = [] } = {},
) {
maxResults || (maxResults = 75)
include || (include = [])
Expand Down Expand Up @@ -169,9 +169,9 @@ export default class NimbleIconIndex {
}

if (results) {
if (emojisToShowFilter) {
if (iconsToShowFilter) {
results = results.filter((result) =>
emojisToShowFilter(pool[result.id]),
iconsToShowFilter(pool[result.id]),
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/shared-default-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const PickerDefaultProps = {
native: EmojiDefaultProps.native,
sheetSize: EmojiDefaultProps.sheetSize,
backgroundImageFn: EmojiDefaultProps.backgroundImageFn,
emojisToShowFilter: null,
iconsToShowFilter: null,
showPreview: true,
showColorPicker: true,
emojiTooltip: EmojiDefaultProps.tooltip,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/shared-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const PickerPropTypes = {
native: PropTypes.bool,
backgroundImageFn: EmojiPropTypes.backgroundImageFn,
sheetSize: EmojiPropTypes.sheetSize,
emojisToShowFilter: PropTypes.func,
iconsToShowFilter: PropTypes.func,
showPreview: PropTypes.bool,
showColorPicker: PropTypes.bool,
emojiTooltip: EmojiPropTypes.tooltip,
Expand Down

0 comments on commit 568ae27

Please sign in to comment.