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