Skip to content

Commit 184be52

Browse files
committed
feat: add ads?
1 parent 86e75a4 commit 184be52

File tree

4 files changed

+132
-6
lines changed

4 files changed

+132
-6
lines changed

pages/_app.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require('../public/styles/fonts.css');
1313
require('../public/styles/prism.css');
1414
require('../public/styles/tooltips.css');
1515
require('../public/styles/codemirror.css');
16+
require('../public/styles/carbon.css');
1617

1718
import App from 'next/app';
1819

public/styles/carbon.css

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#carbonads * {
2+
margin: initial;
3+
padding: initial;
4+
}
5+
6+
#carbonads {
7+
display: flex;
8+
max-width: 130px;
9+
overflow: hidden;
10+
border-radius: 4px;
11+
box-shadow: 0 0 1px hsla(0, 0%, 0%, 0.15);
12+
font-size: 12px;
13+
margin-bottom: 50px;
14+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
15+
Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue',
16+
Helvetica, Arial, sans-serif;
17+
}
18+
19+
#carbonads a {
20+
background-image: none;
21+
color: #111;
22+
text-decoration: none;
23+
}
24+
25+
#carbonads a:hover {
26+
color: #111;
27+
}
28+
29+
#carbonads .carbon-img {
30+
display: block;
31+
max-width: 130px;
32+
line-height: 1;
33+
}
34+
35+
#carbonads .carbon-img img {
36+
display: block;
37+
width: 130px;
38+
height: 100px;
39+
margin: 0 auto;
40+
}
41+
42+
#carbonads .carbon-text {
43+
display: block;
44+
padding: 8px 10px;
45+
background-color: hsl(0, 0%, 98%);
46+
line-height: 1.35;
47+
text-align: left;
48+
}
49+
50+
#carbonads .carbon-poweredby {
51+
display: block;
52+
padding: 10px;
53+
background: repeating-linear-gradient(
54+
-45deg,
55+
transparent,
56+
transparent 5px,
57+
hsla(0, 0%, 0%, 0.025) 5px,
58+
hsla(0, 0%, 0%, 0.025) 10px
59+
)
60+
hsla(203, 11%, 95%, 0.4);
61+
background-color: hsl(0, 0%, 98%);
62+
font-weight: 600;
63+
font-size: 8px;
64+
line-height: 0;
65+
letter-spacing: 0.5px;
66+
text-transform: uppercase;
67+
}
68+
69+
@media only screen and (min-width: 320px) and (max-width: 759px) {
70+
#carbonads {
71+
position: relative;
72+
max-width: 330px;
73+
margin: 20px 0;
74+
float: none;
75+
}
76+
77+
#carbonads .carbon-wrap {
78+
display: flex;
79+
flex-direction: row;
80+
}
81+
82+
#carbonads .carbon-img {
83+
margin: 0;
84+
}
85+
86+
#carbonads .carbon-text {
87+
padding: 10px 10px 0 10px;
88+
89+
font-size: 12px;
90+
}
91+
92+
#carbonads .carbon-poweredby {
93+
position: absolute;
94+
right: 0;
95+
bottom: 0;
96+
border-radius: 0;
97+
border-top-left-radius: 3px;
98+
text-align: center;
99+
}
100+
}

src/components/Layout/Ads.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
3+
const Ads = () => {
4+
return (
5+
<script
6+
async
7+
type="text/javascript"
8+
src="//cdn.carbonads.com/carbon.js?serve=CEAIP2QW&placement=react-pdforg"
9+
id="_carbonads_js"
10+
></script>
11+
);
12+
};
13+
14+
export default Ads;

src/components/Layout/Menu.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Link from 'next/link';
33
import styled from '@emotion/styled';
44
import { withRouter } from 'next/router';
55

6+
import Ads from './Ads';
67
import Logo from '../UI/Logo';
78
import GitHubIcon from './GitHubIcon';
89
import media from '../../styled/media';
@@ -67,6 +68,7 @@ const List = styled.ul`
6768
width: 100%;
6869
overflow: auto;
6970
list-style: none;
71+
alignitems: 'center';
7072
7173
${media.phone} {
7274
margin: 35px 0px;
@@ -97,12 +99,16 @@ const Item = withRouter(({ router, to, title, children, ...props }) => {
9799
return (
98100
<ItemWrapper>
99101
{isAbsoluteUrl && (
100-
<MenuLink href={to} target="_blank" {...props} active={active}>{title}</MenuLink>
102+
<MenuLink href={to} target="_blank" {...props} active={active}>
103+
{title}
104+
</MenuLink>
101105
)}
102106

103107
{!isAbsoluteUrl && (
104108
<Link href={to} {...props}>
105-
<MenuLink href={to} active={active}>{title}</MenuLink>
109+
<MenuLink href={to} active={active}>
110+
{title}
111+
</MenuLink>
106112
</Link>
107113
)}
108114
{children && <SubItems active={active}>{children}</SubItems>}
@@ -178,9 +184,9 @@ const Menu = ({ opened }) => (
178184
</Item>
179185

180186
<Item to="/node" title="Node API">
181-
<Item to="/node#rendertofile" title="renderToFile" />
182-
<Item to="/node#rendertostring" title="renderToString" />
183-
<Item to="/node#rendertostream" title="renderToStream" />
187+
<Item to="/node#rendertofile" title="renderToFile" />
188+
<Item to="/node#rendertostring" title="renderToString" />
189+
<Item to="/node#rendertostream" title="renderToStream" />
184190
</Item>
185191

186192
<Item to="/advanced" title="Advanced">
@@ -197,14 +203,19 @@ const Menu = ({ opened }) => (
197203
<Item to="/advanced#dynamic-content" title="Dynamic content" />
198204
<Item to="/advanced#debugging" title="Debugging" />
199205
<Item to="/advanced#hyphenation" title="Hyphenation" />
200-
<Item to="/advanced#usage-with-express.js" title="Usage with Express.js" />
206+
<Item
207+
to="/advanced#usage-with-express.js"
208+
title="Usage with Express.js"
209+
/>
201210
</Item>
202211

203212
<Item to="/repl" title="Playground / REPL" />
204213

205214
<Item to="https://opencollective.com/react-pdf" title="Donate" />
206215
</List>
207216

217+
<Ads />
218+
208219
<GitHubIcon />
209220
</Nav>
210221
);

0 commit comments

Comments
 (0)