@@ -3,17 +3,7 @@ import {Button, IconButton, Breadcrumbs, ActionMenu, ActionList} from '..'
33import { PageHeader } from '../PageHeader'
44import { Tooltip } from './Tooltip'
55import { Dialog } from '../experimental'
6- import {
7- GitBranchIcon ,
8- KebabHorizontalIcon ,
9- TriangleDownIcon ,
10- CheckIcon ,
11- XIcon ,
12- HeartIcon ,
13- BookIcon ,
14- StarIcon ,
15- SearchIcon ,
16- } from '@primer/octicons-react'
6+ import { GitBranchIcon , KebabHorizontalIcon , TriangleDownIcon , CheckIcon , XIcon } from '@primer/octicons-react'
177import { default as VisuallyHidden } from '../_VisuallyHidden'
188
199export default {
@@ -196,23 +186,28 @@ export const DialogTrigger = () => {
196186 )
197187}
198188
199- export const OcticonPicker = ( ) => {
200- const octicons = [
201- { icon : SearchIcon , name : 'Search' } ,
202- { icon : BookIcon , name : 'Book' } ,
203- { icon : CheckIcon , name : 'Check' } ,
204- { icon : StarIcon , name : 'Star' } ,
205- { icon : HeartIcon , name : 'Heart' } ,
206- { icon : SearchIcon , name : 'Search' } ,
207- { icon : BookIcon , name : 'Book' } ,
208- { icon : CheckIcon , name : 'Check' } ,
209- { icon : StarIcon , name : 'Star' } ,
210- { icon : HeartIcon , name : 'Heart' } ,
211- { icon : SearchIcon , name : 'Search' } ,
212- { icon : BookIcon , name : 'Book' } ,
213- { icon : CheckIcon , name : 'Check' } ,
214- { icon : StarIcon , name : 'Star' } ,
215- { icon : HeartIcon , name : 'Heart' } ,
189+ export const EmojiPicker = ( ) => {
190+ // This example demonstrates a grid of emojis/icons with tooltips that appear after a long delay.
191+ // This pattern is used in places like emoji reactions on comments and the icon picker in the issues dashboard's saved views on GitHub.
192+ // The delay improves UX by preventing distraction when users move their cursor across multiple emojis/icons,
193+ // especially since these icons are generally familiar and don't require immediate explanation.
194+
195+ const emojis = [
196+ { emoji : '😀' , name : 'Grinning Face' } ,
197+ { emoji : '😍' , name : 'Heart Eyes' } ,
198+ { emoji : '🎉' , name : 'Party Popper' } ,
199+ { emoji : '👍' , name : 'Thumbs Up' } ,
200+ { emoji : '❤️' , name : 'Red Heart' } ,
201+ { emoji : '🔥' , name : 'Fire' } ,
202+ { emoji : '💯' , name : 'Hundred Points' } ,
203+ { emoji : '🚀' , name : 'Rocket' } ,
204+ { emoji : '⭐' , name : 'Star' } ,
205+ { emoji : '🎯' , name : 'Direct Hit' } ,
206+ { emoji : '💡' , name : 'Light Bulb' } ,
207+ { emoji : '🌟' , name : 'Glowing Star' } ,
208+ { emoji : '🎊' , name : 'Confetti Ball' } ,
209+ { emoji : '✨' , name : 'Sparkles' } ,
210+ { emoji : '🌈' , name : 'Rainbow' } ,
216211 ]
217212
218213 return (
@@ -225,9 +220,24 @@ export const OcticonPicker = () => {
225220 padding : '16px' ,
226221 } }
227222 >
228- { octicons . map ( ( octicon , index ) => (
229- < Tooltip key = { index } text = { octicon . name } direction = "n" delay = "long" >
230- < IconButton aria-label = { octicon . name } icon = { octicon . icon } />
223+ { emojis . map ( ( emojiItem , index ) => (
224+ < Tooltip key = { index } text = { emojiItem . name } direction = "n" delay = "long" >
225+ < Button
226+ aria-label = { emojiItem . name }
227+ variant = "invisible"
228+ size = "small"
229+ style = { {
230+ fontSize : '18px' ,
231+ padding : '8px' ,
232+ minWidth : '32px' ,
233+ minHeight : '32px' ,
234+ display : 'flex' ,
235+ alignItems : 'center' ,
236+ justifyContent : 'center' ,
237+ } }
238+ >
239+ { emojiItem . emoji }
240+ </ Button >
231241 </ Tooltip >
232242 ) ) }
233243 </ div >
0 commit comments