import React from 'react' import { Link } from 'gatsby' import PropTypes from 'prop-types' import styled from 'styled-components' import { staticBadgeUrl } from '../../core/badge-urls/make-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; ` function QueryParam({ snippet, documentation }) { return ( {documentation} ) } QueryParam.propTypes = { snippet: PropTypes.string.isRequired, documentation: PropTypes.element.isRequired, } function EscapingConversion({ lhs, rhs }) { return ( {lhs} → {rhs} ) } EscapingConversion.propTypes = { lhs: PropTypes.element.isRequired, rhs: PropTypes.element.isRequired, } function ColorExamples({ baseUrl, colors }) { return ( {colors.map((color, i) => ( ))} ) } ColorExamples.propTypes = { baseUrl: PropTypes.string.isRequired, colors: PropTypes.array.isRequired, } function StyleExamples({ baseUrl }) { return ( {advertisedStyles.map(style => { const snippet = `?style=${style}&logo=appveyor` const badgeUrl = staticBadgeUrl({ baseUrl, label: 'style', message: style, color: 'green', namedLogo: 'appveyor', style, }) return ( } key={style} snippet={snippet} /> ) })} ) } StyleExamples.propTypes = { baseUrl: PropTypes.string.isRequired, } function NamedLogos() { const renderLogo = logo => {logo} const [first, ...rest] = shieldsLogos return [renderLogo(first)].concat( rest.reduce((result, logo) => result.concat([', ', renderLogo(logo)]), []) ) } function StaticBadgeEscapingRules() { return ( Dashes -- } rhs={ - Dash } /> Underscores __ } rhs={ _ Underscore } /> _ or Space   } rhs={   Space } /> ) } export default function Usage({ baseUrl }) { return (

Your Badge

Static

Using dash "-" separator

--.svg`} />

Using query string parameters

&message=&color=`} />

Colors



Endpoint

&style