Skip to content

feat: header facelift #1662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions apify-docs-theme/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,6 @@ const themeConfig = {
},
],
},
{
href: 'https://github.com/apify',
label: 'GitHub',
title: 'Apify on GitHub',
position: 'right',
className: 'icon',
},
{
href: 'https://discord.com/invite/jyEM2PRvMU',
label: 'Discord',
title: 'Chat on Discord',
position: 'right',
className: 'icon',
},
],
},
colorMode: {
Expand Down Expand Up @@ -256,6 +242,10 @@ const themeConfig = {
label: 'GitHub',
href: 'https://github.com/apify',
},
{
href: 'https://discord.com/invite/jyEM2PRvMU',
label: 'Discord',
},
{
label: 'Trust Center',
href: 'https://trust.apify.com',
Expand All @@ -274,9 +264,15 @@ const themeConfig = {
appId: 'N8EOCSBQGH',
apiKey: 'e97714a64e2b4b8b8fe0b01cd8592870', // search only (public) API key
indexName: 'test_test_apify_sdk',
placeholder: 'Search documentation',
algoliaOptions: {
facetFilters: ['version:VERSION'],
},
translations: {
button: {
buttonText: 'Search documentation...',
},
},
},
hubspot: {
accountId: '19497222',
Expand Down
16 changes: 10 additions & 6 deletions apify-docs-theme/src/theme/Footer/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useThemeConfig } from '@docusaurus/theme-common';
import LinkItem from '@theme/Footer/LinkItem';
import ColorModeToggle from '@theme/Navbar/ColorModeToggle';
import clsx from 'clsx';
import React from 'react';

Expand All @@ -8,7 +9,7 @@
function FooterLinksColumn({ column }) {
return (
<>
<div className={styles.footerTitle}>{column.title}</div>
<div className={styles.title}>{column.title}</div>
<ul className={clsx(styles.footerItem, 'clean-list')}>
{column.items.map((item, i) => (
<li key={i} className="footer__item">
Expand All @@ -28,21 +29,24 @@
const { links, style } = footer;
return (
<footer className={clsx(styles.footer, style)}>
<div className="container padding-horiz--lg">
<div className="row" style={{ justifyContent: 'space-between' }}>
<div className={styles.container}>
<div className={clsx("row", styles.top)}>

Check failure on line 33 in apify-docs-theme/src/theme/Footer/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Strings must use singlequote
{ links.map((column, i) => (
<div key={i} className={`col col--2`}>
<FooterLinksColumn {...{ column }} />
</div>
))
}
</div>
<div className="row padding-vert--md padding-top--lg">
<div className="col padding-vert--md col--6">
<div className={clsx("row", styles.bottom)}>

Check failure on line 41 in apify-docs-theme/src/theme/Footer/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Strings must use singlequote
<div className="col col--6">
<a href="https://apify.com" target={'_blank'} rel={'dofollow noreferrer'}>
<span className={styles.footerLogo}></span>
<span className={styles.logo}></span>
</a>
</div>
<div className="col col--6">
<ColorModeToggle className={styles.toggle} />
</div>
</div>
</div>
</footer>
Expand Down
83 changes: 69 additions & 14 deletions apify-docs-theme/src/theme/Footer/index.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
.footer {
padding-top: 64px;
padding: 4rem 1.6rem 8rem;
border-top: 1px solid var(--color-neutral-separator-subtle);
}

.container {
max-width: var(--max-layout-width);
width: 100%;
margin: 0 auto;
display: flex;
flex-direction: column;
}

.builtBy {
Expand Down Expand Up @@ -33,29 +42,75 @@
fill: #6f7490;
}

.footerTitle {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
'Helvetica Neue', sans-serif;
font-weight: 600;
font-size: 16px;
line-height: 20px;
letter-spacing: 0.1em;
text-transform: uppercase;
color: #8d92af;
margin-bottom: 20px;
.title {
font-size: 1.6rem;
font-weight: 700;
line-height: 2.4rem;
margin-bottom: 1.6rem;
}

.top {
justify-content: space-between;
}

.bottom {
padding-top: 8rem;

:global(.col) {
display: flex;
align-items: center;
}
}

.toggle {
margin-left: auto;
}

.footerLogo {
.logo {
display: inline-block;
width: 90px;
height: 24px;
background-image: url('/img/footer-apify-logo-black.svg');
background-repeat: no-repeat;
}

html[data-theme='dark'] .footerLogo {
html[data-theme='dark'] .logo {
background-image: url('/img/footer-apify-logo-white.svg');
}

@media (max-width: 996px) {
.footer {
padding: 3.2rem 1.6rem;
}

.container {
flex-direction: column-reverse;
}

.bottom {
padding-top: 0;
gap: 1.6rem;
}

.toggle {
margin-left: unset;
}

.top {
padding: 3.2rem 0;
gap: 3.2rem;
text-align: center;
}

.top::before {
width: 100%;
height: 1px;
margin: 0 -1.6rem;
padding: 0 1.6rem;
content: '';
display: block;
background-color: var(--color-neutral-separator-subtle);
}
}

/** dummy comment just to trigger theme publishing 3 */
3 changes: 0 additions & 3 deletions apify-docs-theme/src/theme/Layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
// cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome
import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index';
import useBaseUrl from '@docusaurus/useBaseUrl';
import { usePluginData } from '@docusaurus/useGlobalData';
import React from 'react';

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

Check failure on line 9 in apify-docs-theme/src/theme/Layout/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

'currentPath' is assigned a value but never used

return (
<div style={{
'--ifm-navbar-height': subNavbar && !currentPath.startsWith('api/v2') ? '123px' : '68px',
margin: 0,
padding: 0,
boxSizing: 'border-box',
Expand Down
7 changes: 7 additions & 0 deletions apify-docs-theme/src/theme/Navbar/CTA/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import styles from '../CTA/styles.module.css';

Check failure on line 1 in apify-docs-theme/src/theme/Navbar/CTA/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Useless path segments for "../CTA/styles.module.css", should be "./styles.module.css"

export default function NavbarCTA() {
return (
<a href="https://console.apify.com" className={styles.getStarted}>Get started</a>

Check failure on line 5 in apify-docs-theme/src/theme/Navbar/CTA/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Expected indentation of 8 spaces but found 6
);
}
57 changes: 57 additions & 0 deletions apify-docs-theme/src/theme/Navbar/CTA/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
.getStarted {
all: unset;
height: 4rem;
padding: 0.8rem 1.6rem !important;
background-color: var(--color-primary-black-action);
border-radius: 2rem;
color: var(--color-neutral-text-on-primary);
font-size: 1.6rem;
font-weight: 500;
line-height: 2.4rem;
box-sizing: border-box;
cursor: pointer;
display: block;
position: relative;
text-align: center;
transition: all var(--ifm-transition-fast) var(--ifm-transition-timing-default);

&::before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: var(--button-gradient);
opacity: 0.4;
border-radius: inherit;
transition: all var(--ifm-transition-fast) var(--ifm-transition-timing-default);
}

&:hover {
background-color: var(--color-primary-black-action-hover);
color: var(--color-neutral-text-on-primary);

&::before {
opacity: 1;
}
}
}

:global(.navbar-sidebar) .getStarted {
display: none;
}

@media (max-width: 768px) {
.getStarted {
width: 100%;
}

:global(.navbar__inner) .getStarted {
display: none;
}

:global(.navbar-sidebar) .getStarted {
display: block;
}
}
8 changes: 4 additions & 4 deletions apify-docs-theme/src/theme/Navbar/Content/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import {
splitNavbarItems,
} from '@docusaurus/theme-common/internal';
import { usePluginData } from '@docusaurus/useGlobalData';
import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
import NavbarLogo from '@theme/Navbar/Logo';
import NavbarMobileSidebarToggle from '@theme/Navbar/MobileSidebar/Toggle';
import NavbarSearch from '@theme/Navbar/Search';
import NavbarItem from '@theme/NavbarItem';
import React from 'react';

import SearchBar from '../../SearchBar';
import styles from './styles.module.css';
import NavbarCTA from '../CTA';

function NavbarItems({ items }) {
return (
Expand Down Expand Up @@ -72,6 +71,7 @@ export default function NavbarContent() {
const { navbar: { items } } = useThemeConfig();
const [leftItems, rightItems] = splitNavbarItems(items);
const searchBarItem = items.find((item) => item.type === 'search');

return (
<div
style={{
Expand All @@ -85,20 +85,20 @@ export default function NavbarContent() {
<NavbarContentLayout
left={
<>
<NavbarMobileSidebarToggle />
<NavbarLogo />
<NavbarItems items={leftItems} />
</>
}
right={
<>
<NavbarColorModeToggle className={styles.colorModeToggle} />
<NavbarItems items={rightItems} />
{!searchBarItem && (
<NavbarSearch>
<SearchBar />
</NavbarSearch>
)}
<NavbarCTA />
<NavbarMobileSidebarToggle />
</>
}
/>
Expand Down
8 changes: 0 additions & 8 deletions apify-docs-theme/src/theme/Navbar/Content/styles.module.css

This file was deleted.

42 changes: 42 additions & 0 deletions apify-docs-theme/src/theme/Navbar/MobileSidebar/Header/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useNavbarMobileSidebar, useThemeConfig } from '@docusaurus/theme-common/internal';

Check failure on line 1 in apify-docs-theme/src/theme/Navbar/MobileSidebar/Header/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Run autofix to sort these imports!

import IconClose from '@theme/Icon/Close';
import NavbarLogo from '@theme/Navbar/Logo';
import NavbarSearch from '@theme/Navbar/Search';
import React from 'react';

import SearchBar from '../../../SearchBar';
import NavbarCTA from '../../CTA';

export default function NavbarMobileSidebarHeader() {
const mobileSidebar = useNavbarMobileSidebar();

const { navbar: { items } } = useThemeConfig();
const searchBarItem = items.find((item) => item.type === 'search');

return (
<>

Check failure on line 18 in apify-docs-theme/src/theme/Navbar/MobileSidebar/Header/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Expected indentation of 8 spaces but found 6
<div className="navbar-sidebar__brand">

Check failure on line 19 in apify-docs-theme/src/theme/Navbar/MobileSidebar/Header/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Expected indentation of 12 spaces but found 8
<NavbarLogo />

Check failure on line 20 in apify-docs-theme/src/theme/Navbar/MobileSidebar/Header/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Expected indentation of 16 spaces but found 10
<button

Check failure on line 21 in apify-docs-theme/src/theme/Navbar/MobileSidebar/Header/index.jsx

View workflow job for this annotation

GitHub Actions / Lint app code

Expected indentation of 16 spaces but found 10
type="button"
className="clean-btn navbar-sidebar__close"
onClick={() => mobileSidebar.toggle()}
aria-label="Close navigation bar"
>
<IconClose />
</button>
</div>
<div className="navbar-sidebar__actions">
<div className="navbar-sidebar__actions__container">
<NavbarCTA />
{!searchBarItem && (
<NavbarSearch>
<SearchBar />
</NavbarSearch>
)}
</div>
</div>
</>
);
}
1 change: 1 addition & 0 deletions apify-docs-theme/src/theme/SearchBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import React, { useCallback } from 'react';

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

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