Skip to content

Commit 7a24781

Browse files
docs: Add API Clients landing page (#991)
Closes apify/apify-web#3622 Adds landing page for API clients (Python and JS). Menu item not added yet **Differences design-wise:** - Wasn't able to figure out background svg in hero section - In that case, not sure if that transparent section border makes sense --------- Co-authored-by: Eva Baldasseroni <[email protected]>
1 parent 0a1263d commit 7a24781

File tree

16 files changed

+479
-35
lines changed

16 files changed

+479
-35
lines changed

apify-docs-theme/src/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ const themeConfig = ({
4343
{
4444
label: 'API',
4545
type: 'dropdown',
46+
to: `${absoluteUrl}/api`,
47+
target: '_self',
48+
rel: 'dofollow',
4649
activeBasePath: 'api',
4750
position: 'left',
4851
items: [

nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ server {
190190
rewrite ^/academy/web-scraping-for-beginners/crawling/processing-data$ /academy/web-scraping-for-beginners/crawling/exporting-data permanent;
191191
rewrite ^/academy/web-scraping-for-beginners/crawling/recap-collection-basics$ /academy/web-scraping-for-beginners/crawling/recap-extraction-basics permanent;
192192
rewrite ^/academy/php/using-apify-scraper-with-php$ /academy/php/use-apify-from-php permanent;
193-
rewrite ^/api/?$ /api/v2 redirect;
193+
rewrite ^/api/client?$ /api redirect;
194194

195195
# sdk/js/api -> sdk/js/reference
196196
rewrite ^/sdk/js/api/apify(.*)$ /sdk/js/reference$1 permanent;

package-lock.json

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"typescript": "^5.1.3"
5757
},
5858
"dependencies": {
59-
"@apify-packages/ui-library": "^0.8.0",
59+
"@apify-packages/ui-library": "^0.12.0",
6060
"@apify/docsearch-apify-docs": "3.5.3",
6161
"@docusaurus/core": "^2.4.1",
6262
"@docusaurus/plugin-client-redirects": "^2.4.1",
@@ -66,6 +66,7 @@
6666
"@giscus/react": "^2.2.8",
6767
"clsx": "^2.0.0",
6868
"form-data": "^4.0.0",
69+
"github-buttons": "^2.28.0",
6970
"postcss-preset-env": "^9.3.0",
7071
"prop-types": "^15.8.1",
7172
"proxy-from-env": "^1.1.0",

src/components/Button.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ const BUTTON_SIZES_CSS = {
3636
font-size: 1.6rem;
3737
font-style: normal;
3838
font-weight: 600;
39-
line-height: 2.4rem;
39+
line-height: 2.4rem;
4040
4141
@media (min-width: ${theme.layout.desktop}) {
4242
font-size: 1.8rem;
43-
line-height: 2.8rem;
43+
line-height: 2.8rem;
4444
}
4545
`,
4646
};
@@ -81,9 +81,8 @@ const StyledButton = styled.button<ButtonProps>`
8181
display: inline-flex;
8282
align-items: center;
8383
justify-content: center;
84-
height: 100%;
8584
font-family: var(--ifm-font-family-base);
86-
85+
8786
${getButtonVariantCss}
8887
${getButtonSizeCss}
8988
`;

src/components/GitButton.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { useColorMode } from '@docusaurus/theme-common';
2+
import { GitHubButtonProps } from 'github-buttons';
3+
import React, { PropsWithChildren } from 'react';
4+
import GitHubButton from 'react-github-btn';
5+
6+
export default function GitButton(props: PropsWithChildren<GitHubButtonProps>) {
7+
const { colorMode } = useColorMode();
8+
return (
9+
<GitHubButton data-color-scheme={colorMode} {...props} />
10+
);
11+
}

src/components/Hero/Hero.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import { Heading } from '../Heading';
77
interface HeroProps {
88
heading: string;
99
description: React.ReactNode | string;
10+
className?: string;
11+
isCentered?: boolean;
1012
}
1113

12-
export default function Hero({ heading, description }: HeroProps) {
14+
export default function Hero({ heading, description, className, isCentered }: HeroProps) {
1315
return (
14-
<header className={clsx(styles.heroBanner)}>
15-
<div className={styles.heroBannerContent}>
16+
<header className={clsx(styles.heroBanner, className)}>
17+
<div className={clsx(styles.heroBannerContent, isCentered && styles.heroBannerContentCentered)}>
1618
<div>
1719
<Heading type='title3Xl' className={styles.tagline}>{heading}</Heading>
1820
</div>

src/components/Hero/styles.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
}
1515

1616
@media (min-width: 768px) {
17-
.heroBannerContent { max-width: 738px; align-items: flex-start; text-align: left; }
17+
.heroBannerContent { max-width: 738px; align-items: flex-start; text-align: left; }
18+
.heroBannerContent.heroBannerContentCentered { max-width: 738px; align-items: center; }
1819
.heroBanner { margin-bottom: 0; }
1920
}
2021

@@ -50,7 +51,6 @@
5051
html[data-theme='dark'] .heroBanner::after {
5152
background: linear-gradient(180deg, #1A1B21 0%, rgba(26, 27, 33, 0) 100%);
5253
transform: matrix(1, 0, 0, -1, 0, 0);
53-
5454
}
5555

5656
.heroBanner .heroDescription {

src/components/Section/Section.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { theme } from '@apify-packages/ui-library';
2+
import clsx from 'clsx';
23
import React from 'react';
34

45
import styles from './styles.module.css';
@@ -7,13 +8,14 @@ import { Text } from '../Text';
78

89
interface SectionProps {
910
heading?: string;
10-
description?: string;
11-
children: React.ReactNode | string;
11+
description?: React.ReactNode;
12+
className?: string;
13+
children?: React.ReactNode;
1214
}
1315

14-
export default function Section({ heading, description, children }: SectionProps) {
16+
export default function Section({ heading, description, className, children }: SectionProps) {
1517
return (
16-
<section className={styles.section}>
18+
<section className={clsx(styles.section, className)}>
1719
{(heading || description) && <div className={styles.sectionHeader}>
1820
{heading && <Heading type='titleXl'>{heading}</Heading>}
1921
{description && <Text color={theme.color.neutral.textMuted}>{description}</Text>}

src/components/Tabs.tsx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { theme } from '@apify-packages/ui-library';
2+
import clsx from 'clsx';
3+
import React from 'react';
4+
import styled from 'styled-components';
5+
6+
import { Heading } from './Heading';
7+
8+
const TabsWrapper = styled.div`
9+
display: flex;
10+
gap: 8px;
11+
width: 100%;
12+
height: 100%;
13+
border-bottom: 1px solid ${theme.color.neutral.separatorSubtle};
14+
margin-bottom: 24px;
15+
16+
.TabItem {
17+
color: ${theme.color.neutral.textSubtle};
18+
padding: ${theme.space.space8};
19+
cursor: pointer;
20+
}
21+
22+
.TabItem-active {
23+
color: ${theme.color.primary.text};
24+
border-bottom: 2px solid ${theme.color.primary.action};
25+
}
26+
`;
27+
28+
interface TabsProps {
29+
items: {
30+
title: React.ReactNode;
31+
content: React.ReactNode;
32+
}[];
33+
}
34+
35+
export default function Tabs({ items }: TabsProps) {
36+
const [activeTab, setActiveTab] = React.useState(0);
37+
38+
return (<>
39+
<TabsWrapper>
40+
{items.map(({ title }, index) => (
41+
<Heading
42+
key={title?.toLocaleString()}
43+
$type="titleS"
44+
className={clsx('TabItem', activeTab === index && 'TabItem-active')}
45+
onClick={() => setActiveTab(index)}
46+
>{title}</Heading>
47+
))}
48+
</TabsWrapper>
49+
{items[activeTab].content}
50+
</>
51+
);
52+
}

0 commit comments

Comments
 (0)