From 4228c350f96d9ce31b23c27a6fc40333c90eb23c Mon Sep 17 00:00:00 2001 From: AykutSarac Date: Mon, 13 Jun 2022 22:55:36 +0300 Subject: [PATCH] add carbon ads --- src/components/CarbonAds/index.tsx | 18 ++++++ src/constants/globalStyle.ts | 73 +++++++++++++++++++++ src/pages/index.tsx | 100 ++++++++++++++++++++++------- 3 files changed, 169 insertions(+), 22 deletions(-) create mode 100644 src/components/CarbonAds/index.tsx diff --git a/src/components/CarbonAds/index.tsx b/src/components/CarbonAds/index.tsx new file mode 100644 index 0000000..0be8f00 --- /dev/null +++ b/src/components/CarbonAds/index.tsx @@ -0,0 +1,18 @@ +import React from "react"; + +const isDevelopment = process.env.NODE_ENV === "development"; + +export const CarbonAds = () => { + if (isDevelopment) return null; + + return ( + <> + + + ); +}; diff --git a/src/constants/globalStyle.ts b/src/constants/globalStyle.ts index 8dc65a6..c32b077 100644 --- a/src/constants/globalStyle.ts +++ b/src/constants/globalStyle.ts @@ -44,6 +44,79 @@ const GlobalStyle = createGlobalStyle` background-image: linear-gradient(rgba(0, 0, 0, 0.1) 0 0); } } + + #carbonads * { + margin: initial; + padding: initial; + } + + #carbonads { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, + Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', Helvetica, Arial, + sans-serif; + overflow: hidden; + border-radius: 4px; + } + + #carbonads { + display: flex; + background-color: #111827; + box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, 0.1); + z-index: 100; + } + + #carbonads a { + color: inherit; + text-decoration: none; + } + + #carbonads a:hover { + color: inherit; + } + + #carbonads span { + position: relative; + display: block; + overflow: hidden; + } + + #carbonads .carbon-wrap { + display: flex; + } + + #carbonads .carbon-img { + display: block; + margin: 0; + line-height: 1; + } + + #carbonads .carbon-img img { + display: block; + } + + #carbonads .carbon-text { + font-size: 13px; + padding: 10px; + margin-bottom: 16px; + line-height: 1.5; + text-align: left; + } + + #carbonads .carbon-poweredby { + display: block; + padding: 6px 8px; + background: #111827; + text-align: center; + text-transform: uppercase; + letter-spacing: 0.5px; + font-weight: 600; + font-size: 8px; + line-height: 1; + border-top-left-radius: 3px; + position: absolute; + bottom: 0; + right: 0; + } `; export default GlobalStyle; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 355605a..7379cfe 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -12,6 +12,7 @@ import { import { TwitterTweetEmbed } from "react-twitter-embed"; import { Button } from "src/components/Button"; import { Producthunt } from "src/components/Producthunt"; +import { CarbonAds } from "src/components/CarbonAds"; import styled from "styled-components"; import pkg from "../../package.json"; @@ -274,37 +275,88 @@ const StyledHighlightedText = styled.span` text-decoration-color: #eab308; `; -const StyledProducthuntSection = styled.section` +const StyledProducthunt = styled.div` display: flex; - justify-content: center; + flex-direction: column; + justify-content: space-between; align-items: center; gap: 3rem; + border-right: 1px solid white; + padding-right: 3rem; + @media only screen and (max-width: 768px) { + border-right: none; + border-bottom: 1px solid white; + padding-bottom: 3rem; + padding-right: 0; + } +`; + +const StyledPaidSection = styled.section` + display: flex; max-width: 85%; margin: 0 auto; + gap: 2rem; padding: 60px 3%; - ${StyledSectionArea} { - margin: 0; - width: 100%; - - h2 { - text-align: right; - } - } - @media only screen and (max-width: 768px) { flex-direction: column; max-width: 80%; - - ${StyledSectionArea} { - h2 { - text-align: center; - } - } } `; +const StyledAffiliate = styled.div` + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + gap: 3rem; +`; + +const StyledCarbonWrapper = styled.div` + display: flex; + background: #111827; + border-radius: 5px; + overflow: hidden; +`; + +const StyledCarbon = styled.span` + display: flex; + position: relative; +`; + +const StyledCarbonAttribute = styled.a` + display: block; + padding: 6px 8px; + text-align: center; + text-transform: uppercase; + letter-spacing: 0.5px; + font-weight: 600; + font-size: 8px; + line-height: 1; + border-top-left-radius: 3px; + position: absolute; + bottom: 0; + right: 0; +`; + +const StyledCarbonImage = styled.a` + display: block; + margin: 0; + line-height: 1; + + img { + display: block; + } +`; + +const StyledCarbonText = styled.a` + font-size: 13px; + padding: 10px; + line-height: 1.5; + text-align: left; +`; + const Home: React.FC = () => { const { push } = useRouter(); const [isMobile, setIsMobile] = React.useState(false); @@ -451,16 +503,20 @@ const Home: React.FC = () => { - - + + Support JSON Visio at
Product Hunt
-
- -
+ + + + Affiliate + + + © 2022 JSON Visio - {pkg.version}