From 4cd0188864bab293cde31b010f4c57c84955eba1 Mon Sep 17 00:00:00 2001 From: Amio Date: Sun, 2 Jun 2019 14:11:51 +0800 Subject: [PATCH] Consistent badgen-title --- components/badgen-title.jsx | 111 ++++++++++++++++++++++++++++++++++ components/builder-preview.js | 79 ++---------------------- components/home-header.js | 10 --- pages/index.js | 6 +- 4 files changed, 118 insertions(+), 88 deletions(-) create mode 100644 components/badgen-title.jsx delete mode 100644 components/home-header.js diff --git a/components/badgen-title.jsx b/components/badgen-title.jsx new file mode 100644 index 0000000..9f29516 --- /dev/null +++ b/components/badgen-title.jsx @@ -0,0 +1,111 @@ +import Link from 'next/link' + +const BadgenTitle = ({ host }) => { + return ( +
+
+

+ + Badgen + +

+

Fast badge generating service

+
+ +
+ ) +} + +const StyleSwitch = ({ host }) => { + if (!host) return null + + return ( + + { host.includes('https://flat.') ? [ + FLAT, + CLASSIC + ] : [ + CLASSIC, + FLAT + ] } + + + ) +} + +export default BadgenTitle diff --git a/components/builder-preview.js b/components/builder-preview.js index 5e58942..6240ab7 100644 --- a/components/builder-preview.js +++ b/components/builder-preview.js @@ -1,17 +1,12 @@ -import Link from 'next/link' import debounceRender from 'react-debounce-render' +import BadgenTitle from './badgen-title.jsx' const BadgePreview = ({ host, badgeURL, focus }) => { const showPreview = focus || !!badgeURL return (
-

- - Badgen - -

-

Fast badge generating service

+
@@ -42,28 +37,6 @@ const BadgePreview = ({ host, badgeURL, focus }) => { .title.show { transition-delay: 100ms; } - .title img { - height: 42px; - width: 42px; - vertical-align: top; - margin-top: -1px; - margin-right: 10px; - } - .title h1 { - margin: 1.5rem 0 0 0; - font: 46px/48px Merriweather, serif; - font-weight: 700; - color: #333; - height: 52px; - width: 235px; - position: relative; - } - .title p { - font: 20px/32px Merriweather, serif; - font-weight: 300; - letter-spacing: 0.3px; - color: #333; - } .preview { pointer-events: none; opacity: 0; @@ -80,56 +53,12 @@ const BadgePreview = ({ host, badgeURL, focus }) => { ) } -const StyleSwitch = ({ host }) => { - if (!host) return null - - return ( - - { host.includes('https://flat.') ? [ - FLAT, - CLASSIC - ] : [ - CLASSIC, - FLAT - ] } - - - ) -} - const PreviewBadge = debounceRender(({ host, url }) => { return -}, 400) +}, 300) const genBadgeSrc = (host, url) => { - if (url === '') { + if (!url) { return host + 'badge/badgen/preview' } if (url.split('/').length > 2) { diff --git a/components/home-header.js b/components/home-header.js deleted file mode 100644 index 1108d6f..0000000 --- a/components/home-header.js +++ /dev/null @@ -1,10 +0,0 @@ -export default () => <> -

- Badgen -

-

Fast badge generating service.

-

- classic - flat -

- diff --git a/pages/index.js b/pages/index.js index 60ddac8..df0b376 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,16 +1,16 @@ import { useState } from 'react' import BadgeExamples from '../components/badge-examples.js' -import Header from '../components/home-header.js' +import BadgenTitle from '../components/badgen-title.jsx' import Intro from '../components/home-intro.js' import Footer from '../components/footer.js' import examples from '../static/.gen/badges.json' -const Index = ({ badgeExamples }) => { +const Index = () => { const [ tab, setTab ] = useState('live') const badges = examples[tab] return <> -
+

Badge Gallery