UNPKG

@rnga/orders

Version:

## Get schema from @prisma-cms 1. yarn get-api-schema -e http://localhost:4000 2. yarn build-api-fragments

42 lines (33 loc) 686 B
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { graphql } from 'react-apollo'; import { getUrlBySlab, } from "query"; class SlabLink extends Component { static propTypes = { slab: PropTypes.string.isRequired, }; render() { const { slab, url: { url, }, children, } = this.props; return url ? <a href={url} target="_blank" rel="noopener noreferrer" className="slab-link" title={`RNGA № ${slab}`} > {children} </a> : children || null; } } export default graphql(getUrlBySlab, { name: "url", skip: props => !props.slab, })(SlabLink);