Merge the 2 new categories into a single one

release
Etienne Lemay 2020-03-16 09:06:03 -04:00
parent 57cabf6f75
commit fcae7a913b
9 changed files with 25 additions and 26 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -119,6 +119,18 @@ module.exports = (options) => {
}) })
.sort() .sort()
// Merge “Smileys & Emotion” and “People & Body” into a single category
let smileys = data.categories[0]
let people = data.categories[1]
let smileysAndPeople = { id: 'people', name: 'Smileys & People' }
smileysAndPeople.emojis = []
.concat(smileys.emojis.slice(0, 114))
.concat(people.emojis)
.concat(smileys.emojis.slice(114))
data.categories.unshift(smileysAndPeople)
data.categories.splice(1, 2)
fs.writeFile(options.output, JSON.stringify(data), (err) => { fs.writeFile(options.output, JSON.stringify(data), (err) => {
if (err) throw err if (err) throw err
}) })

View File

@ -15,7 +15,7 @@ function render(props = {}) {
test('shows 10 categories by default', () => { test('shows 10 categories by default', () => {
const subject = render() const subject = render()
expect(subject.categories.length).toEqual(11) expect(subject.categories.length).toEqual(10)
}) })
test('will not show some categories based upon our filter', () => { test('will not show some categories based upon our filter', () => {
@ -26,7 +26,7 @@ test('will not show some categories based upon our filter', () => {
test('maintains category ids after it is filtered', () => { test('maintains category ids after it is filtered', () => {
const subject = render({ emojisToShowFilter: () => true }) const subject = render({ emojisToShowFilter: () => true })
const categoriesWithIds = subject.categories.filter((category) => category.id) const categoriesWithIds = subject.categories.filter((category) => category.id)
expect(categoriesWithIds.length).toEqual(11) expect(categoriesWithIds.length).toEqual(10)
}) })
test('with custom emoji and tooltip', () => { test('with custom emoji and tooltip', () => {
@ -57,8 +57,8 @@ test('with custom emoji and tooltip', () => {
autoFocus: true, autoFocus: true,
custom, custom,
}) })
expect(subject.categories.length).toEqual(12) expect(subject.categories.length).toEqual(11)
expect(subject.categories[11].name).toEqual('Custom') expect(subject.categories[10].name).toEqual('Custom')
subject.handleSearch( subject.handleSearch(
new NimbleEmojiIndex(subject.data).search('custom_', { custom }), new NimbleEmojiIndex(subject.data).search('custom_', { custom }),
) )
@ -90,7 +90,7 @@ test('with custom categories', () => {
}, },
] ]
const subject = render({ custom }) const subject = render({ custom })
expect(subject.categories.length).toEqual(13) expect(subject.categories.length).toEqual(12)
expect(subject.categories[11].name).toEqual('Category 1') expect(subject.categories[10].name).toEqual('Category 1')
expect(subject.categories[12].name).toEqual('Category 2') expect(subject.categories[11].name).toEqual('Category 2')
}) })

View File

@ -22,8 +22,7 @@ const I18N = {
categories: { categories: {
search: 'Search Results', search: 'Search Results',
recent: 'Frequently Used', recent: 'Frequently Used',
smileys: 'Smileys & Emotion', people: 'Smileys & People',
people: 'People & Body',
nature: 'Animals & Nature', nature: 'Animals & Nature',
foods: 'Food & Drink', foods: 'Food & Drink',
activity: 'Activity', activity: 'Activity',

View File

@ -101,18 +101,6 @@ const categories = {
</svg> </svg>
), ),
smileys: () => (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="24"
height="24"
>
<path d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10" />
<path d="M8 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 8 7M16 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 16 7M15.232 15c-.693 1.195-1.87 2-3.349 2-1.477 0-2.655-.805-3.347-2H15m3-2H6a6 6 0 1 0 12 0" />
</svg>
),
places: () => ( places: () => (
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"