2019-06-02 06:20:35 +00:00
|
|
|
import { useState, useEffect } from 'react'
|
2019-10-04 12:45:52 +00:00
|
|
|
import BadgeExamples from '../components/badge-examples'
|
|
|
|
import BadgenTitle from '../components/badgen-title'
|
2019-11-18 15:52:07 +00:00
|
|
|
// import TopBar from '../components/top-bar'
|
2019-10-04 12:45:52 +00:00
|
|
|
import Intro from '../components/home-intro'
|
|
|
|
import Footer from '../components/footer'
|
2019-07-05 09:29:07 +00:00
|
|
|
import examples from '../static/.meta/badges.json'
|
2018-09-04 07:00:54 +00:00
|
|
|
|
2019-06-02 06:11:51 +00:00
|
|
|
const Index = () => {
|
2019-07-12 02:20:56 +00:00
|
|
|
const [tab, setTab] = useState('live')
|
2020-03-24 15:47:24 +00:00
|
|
|
const [host, setHost] = useState('')
|
2019-05-25 12:19:11 +00:00
|
|
|
const badges = examples[tab]
|
2019-05-25 11:36:19 +00:00
|
|
|
|
2019-06-02 06:20:35 +00:00
|
|
|
useEffect(() => {
|
2019-10-04 13:44:20 +00:00
|
|
|
const forceHost = new URL(window.location.href).searchParams.get('host')
|
2019-06-03 02:57:14 +00:00
|
|
|
setHost((forceHost || window.location.origin) + '/')
|
2019-06-02 06:20:35 +00:00
|
|
|
})
|
|
|
|
|
2019-05-25 11:36:19 +00:00
|
|
|
return <>
|
2019-06-02 06:20:35 +00:00
|
|
|
<BadgenTitle host={host} />
|
2019-07-08 01:28:25 +00:00
|
|
|
<div className='docs' style={{ width: '980px', margin: '0 auto' }}>
|
2019-05-25 11:36:19 +00:00
|
|
|
<Intro />
|
|
|
|
<h2 style={{ textAlign: 'center' }}>Badge Gallery</h2>
|
|
|
|
|
|
|
|
<div className='tab-row'>
|
|
|
|
<div className={`tab ${tab}`}>
|
|
|
|
<a onClick={() => setTab('live')} className='live'>Live Badges</a>
|
|
|
|
<a onClick={() => setTab('static')} className='static'>Static Badges</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<BadgeExamples data={badges} />
|
|
|
|
</div>
|
|
|
|
<Footer />
|
|
|
|
<style jsx>{`
|
|
|
|
.docs {
|
|
|
|
margin: 0 auto;
|
|
|
|
padding-bottom: 6em;
|
|
|
|
}
|
|
|
|
p {
|
|
|
|
text-align: center
|
|
|
|
}
|
|
|
|
|
|
|
|
.tab-row {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.tab {
|
|
|
|
display: inline-block;
|
|
|
|
border: 1px solid #333;
|
|
|
|
margin-bottom: 2rem;
|
|
|
|
}
|
|
|
|
.tab a {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 0 8px;
|
|
|
|
color: #333;
|
|
|
|
font: 14px/26px sans-serif;
|
|
|
|
text-transform: uppercase;
|
|
|
|
}
|
|
|
|
.tab a:hover {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
.live a.live,
|
|
|
|
.static a.static {
|
|
|
|
color: #EEE;
|
|
|
|
background-color: #333;
|
|
|
|
}
|
2019-08-24 08:24:46 +00:00
|
|
|
`}
|
|
|
|
</style>
|
|
|
|
</> // eslint-disable-line
|
2018-11-02 07:50:01 +00:00
|
|
|
}
|
2019-05-25 11:36:19 +00:00
|
|
|
|
|
|
|
export default Index
|