import React from 'react' import { Link } from 'gatsby' import styled from 'styled-components' import { staticBadgeUrl } from '../../core/badge-urls/make-badge-url' import { advertisedStyles, shieldsLogos } from '../lib/supported-features' // ts-expect-error: because reasons? 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, }: { snippet: string documentation: JSX.Element | JSX.Element[] }): JSX.Element { return ( {documentation} ) } function EscapingConversion({ lhs, rhs, }: { lhs: JSX.Element rhs: JSX.Element }): JSX.Element { return ( {lhs} → {rhs} ) } function ColorExamples({ baseUrl, colors, }: { baseUrl: string colors: string[] }): JSX.Element { return ( {colors.map((color, i) => ( ))} ) } function StyleExamples({ baseUrl }: { baseUrl: string }): JSX.Element { 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} /> ) })} ) } function NamedLogos(): JSX.Element { const renderLogo = (logo: string): JSX.Element => ( {logo} ) const [first, ...rest] = shieldsLogos const result = ([renderLogo(first)] as (JSX.Element | string)[]).concat( rest.reduce( (result, logo) => result.concat([', ', renderLogo(logo)]), [] as (JSX.Element | string)[] ) ) return <>{result} } function StaticBadgeEscapingRules(): JSX.Element { return ( Dashes -- } rhs={ - Dash } /> Underscores __ } rhs={ _ Underscore } /> _ or Space   } rhs={   Space } /> ) } export default function Usage({ baseUrl }: { baseUrl: string }): JSX.Element { return (

Your Badge

Static

Using dash "-" separator

--`} />

Using query string parameters

&message=&color=`} />

Colors



Endpoint

&style