diff --git a/.gitignore b/.gitignore index 5078938..a330171 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules dist test.js diff --git a/css/emoji-button.css b/css/emoji-button.css index 25dd2ae..06e8d1d 100644 --- a/css/emoji-button.css +++ b/css/emoji-button.css @@ -291,6 +291,11 @@ top: calc(50% - 0.5em); } +.emoji-picker__search-icon img { + width: 1em; + height: 1em; +} + .emoji-picker__search-not-found { color: var(--secondary-text-color); text-align: center; @@ -316,6 +321,11 @@ font-size: 3em; } +.emoji-picker__search-not-found-icon img { + width: 1em; + height: 1em; +} + .emoji-picker__search-not-found h2 { margin: 0.5em 0; font-size: 1em; @@ -400,6 +410,11 @@ button.emoji-picker__category-button { outline: none; } +button.emoji-picker__category-button img { + width: var(--category-button-size); + height: var(--category-button-size); +} + .emoji-picker.keyboard button.emoji-picker__category-button:focus { outline: 1px dotted var(--focus-indicator-color); } diff --git a/index.d.ts b/index.d.ts index b80e4dd..d01a148 100644 --- a/index.d.ts +++ b/index.d.ts @@ -37,6 +37,7 @@ declare namespace EmojiButton { initialCategory?: Category | 'recents'; custom?: CustomEmoji[]; plugins?: Plugin[]; + icons?: Icons; } export interface FixedPosition { @@ -126,4 +127,13 @@ declare namespace EmojiButton { }; notFound: string; } + + export interface Icons { + search?: string; + clearSearch?: string; + categories?: { + [key in I18NCategory]?: string; + }; + notFound?: string; + } } diff --git a/site/src/components/Sidebar.js b/site/src/components/Sidebar.js index 095a13b..25f75b9 100644 --- a/site/src/components/Sidebar.js +++ b/site/src/components/Sidebar.js @@ -31,6 +31,11 @@ export default function Sidebar() { Custom Emojis +
icons
+ initialCategory
@@ -552,6 +566,67 @@ export default function ApiDocs() {
+
+ + An icon definition object must contain at least one of the following + properties: +
+ +search
: The search icon, displayed when there is no
+ search text entered.
+ clearSearch
: The button to clear the search, displayed
+ when there is search text entered.
+ notFound
: The icon to display when a search yields no
+ results.
+ categories
: A nested object containing one or more of
+ the following:
+ recents
: The Recent Emojis category.
+ smileys
: The Smileys & Emotion category.
+ peopls
: The People & Body category.
+ animals
: The Animals & Nature category.
+ food
: The Food & Drink category.
+ activities
: The Activities category.
+ travel
: The Travel & Places category.
+ objects
: The Objects category.
+ symbols
: The Symbols category.
+ flags
: The Flags category.
+ custom
: The Custom category.
+
diff --git a/site/src/pages/docs/icons.js b/site/src/pages/docs/icons.js
new file mode 100644
index 0000000..7ea8460
--- /dev/null
+++ b/site/src/pages/docs/icons.js
@@ -0,0 +1,95 @@
+import React from 'react';
+
+import DocLayout from '../../components/DocLayout';
+import Example from '../../components/Example';
+import SourceFile from '../../components/SourceFile';
+
+import customIconsExample from '!!raw-loader!../../examples/customIcons.js';
+
+export default function IconsExample() {
+ return (
+
+ If the icons built in to Emoji Button don't go well with your app's look
+ and feel, you can supply your own icons for:
+
+ To use custom icons, pass the Custom Icons
+
+
+
+ icons
picker option and an
+ object with one or more of the following properties:
+
+
+
+ search
: Shown in the search bar when there is no search
+ text entered.
+ clearSearch
: Shown in the search bar when there is search
+ text entered.
+ notFound
: Shown along with a "not found" message when a
+ search yields no emojis.
+ categories
: A nested object mapping category IDs to their
+ custom icons. The valid category IDs are:
+
+
+ recents
+ smileys
+ people
+ animals
+ food
+ activities
+ travel
+ objects
+ symbols
+ flags
+ custom
+