-
-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from blenderskool/next
Version 2.1.2 🔮
- Loading branch information
Showing
41 changed files
with
720 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ app.json | |
.now | ||
.vercel | ||
client/build | ||
api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/** @jsx h */ | ||
import { h } from 'preact'; | ||
|
||
function Badge({ width, height, title, value, type }) { | ||
const styles = ` | ||
@import url('https://fonts.googleapis.com/css2?family=Jost:wght@500&display=swap'); | ||
.badge { | ||
border-radius: 4px; | ||
color: #fff; | ||
font-family: 'Jost', Verdana, DejaVu Sans, sans-serif; | ||
font-weight: 500; | ||
display: flex; | ||
align-items: center; | ||
overflow: hidden; | ||
font-size: 14px; | ||
line-height: 1.8; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-font-smoothing: antialiased; | ||
-o-font-smoothing: antialiased; | ||
} | ||
.badge * { | ||
box-sizing: border-box; | ||
} | ||
.title { | ||
width: 70%; | ||
height: 100%; | ||
text-align: center; | ||
background-color: #0D1322; | ||
} | ||
.value { | ||
border: 1px solid #3BE8B0; | ||
background-color: #173f3c; | ||
color: #3BE8B0; | ||
padding: 0 6px; | ||
width: 40%; | ||
text-align: center; | ||
height: 100%; | ||
line-height: 1.6; | ||
border-top-right-radius: 4px; | ||
border-bottom-right-radius: 4px; | ||
} | ||
.error .value { | ||
background-color: #441f28; | ||
color: #ff7979; | ||
border-color: #ff7979; | ||
} | ||
`; | ||
|
||
return ( | ||
<svg width={width} height={height} viewBox={`0 0 ${width} ${height}`} fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<title>{title}: {value}</title> | ||
<defs> | ||
<style type="text/css"> | ||
{styles} | ||
</style> | ||
</defs> | ||
<foreignObject width="100%" height="100%"> | ||
<div xmlns="http://www.w3.org/1999/xhtml"> | ||
<div class={`badge ${type}`} style={{ height, width }}> | ||
<div class="title"> | ||
{title} | ||
</div> | ||
<div class="value"> | ||
{value} | ||
</div> | ||
</div> | ||
</div> | ||
</foreignObject> | ||
</svg> | ||
); | ||
} | ||
|
||
export default Badge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** @jsx h */ | ||
import { h } from 'preact'; | ||
import render from 'preact-render-to-string'; | ||
|
||
import Badge from './_Badge'; | ||
|
||
export default async (req, res) => { | ||
|
||
res.setHeader('content-type', 'image/svg+xml'); | ||
res.setHeader('Cache-control', 'max-age=0, s-maxage=86400'); | ||
|
||
res.send(render(<Badge type="success" width={120} height={24} title="license" value="MIT" />)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** @jsx h */ | ||
import { h } from 'preact'; | ||
import render from 'preact-render-to-string'; | ||
import fetch from 'node-fetch'; | ||
|
||
import Badge from './_Badge'; | ||
|
||
export default async (req, res) => { | ||
|
||
res.setHeader('content-type', 'image/svg+xml'); | ||
res.setHeader('Cache-control', 'max-age=0, s-maxage=3600'); | ||
|
||
try { | ||
const { tag_name } = await (await fetch('https://api.github.com/repos/blenderskool/blaze/releases/latest')).json(); | ||
res.send(render(<Badge type="success" width={140} height={24} title="release" value={tag_name} />)); | ||
} catch(err) { | ||
res.send(render(<Badge type="error" width={120} height={24} title="release" value="error" />)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** @jsx h */ | ||
import { h } from 'preact'; | ||
import render from 'preact-render-to-string'; | ||
import fetch from 'node-fetch'; | ||
|
||
import Badge from './_Badge'; | ||
|
||
export default async (req, res) => { | ||
|
||
res.setHeader('content-type', 'image/svg+xml'); | ||
res.setHeader('Cache-control', 'max-age=0, s-maxage=60'); | ||
|
||
try { | ||
await fetch('https://blaze.beaconapp.in'); | ||
res.send(render(<Badge type="success" width={90} height={24} title="status" value="up" />)); | ||
} catch(err) { | ||
res.send(render(<Badge type="error" width={120} height={24} title="status" value="down" />)); | ||
} | ||
}; |
Oops, something went wrong.