gab-social/app/javascript/gabsocial/components/icon/icon.js

75 lines
2.3 KiB
JavaScript
Raw Normal View History

2020-02-14 00:40:04 +00:00
import BackIcon from './svgs/back_icon'
import CalendarIcon from './svgs/calendar_icon'
2020-02-08 22:57:09 +00:00
import CloseIcon from './svgs/close_icon'
import CommentIcon from './svgs/comment_icon'
import EllipsisIcon from './svgs/ellipsis_icon'
import GlobeIcon from './svgs/globe_icon'
import GroupIcon from './svgs/group_icon'
import HomeIcon from './svgs/home_icon'
import LikeIcon from './svgs/like_icon'
2020-02-14 00:40:04 +00:00
import LoadingIcon from './svgs/loading_icon'
import MediaIcon from './svgs/media_icon'
2020-02-08 22:57:09 +00:00
import NotificationsIcon from './svgs/notifications_icon'
2020-02-14 00:40:04 +00:00
import PollIcon from './svgs/poll_icon'
2020-02-08 22:57:09 +00:00
import RepostIcon from './svgs/repost_icon'
import SearchIcon from './svgs/search_icon'
import ShareIcon from './svgs/share_icon'
import VerifiedIcon from './svgs/verified_icon'
2020-02-14 00:40:04 +00:00
import WarningIcon from './svgs/warning_icon'
export default class Icon extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
className: PropTypes.string,
2020-02-05 22:45:48 +00:00
width: PropTypes.string,
height: PropTypes.string,
2020-02-08 22:57:09 +00:00
}
2020-02-08 22:57:09 +00:00
render() {
const { id, ...options } = this.props
2020-02-08 22:57:09 +00:00
switch (id) {
2020-02-14 00:40:04 +00:00
case 'back':
return <BackIcon {...options} />
case 'calendar':
return <CalendarIcon {...options} />
2020-02-08 22:57:09 +00:00
case 'close':
return <CloseIcon {...options} />
case 'comment':
return <CommentIcon {...options} />
case 'ellipsis':
return <EllipsisIcon {...options} />
case 'globe':
return <GlobeIcon {...options} />
case 'group':
return <GroupIcon {...options} />
case 'home':
return <HomeIcon {...options} />
case 'like':
return <LikeIcon {...options} />
2020-02-14 00:40:04 +00:00
case 'loading':
return <LoadingIcon {...options} />
case 'media':
return <MediaIcon {...options} />
2020-02-08 22:57:09 +00:00
case 'notifications':
return <NotificationsIcon {...options} />
2020-02-14 00:40:04 +00:00
case 'poll':
return <PollIcon {...options} />
2020-02-08 22:57:09 +00:00
case 'repost':
return <RepostIcon {...options} />
case 'search':
return <SearchIcon {...options} />
2020-02-14 00:40:04 +00:00
case 'share':
return <ShareIcon {...options} />
2020-02-08 22:57:09 +00:00
case 'verified':
return <VerifiedIcon {...options} />
2020-02-14 00:40:04 +00:00
case 'warning':
return <WarningIcon {...options} />
2020-02-08 22:57:09 +00:00
default:
return <NotificationsIcon {...options} />
}
}
}