kopia lustrzana https://github.com/badgen/badgen.net
style: make eslint happy
rodzic
6d225296db
commit
86ee22143e
|
@ -2,7 +2,7 @@ import React from 'react'
|
|||
|
||||
const DEFAULT_SIZE = 42
|
||||
|
||||
export default class extends React.Component {
|
||||
export default class BuilderBar extends React.Component {
|
||||
shouldComponentUpdate ({ badgeURL }) {
|
||||
const url = badgeURL ? `#${badgeURL}` : window.location.pathname
|
||||
window.history.replaceState({}, document.title, url)
|
||||
|
|
|
@ -4,7 +4,7 @@ const examples = [...badgeList.live, ...badgeList.static].reduce((accu, curr) =>
|
|||
return accu.concat(Object.entries(curr.examples))
|
||||
}, [])
|
||||
|
||||
export default ({ badgeURL, onSelect }) => {
|
||||
export default function BuilderHelper ({ badgeURL, onSelect }) {
|
||||
if (badgeURL.length < 2) {
|
||||
return <div className='helper' />
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
|
||||
export default ({ focus, badgeURL }) => {
|
||||
export default function BuilderHints ({ focus, badgeURL }) {
|
||||
const visible = !focus && !badgeURL
|
||||
const style = {
|
||||
opacity: visible ? 1 : 0,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Link from 'next/link'
|
||||
|
||||
export default () => (
|
||||
export default function Footer () {
|
||||
return (
|
||||
<footer>
|
||||
<div className='footer-content'>
|
||||
<div>
|
||||
|
@ -100,4 +101,4 @@ export default () => (
|
|||
`}
|
||||
</style>
|
||||
</footer>
|
||||
)
|
||||
)}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Link from 'next/link'
|
||||
|
||||
export default ({ current }) => {
|
||||
export default function GalleryHeader ({ current }) {
|
||||
return (
|
||||
<header>
|
||||
<h1>Badgen Gallery</h1>
|
||||
|
|
|
@ -2,7 +2,7 @@ import React from 'react'
|
|||
import GalleryHeader from './gallery-header.js'
|
||||
import Footer from './footer.js'
|
||||
|
||||
export default class extends React.Component {
|
||||
export default class GalleryLayout extends React.Component {
|
||||
render () {
|
||||
const { tab, children } = this.props
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import icons from 'badgen-icons'
|
||||
|
||||
export default ({ isFlat }) => (
|
||||
export default function HomeIntro ({ isFlat }) {
|
||||
return (
|
||||
<div>
|
||||
<pre>{explainCode(isFlat)}</pre>
|
||||
|
||||
|
@ -60,7 +61,7 @@ export default ({ isFlat }) => (
|
|||
`}
|
||||
</style>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
|
||||
const colorExamples = () => {
|
||||
const colors = ['blue', 'cyan', 'green', 'yellow', 'orange', 'red', 'pink', 'purple', 'grey', 'black']
|
||||
|
|
|
@ -55,10 +55,10 @@ export default badgenServe(handlers)
|
|||
async function handler ({ owner, repo, identifier }: Args) {
|
||||
// https://github.com/dependabot/feedback/issues/6#issuecomment-503994253
|
||||
let endpoint = `https://api.dependabot.com/badges/status?host=github&repo=${owner}/${repo}`
|
||||
if (!!identifier) {
|
||||
if (identifier) {
|
||||
endpoint += `&identifier=${identifier}`
|
||||
}
|
||||
const { status, colour } = await got(endpoint).then(res => res.body);
|
||||
const { status, colour } = await got(endpoint).then(res => res.body)
|
||||
|
||||
return {
|
||||
subject: 'Dependabot',
|
||||
|
|
|
@ -158,7 +158,7 @@ async function handler ({ topic, vendor, pkg, channel = 'latest' }: Args) {
|
|||
color: 'green'
|
||||
}
|
||||
case 'php':
|
||||
const pkg = packageMeta.versions[getVersion(packageMeta, channel)];
|
||||
const pkg = packageMeta.versions[getVersion(packageMeta, channel)]
|
||||
|
||||
return {
|
||||
subject: 'php',
|
||||
|
|
|
@ -52,7 +52,7 @@ export function badgenServe (handlers: BadgenServeHandlers): Function {
|
|||
try {
|
||||
const paramsPromise = handlers[matchedScheme](matchedArgs)
|
||||
|
||||
let iconPromise: Promise<string | undefined> = Promise.resolve(undefined);
|
||||
let iconPromise: Promise<string | undefined> = Promise.resolve(undefined)
|
||||
if (typeof query.icon === 'string') {
|
||||
if (query.icon.startsWith('https://')) {
|
||||
iconPromise = fetchIcon(query.icon).catch(e => undefined)
|
||||
|
|
Ładowanie…
Reference in New Issue