From af3dc473b6b8a5440f264bb4b7153ffc6a6020e2 Mon Sep 17 00:00:00 2001 From: Amio Date: Fri, 2 Nov 2018 15:50:01 +0800 Subject: [PATCH] web: add footer & style switch to builder --- components/builder-hints.js | 2 +- components/builder-preview.js | 56 +++++++++++++++++++++++++++++++++-- pages/builder.js | 26 +++++++++------- pages/index.js | 4 ++- 4 files changed, 73 insertions(+), 15 deletions(-) diff --git a/components/builder-hints.js b/components/builder-hints.js index 09dba59..d54628a 100644 --- a/components/builder-hints.js +++ b/components/builder-hints.js @@ -37,7 +37,7 @@ export default ({ focus, badgeURL }) => { color: #333; } a:hover { - border-bottom: 1px dotted #333; + border-bottom: 1px dashed #333; } `} diff --git a/components/builder-preview.js b/components/builder-preview.js index c85347c..bbf6864 100644 --- a/components/builder-preview.js +++ b/components/builder-preview.js @@ -1,11 +1,16 @@ +import Link from 'next/link' import debounceRender from 'react-debounce-render' -const BadgePreview = ({ host = 'https://badgen.net/', badgeURL, focus }) => { +const BadgePreview = ({ host, badgeURL, focus }) => { const showPreview = focus || !!badgeURL return (
-

Badgen

+

+ + Badgen + +

Fast badge generating service.

@@ -42,6 +47,7 @@ const BadgePreview = ({ host = 'https://badgen.net/', badgeURL, focus }) => { width: 42px; vertical-align: top; margin-top: 2px; + margin-right: 10px; } .title h1 { margin: 1.5rem 0 0 0; @@ -49,6 +55,8 @@ const BadgePreview = ({ host = 'https://badgen.net/', badgeURL, focus }) => { font-weight: 700; color: #333; height: 52px; + width: 235px; + position: relative; } .title p { font: 19px/32px Merriweather, serif; @@ -72,6 +80,50 @@ const BadgePreview = ({ host = 'https://badgen.net/', 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) diff --git a/pages/builder.js b/pages/builder.js index 818ea89..6633958 100644 --- a/pages/builder.js +++ b/pages/builder.js @@ -3,6 +3,7 @@ import Preview from '../components/builder-preview.js' import Bar from '../components/builder-bar.js' import Hints from '../components/builder-hints.js' import Helper from '../components/builder-helper.js' +import Footer from '../components/footer.js' export default class BuilderPage extends React.Component { state = { @@ -34,18 +35,21 @@ export default class BuilderPage extends React.Component { return (
- - - - { badgeURL && } +
+ + + + { badgeURL && } +
+