import React from 'react' import { Link } from 'gatsby' import PropTypes from 'prop-types' import styled from 'styled-components' import { staticBadgeUrl } from '../lib/badge-url' import { advertisedStyles, shieldsLogos } from '../../supported-features.json' import StaticBadgeMaker from './static-badge-maker' import DynamicBadgeMaker from './dynamic-badge-maker' import { H2, H3, Badge, VerticalSpace } from './common' import { Snippet, StyledCode } from './snippet' const LogoName = styled.span` white-space: nowrap; ` const Lhs = styled.td` text-align: right; ` const EscapingRuleTable = styled.table` margin: auto; ` const QueryParamTable = styled.table` min-width: 50%; margin: auto; table-layout: fixed; border-spacing: 20px 10px; ` const QueryParamSyntax = styled.td` max-width: 300px; text-align: left; ` const QueryParamDocumentation = styled.td` max-width: 600px; text-align: left; ` const QueryParam = ({ snippet, documentation }) => ( {documentation} ) QueryParam.propTypes = { snippet: PropTypes.string.isRequired, documentation: PropTypes.element.isRequired, } const EscapingConversion = ({ lhs, rhs }) => ( {lhs} → {rhs} ) EscapingConversion.propTypes = { lhs: PropTypes.element.isRequired, rhs: PropTypes.element.isRequired, } const ColorExamples = ({ baseUrl, colors }) => ( {colors.map((color, i) => ( ))} ) ColorExamples.propTypes = { baseUrl: PropTypes.string.isRequired, colors: PropTypes.array.isRequired, } export default class Usage extends React.PureComponent { static propTypes = { baseUrl: PropTypes.string.isRequired, } renderStyleExamples() { const { baseUrl } = this.props return ( {advertisedStyles.map(style => { const snippet = `?style=${style}&logo=appveyor` const badgeUrl = staticBadgeUrl(baseUrl, 'style', style, 'green', { logo: 'appveyor', style, }) return ( } key={style} snippet={snippet} /> ) })} ) } static renderNamedLogos() { const renderLogo = logo => {logo} const [first, ...rest] = shieldsLogos return [renderLogo(first)].concat( rest.reduce((result, logo) => result.concat([', ', renderLogo(logo)]), []) ) } static renderStaticBadgeEscapingRules() { return ( Dashes -- } rhs={ - Dash } /> Underscores __ } rhs={ _ Underscore } /> _ or Space   } rhs={   Space } /> ) } render() { const { baseUrl } = this.props return (

Your Badge

Static

--.svg`} />

{this.constructor.renderStaticBadgeEscapingRules()}

Colors



Endpoint (Beta)

&style