diff --git a/src/components/Dapp/index.js b/src/components/Dapp/index.js index a85ac228..c0ea2a47 100644 --- a/src/components/Dapp/index.js +++ b/src/components/Dapp/index.js @@ -1,58 +1,57 @@ -import React, { Component } from 'react' +import React from 'react' import closeIcon from '../../images/close-icon.svg'; -import{trackEvent, ANALYTICS_EVENT_OPTS} from '../../util/analytics'; +import { trackEvent, ANALYTICS_EVENT_OPTS } from '../../util/analytics'; import './index.css'; -export default class Dapp extends Component { +const Dapp = (props) => { + const { size, closable, data: { name, description, url, icon } } = props; - trackEventOpenListedDapp = (e) => { + const trackEventOpenListedDapp = (e) => { e.preventDefault(); - trackEvent(ANALYTICS_EVENT_OPTS.OPEN_LISTED_DAPP, { - 'dapp_name' : this.props.data.name, - 'dapp_url': this.props.data.url, - 'position': this.props.position + 1 + trackEvent(ANALYTICS_EVENT_OPTS.OPEN_LISTED_DAPP, { + 'dapp_name': props.data.name, + 'dapp_url': props.data.url, + 'position': props.position + 1 }); - window.location.href = this.props.data.url; + window.location.href = props.data.url; } - renderDescription = (description) => { + const renderDescription = (description) => { return description && (
{description}
) } - onClose = (e) => { + const onClose = (e) => { e.preventDefault(); - this.props.onClose(this.props.data.url); + props.onClose(props.data.url); } - - render(){ - const { size, closable, data: { name, description, url, icon }} = this.props; - return ( - - ); - } -} \ No newline at end of file + + {closable && ( + + ) + } + + ); +} + +export default Dapp; \ No newline at end of file