dojo / widgets

:rocket: Dojo - UI widgets.
https://widgets.dojo.io
Other
88 stars 66 forks source link

Create an icon widget #463

Closed tomdye closed 6 years ago

tomdye commented 6 years ago

Enhancement

We've circled around this one a few times, but when trying to create a Button with an icon it for the theme tester, I have realised that without an icon widget, it is not straight forward for a user to use the dojo 2 icons in their own apps.

// with an icon widget
w(Button, {}, [
   'search',
   w(Icon, { type: 'search' })
])

// without an icon widget
import * as iconCss from '@dojo/widgets/theme/common/icons.m.css'

@theme(iconCss)
w(Button, {}, [
    'search ',
    v('i', { classes: this.theme([ iconCss.icon, iconCss.searchIcon ])})
])
tomdye commented 6 years ago

Icon widget will likely need to export a list of icon classes available likely using keyof on it's css file so that it's icon property can be typed.