Skip to content

Commit 7a2f5c1

Browse files
committed
feat: header facelift
1 parent 79c063b commit 7a2f5c1

File tree

9 files changed

+288
-118
lines changed

9 files changed

+288
-118
lines changed

apify-docs-theme/src/config.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,20 +137,6 @@ const themeConfig = {
137137
},
138138
],
139139
},
140-
{
141-
href: 'https://github.com/apify',
142-
label: 'GitHub',
143-
title: 'Apify on GitHub',
144-
position: 'right',
145-
className: 'icon',
146-
},
147-
{
148-
href: 'https://discord.com/invite/jyEM2PRvMU',
149-
label: 'Discord',
150-
title: 'Chat on Discord',
151-
position: 'right',
152-
className: 'icon',
153-
},
154140
],
155141
},
156142
colorMode: {
@@ -256,6 +242,10 @@ const themeConfig = {
256242
label: 'GitHub',
257243
href: 'https://github.com/apify',
258244
},
245+
{
246+
href: 'https://discord.com/invite/jyEM2PRvMU',
247+
label: 'Discord',
248+
},
259249
{
260250
label: 'Trust Center',
261251
href: 'https://trust.apify.com',

apify-docs-theme/src/theme/Footer/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function Footer() {
2828
const { links, style } = footer;
2929
return (
3030
<footer className={clsx(styles.footer, style)}>
31-
<div className="container padding-horiz--lg">
31+
<div className={styles.container}>
3232
<div className="row" style={{ justifyContent: 'space-between' }}>
3333
{ links.map((column, i) => (
3434
<div key={i} className={`col col--2`}>

apify-docs-theme/src/theme/Footer/index.module.css

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
.footer {
2-
padding-top: 64px;
2+
padding: 4rem 1.6rem 0;
3+
border-top: 1px solid var(--color-neutral-separator-subtle);
4+
}
5+
6+
.container {
7+
max-width: var(--max-layout-width);
8+
margin: 0 auto;
9+
width: 100%;
10+
}
11+
12+
:global(.row) {
13+
margin: unset;
14+
}
15+
16+
:global(.col) {
17+
padding: unset;
318
}
419

520
.builtBy {
@@ -34,15 +49,9 @@
3449
}
3550

3651
.footerTitle {
37-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
38-
'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
39-
'Helvetica Neue', sans-serif;
40-
font-weight: 600;
41-
font-size: 16px;
42-
line-height: 20px;
43-
letter-spacing: 0.1em;
44-
text-transform: uppercase;
45-
color: #8d92af;
52+
font-size: 1.6rem;
53+
font-weight: 700;
54+
line-height: 2.4rem;
4655
margin-bottom: 20px;
4756
}
4857

apify-docs-theme/src/theme/Layout/index.jsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ import { useLocation } from '@docusaurus/router';
22
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
33
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
44
import useBaseUrl from '@docusaurus/useBaseUrl';
5-
import { usePluginData } from '@docusaurus/useGlobalData';
65
import React from 'react';
76

87
export default function LayoutWrapper(props) {
9-
const { options: { subNavbar } } = usePluginData('@apify/docs-theme');
108
const baseUrl = useBaseUrl('/');
119
const currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), '');
1210

1311
return (
1412
<div style={{
15-
'--ifm-navbar-height': subNavbar && !currentPath.startsWith('api/v2') ? '123px' : '68px',
1613
margin: 0,
1714
padding: 0,
1815
boxSizing: 'border-box',

apify-docs-theme/src/theme/Navbar/Content/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
splitNavbarItems,
55
} from '@docusaurus/theme-common/internal';
66
import { usePluginData } from '@docusaurus/useGlobalData';
7-
import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
87
import NavbarLogo from '@theme/Navbar/Logo';
98
import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
109
import NavbarSearch from '@theme/Navbar/Search';
@@ -72,6 +71,7 @@ export default function NavbarContent() {
7271
const { navbar: { items } } = useThemeConfig();
7372
const [leftItems, rightItems] = splitNavbarItems(items);
7473
const searchBarItem = items.find((item) => item.type === 'search');
74+
7575
return (
7676
<div
7777
style={{
@@ -85,20 +85,20 @@ export default function NavbarContent() {
8585
<NavbarContentLayout
8686
left={
8787
<>
88-
<NavbarMobileSidebarToggle />
8988
<NavbarLogo />
9089
<NavbarItems items={leftItems} />
9190
</>
9291
}
9392
right={
9493
<>
95-
<NavbarColorModeToggle className={styles.colorModeToggle} />
9694
<NavbarItems items={rightItems} />
9795
{!searchBarItem && (
9896
<NavbarSearch>
9997
<SearchBar />
10098
</NavbarSearch>
10199
)}
100+
<a href="https://console.apify.com" className={styles.getStarted}>Get started</a>
101+
<NavbarMobileSidebarToggle />
102102
</>
103103
}
104104
/>
Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,44 @@
1-
/*
2-
Hide color mode toggle in small viewports
3-
*/
4-
@media (max-width: 996px) {
5-
.colorModeToggle {
6-
display: none;
1+
.getStarted {
2+
all: unset;
3+
height: 4rem;
4+
padding: 0.8rem 1.6rem !important;
5+
background-color: var(--color-primary-black-action);
6+
border-radius: 2rem;
7+
color: var(--color-neutral-text-on-primary);
8+
font-size: 1.6rem;
9+
font-weight: 500;
10+
line-height: 2.4rem;
11+
box-sizing: border-box;
12+
cursor: pointer;
13+
display: none;
14+
position: relative;
15+
transition: all var(--ifm-transition-fast) var(--ifm-transition-timing-default);
16+
17+
&::before {
18+
content: '';
19+
position: absolute;
20+
top: 0;
21+
right: 0;
22+
bottom: 0;
23+
left: 0;
24+
background: var(--button-gradient);
25+
opacity: 0.4;
26+
border-radius: inherit;
27+
transition: all var(--ifm-transition-fast) var(--ifm-transition-timing-default);
28+
}
29+
30+
&:hover {
31+
background-color: var(--color-primary-black-action-hover);
32+
color: var(--color-neutral-text-on-primary);
33+
34+
&::before {
35+
opacity: 1;
36+
}
37+
}
38+
}
39+
40+
@media (min-width: 480px) {
41+
.getStarted {
42+
display: block;
743
}
844
}

apify-docs-theme/src/theme/SearchBar/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
55
import React, { useCallback } from 'react';
66

77
import { ApifySearch } from '@apify/docs-search-modal';
8+
import './styles.css';
89

910
/**
1011
* Tests whether the given href is pointing to the current docusaurus instance (so we can use the router link).

apify-docs-theme/src/theme/SearchBar/styles.css

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,81 @@
44
}
55

66
.DocSearch-Button {
7+
height: 4rem;
78
margin: 0;
8-
transition: all var(--ifm-transition-fast)
9-
var(--ifm-transition-timing-default);
9+
padding: 0.8rem 1.2rem;
10+
background-color: var(--color-Neutral_BackgroundMuted);
11+
border: 1px solid var(--color-neutral-field-border);
12+
border-radius: 6px;
13+
color: var(--color-neutral-text-placeholder);
14+
/* Annoying, but needed */
15+
/* https://stackoverflow.com/questions/26140050/why-is-font-family-not-inherited-in-button-tags-automatically/26140154 */
16+
font-family: inherit;
17+
font-weight: 400;
18+
display: flex;
19+
align-items: center;
20+
gap: 2rem;
21+
transition: background-color var(--ifm-transition-fast) var(--ifm-transition-timing-default),
22+
color var(--ifm-transition-fast) var(--ifm-transition-timing-default);
23+
}
24+
25+
@media (max-width: 768px) {
26+
.DocSearch-Button {
27+
gap: 0;
28+
}
29+
}
30+
31+
.DocSearch-Button:hover {
32+
box-shadow: none;
33+
background-color: var(--color-Neutral_BackgroundMuted);
34+
color: var(--color-neutral-icon);
35+
}
36+
37+
.DocSearch-Search-Icon {
38+
display: none;
39+
}
40+
41+
.DocSearch-Button-Placeholder {
42+
color: inherit;
43+
font-size: 1.4rem;
44+
line-height: 2.4rem;
45+
padding: 0;
46+
transition: color var(--ifm-transition-fast) var(--ifm-transition-timing-default);
47+
}
48+
49+
.DocSearch-Button-Keys {
50+
width: 3rem;
51+
min-width: unset;
52+
height: 2rem;
53+
background-color: var(--color-neutral-background-subtle);
54+
border: 1px solid var(--color-neutral-border);
55+
border-radius: 4px;
56+
display: flex;
57+
align-items: center;
58+
justify-content: center;
59+
gap: 0.2rem;
60+
}
61+
62+
.DocSearch-Button-Key {
63+
top: unset;
64+
width: unset;
65+
min-width: 0.8rem;
66+
height: unset;
67+
margin: unset;
68+
padding: unset;
69+
background: unset;
70+
border-radius: unset;
71+
box-shadow: unset;
72+
color: var(--color-neutral-text-subtle);
73+
font-size: 1.2rem;
74+
font-weight: 500;
75+
}
76+
77+
.DocSearch-Button-Key:first-child {
78+
width: 1.2rem;
79+
height: 1.2rem;
80+
font-size: 1.6rem;
81+
line-height: 1.2rem;
1082
}
1183

1284
.DocSearch-Container {

0 commit comments

Comments
 (0)