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

184 lines
6.1 KiB
JavaScript
Raw Normal View History

2020-03-27 22:57:03 +00:00
import AddIcon from '../assets/add_icon'
import AddImageIcon from '../assets/add_image_icon'
2020-03-27 22:57:03 +00:00
import AngleRightIcon from '../assets/angle_right_icon'
2020-05-10 04:26:58 +01:00
import AngleLeftIcon from '../assets/angle_left_icon'
2020-03-27 22:57:03 +00:00
import AppsIcon from '../assets/apps_icon'
2020-05-01 06:50:27 +01:00
import ArrowLeftIcon from '../assets/arrow_left_icon'
import ArrowRightIcon from '../assets/arrow_right_icon'
2020-03-27 22:57:03 +00:00
import AudioIcon from '../assets/audio_icon'
import AudioMuteIcon from '../assets/audio_mute_icon'
import BackIcon from '../assets/back_icon'
2020-05-07 00:40:54 +01:00
import BlockIcon from '../assets/block_icon'
2020-04-02 04:17:21 +01:00
import BlockquoteIcon from '../assets/blockquote_icon'
import BoldIcon from '../assets/bold_icon'
2020-03-27 22:57:03 +00:00
import CalendarIcon from '../assets/calendar_icon'
import ChatIcon from '../assets/chat_icon'
import CheckIcon from '../assets/check_icon'
2020-03-27 22:57:03 +00:00
import CircleIcon from '../assets/circle_icon'
import CloseIcon from '../assets/close_icon'
2020-04-07 02:53:23 +01:00
import CodeIcon from '../assets/code_icon'
2020-04-28 06:33:58 +01:00
import CogIcon from '../assets/cog_icon'
2020-03-27 22:57:03 +00:00
import CommentIcon from '../assets/comment_icon'
2020-04-07 02:53:23 +01:00
import CopyIcon from '../assets/copy_icon'
2020-03-27 22:57:03 +00:00
import DissenterIcon from '../assets/dissenter_icon'
import EllipsisIcon from '../assets/ellipsis_icon'
2020-04-07 02:53:23 +01:00
import EmailIcon from '../assets/email_icon'
2020-03-27 22:57:03 +00:00
import ErrorIcon from '../assets/error_icon'
2020-04-29 23:32:49 +01:00
import ExploreIcon from '../assets/explore_icon'
2020-03-27 22:57:03 +00:00
import FullscreenIcon from '../assets/fullscreen_icon'
2020-03-31 17:04:50 +01:00
import GabLogoIcon from '../assets/gab_logo'
2020-03-27 22:57:03 +00:00
import GifIcon from '../assets/gif_icon'
import GlobeIcon from '../assets/globe_icon'
import GroupIcon from '../assets/group_icon'
import GroupAddIcon from '../assets/group_add_icon'
import HappyIcon from '../assets/happy_icon'
2020-04-08 02:06:59 +01:00
import HiddenIcon from '../assets/hidden_icon'
2020-03-27 22:57:03 +00:00
import HomeIcon from '../assets/home_icon'
2020-04-02 04:17:21 +01:00
import ItalicIcon from '../assets/italic_icon'
2020-03-27 22:57:03 +00:00
import LikeIcon from '../assets/like_icon'
2020-04-02 17:57:04 +01:00
import LikedIcon from '../assets/liked_icon'
2020-03-27 22:57:03 +00:00
import LinkIcon from '../assets/link_icon'
import ListIcon from '../assets/list_icon'
import ListAddIcon from '../assets/list_add_icon'
import LoadingIcon from '../assets/loading_icon'
2020-04-07 02:53:23 +01:00
import LockIcon from '../assets/lock_icon'
import LockFilledIcon from '../assets/lock_filled_icon'
2020-03-27 22:57:03 +00:00
import MediaIcon from '../assets/media_icon'
2020-05-05 06:16:01 +01:00
import MicIcon from '../assets/mic_icon'
2020-03-27 22:57:03 +00:00
import MinimizeFullscreenIcon from '../assets/minimize_fullscreen_icon'
import MissingIcon from '../assets/missing_icon'
import MoreIcon from '../assets/more_icon'
import NotificationsIcon from '../assets/notifications_icon'
2020-04-02 04:17:21 +01:00
import OLListIcon from '../assets/ol_list_icon'
2020-03-27 22:57:03 +00:00
import PauseIcon from '../assets/pause_icon'
2020-04-09 20:18:14 +01:00
import PencilIcon from '../assets/pencil_icon'
2020-03-27 22:57:03 +00:00
import PinIcon from '../assets/pin_icon'
import PipIcon from '../assets/pip_icon'
2020-03-27 22:57:03 +00:00
import PlayIcon from '../assets/play_icon'
import PollIcon from '../assets/poll_icon'
2020-05-14 21:45:39 +01:00
import ProIcon from '../assets/pro_icon'
import QuoteIcon from '../assets/quote_icon'
2020-03-27 22:57:03 +00:00
import RepostIcon from '../assets/repost_icon'
import RichTextIcon from '../assets/rich_text_icon'
import SearchIcon from '../assets/search_icon'
import SearchAltIcon from '../assets/search_alt_icon'
2020-04-23 07:13:29 +01:00
import SelectIcon from '../assets/select_icon'
2020-03-27 22:57:03 +00:00
import ShareIcon from '../assets/share_icon'
import ShopIcon from '../assets/shop_icon'
2020-07-08 00:58:35 +01:00
import SortIcon from '../assets/sort_icon'
import StarIcon from '../assets/star_icon'
2020-04-02 04:17:21 +01:00
import StrikethroughIcon from '../assets/strikethrough_icon'
2020-03-27 22:57:03 +00:00
import SubtractIcon from '../assets/subtract_icon'
2020-04-02 04:17:21 +01:00
import TextSizeIcon from '../assets/text_size_icon'
2020-05-07 00:40:54 +01:00
import TrashIcon from '../assets/trash_icon'
2020-03-27 22:57:03 +00:00
import TrendsIcon from '../assets/trends_icon'
2020-04-02 04:17:21 +01:00
import ULListIcon from '../assets/ul_list_icon'
import UnderlineIcon from '../assets/underline_icon'
2020-04-07 02:53:23 +01:00
import UnlockFilledIcon from '../assets/unlock_filled_icon'
2020-03-27 22:57:03 +00:00
import VerifiedIcon from '../assets/verified_icon'
import WarningIcon from '../assets/warning_icon'
2020-04-08 04:22:24 +01:00
import WebsiteIcon from '../assets/website_icon'
2020-03-27 22:57:03 +00:00
const ICONS = {
2020-04-08 02:06:59 +01:00
'add': AddIcon,
'add-image': AddImageIcon,
2020-04-08 02:06:59 +01:00
'angle-right': AngleRightIcon,
2020-05-10 04:26:58 +01:00
'angle-left': AngleLeftIcon,
2020-04-08 02:06:59 +01:00
'apps': AppsIcon,
2020-05-01 06:50:27 +01:00
'arrow-left': ArrowLeftIcon,
'arrow-right': ArrowRightIcon,
2020-04-08 02:06:59 +01:00
'audio': AudioIcon,
'audio-mute': AudioMuteIcon,
'back': BackIcon,
2020-05-07 00:40:54 +01:00
'block': BlockIcon,
2020-04-08 02:06:59 +01:00
'blockquote': BlockquoteIcon,
'bold': BoldIcon,
'calendar': CalendarIcon,
'chat': ChatIcon,
'check': CheckIcon,
2020-04-08 02:06:59 +01:00
'close': CloseIcon,
'code': CodeIcon,
2020-04-28 06:33:58 +01:00
'cog': CogIcon,
2020-04-08 02:06:59 +01:00
'comment': CommentIcon,
'copy': CopyIcon,
'dissenter': DissenterIcon,
'ellipsis': EllipsisIcon,
'email': EmailIcon,
'error': ErrorIcon,
2020-04-29 23:32:49 +01:00
'explore': ExploreIcon,
2020-04-08 02:06:59 +01:00
'fullscreen': FullscreenIcon,
2020-05-09 03:17:19 +01:00
'logo': GabLogoIcon,
2020-04-08 02:06:59 +01:00
'gif': GifIcon,
'globe': GlobeIcon,
'group': GroupIcon,
'group-add': GroupAddIcon,
'hidden': HiddenIcon,
'happy': HappyIcon,
'home': HomeIcon,
'italic': ItalicIcon,
'like': LikeIcon,
'liked': LikedIcon,
'link': LinkIcon,
'list': ListIcon,
'list-add': ListAddIcon,
'loading': LoadingIcon,
'lock': LockIcon,
'lock-filled': LockFilledIcon,
'media': MediaIcon,
2020-05-05 06:16:01 +01:00
'mic': MicIcon,
2020-04-08 02:06:59 +01:00
'minimize-fullscreen': MinimizeFullscreenIcon,
'missing': MissingIcon,
'more': MoreIcon,
'notifications': NotificationsIcon,
'ol-list': OLListIcon,
'pause': PauseIcon,
2020-04-09 20:18:14 +01:00
'pencil': PencilIcon,
2020-04-08 02:06:59 +01:00
'pin': PinIcon,
'pip': PipIcon,
2020-04-08 02:06:59 +01:00
'play': PlayIcon,
'poll': PollIcon,
2020-05-14 21:45:39 +01:00
'pro': ProIcon,
'quote': QuoteIcon,
2020-04-08 02:06:59 +01:00
'repost': RepostIcon,
'rich-text': RichTextIcon,
'search': SearchIcon,
'search-alt': SearchAltIcon,
2020-04-23 07:13:29 +01:00
'select': SelectIcon,
2020-04-08 02:06:59 +01:00
'share': ShareIcon,
'shop': ShopIcon,
2020-07-08 00:58:35 +01:00
'sort': SortIcon,
'star': StarIcon,
2020-04-08 02:06:59 +01:00
'strikethrough': StrikethroughIcon,
'subtract': SubtractIcon,
'text-size': TextSizeIcon,
2020-05-07 00:40:54 +01:00
'trash': TrashIcon,
2020-04-08 02:06:59 +01:00
'trends': TrendsIcon,
'ul-list': ULListIcon,
'underline': UnderlineIcon,
'unlock-filled': UnlockFilledIcon,
'verified': VerifiedIcon,
'warning': WarningIcon,
2020-04-08 04:22:24 +01:00
'website': WebsiteIcon,
2020-04-08 02:06:59 +01:00
'': CircleIcon,
2020-03-27 22:57:03 +00:00
}
2020-02-25 16:04:44 +00:00
export default class Icon extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
className: PropTypes.string,
2020-04-23 07:13:29 +01:00
size: PropTypes.string,
2020-02-25 16:04:44 +00:00
}
render() {
2020-04-23 07:13:29 +01:00
const { id, size, className } = this.props
2020-02-25 16:04:44 +00:00
2020-03-27 22:57:03 +00:00
// : todo : add all required icons
const Asset = ICONS[id] || CircleIcon
2020-04-23 07:13:29 +01:00
return <Asset size={size} className={className} />
2020-02-25 16:04:44 +00:00
}
2020-04-08 02:06:59 +01:00
2020-02-25 16:04:44 +00:00
}