Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
38 changes: 37 additions & 1 deletion src/components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
import clsx from 'clsx';
import type React from 'react';

import { ArrowRightIcon } from '@apify/ui-icons';

import { Heading } from '../Heading';
import { Text } from '../Text';
import styles from './styles.module.css';

interface HeroPromotionProps {
badge: string;
label: string;
labelMobile?: string;
href: string;
}

function HeroPromotion({ badge, label, labelMobile, href }: HeroPromotionProps) {
return (
<a href={href} className={styles.heroPromotionLink}>
<Text className={styles.heroPromotionBadge} as="span">
{badge}
</Text>
<div className={styles.heroPromotionContent}>
<Text className={styles.heroPromotionLabel} weight="medium">
<span className={styles.heroPromotionLabelDesktop}>
{label}
</span>
<span className={styles.heroPromotionLabelMobile}>
{labelMobile || label}
</span>
</Text>
<ArrowRightIcon
className={styles.heroPromotionArrow}
size="16"
/>
</div>
</a>
);
}

interface HeroProps {
heading: string;
description: React.ReactNode | string;
promotion?: HeroPromotionProps;
className?: string;
}

export default function Hero({ heading, description, className }: HeroProps) {
export default function Hero({ heading, description, promotion, className }: HeroProps) {
return (
<header className={clsx(styles.heroBanner, className)}>
<div className={clsx(styles.heroBannerContent)}>
{promotion && <HeroPromotion {...promotion} />}
<div>
<Heading type='title3Xl' className={styles.tagline}>{heading}</Heading>
</div>
Expand Down
69 changes: 67 additions & 2 deletions src/components/Hero/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
@media (min-width: 768px) {
.heroBannerContent {
max-width: 738px;
align-items: flex-start;
text-align: left;
}
.heroBanner {
margin-bottom: 0;
Expand Down Expand Up @@ -92,3 +90,70 @@ html[data-theme='dark'] .heroBanner p {
font-size: 0.7em;
}
}

.heroBanner .heroPromotionLink {
border-radius: 1000px;
border: 1px solid var(--color-Neutral_SeparatorSubtle);
background: var(--color-Neutral_Background);
display: flex;
padding: 0.8rem 1.2rem;
align-items: center;
gap: 0.8rem;
margin-bottom: 0.8rem;

@media (max-width: 767px) {
padding: 0.8rem 1.6rem;
flex-direction: column;
}

&:hover {
background: var(--color-Neutral_Hover);

.heroPromotionArrow {
transform: translateX(4px);
}
}
}

.heroBanner .heroPromotionContent {
display: flex;
align-items: center;
gap: 0.6rem;
}

.heroBanner .heroPromotionBadge {
border-radius: 1.2rem;
background: var(--color-primary-chip-background);
color: var(--color-primary-chip-text);
display: flex;
padding: 0.2rem 0.8rem;
justify-content: center;
align-items: center;
gap: 1rem;
}

.heroBanner .heroPromotionLabel {
color: var(--color-neutral-text);
}

.heroBanner .heroPromotionLabelDesktop {
display: inline;
}

.heroBanner .heroPromotionLabelMobile {
display: none;
}

@media (max-width: 767px) {
.heroBanner .heroPromotionLabelDesktop {
display: none;
}
.heroBanner .heroPromotionLabelMobile {
display: inline;
}
}

.heroBanner .heroPromotionArrow {
color: var(--color-neutral-icon);
transition: transform 0.2s;
}
2 changes: 1 addition & 1 deletion src/components/SdkSection/SdkSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default function SdkSection({
/>
<Heading type="titleXl" style={{ verticalAlign: 'center' }}>{title}</Heading>
</div>
<Text size='medium' color={theme.color.neutral.textMuted}>
<Text color={theme.color.neutral.textMuted}>
{description}
</Text>
</div>
Expand Down
26 changes: 16 additions & 10 deletions src/components/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,51 @@ const TEXT_VARIANTS_CSS = {
body: {
large: {
normal: css`${theme.typography.shared.mobile.bodyL}`,
medium: css`${theme.typography.shared.mobile.bodyLMedium}`,
bold: css`${theme.typography.shared.mobile.bodyLStrong}`,
},
regular: {
normal: css`${theme.typography.shared.mobile.bodyM}`,
medium: css`${theme.typography.shared.mobile.bodyMMedium}`,
bold: css`${theme.typography.shared.mobile.bodyMStrong}`,
},
small: {
normal: css`${theme.typography.shared.mobile.bodyS}`,
medium: css`${theme.typography.shared.mobile.bodySMedium}`,
bold: css`${theme.typography.shared.mobile.bodySStrong}`,
},
},
code: {
large: {
normal: css`${theme.typography.shared.mobile.codeL}`,
medium: css`${theme.typography.shared.mobile.codeLMedium}`,
bold: css`${theme.typography.shared.mobile.codeLStrong}`,
},
regular: {
normal: css`${theme.typography.shared.mobile.codeM}`,
medium: css`${theme.typography.shared.mobile.codeMMedium}`,
bold: css`${theme.typography.shared.mobile.codeMStrong}`,
},
small: {
normal: css`${theme.typography.shared.mobile.codeS}`,
medium: css`${theme.typography.shared.mobile.codeSMedium}`,
bold: css`${theme.typography.shared.mobile.codeSStrong}`,
},
},
};

interface TextComponentProps extends TextBaseProps {
type?: string;
size?: string;
weight?: string;
type TextComponentProps = TextBaseProps & {
type?: 'body' | 'code';
size?: 'large' | 'regular' | 'small';
weight?: 'normal' | 'medium' | 'bold';
as?: React.ElementType;
}
};

interface TextCssProps {
$type?: string;
$size?: string;
$weight?: string;
}
type TextCssProps = {
$type?: 'body' | 'code';
$size?: 'large' | 'regular' | 'small';
$weight?: 'normal' | 'medium' | 'bold';
};

const getTextCss = ({ $type = 'body', $size = 'regular', $weight = 'normal' }: TextCssProps) => {
return TEXT_VARIANTS_CSS[$type]?.[$size]?.[$weight];
Expand Down
13 changes: 10 additions & 3 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@ export default function Home() {
<Layout>
<Hero
heading="Apify Documentation"
promotion={{
badge: 'New',
label: 'Join the Apify $1M Challenge. Build to win!',
labelMobile: 'Join the Apify $1M Challenge!',
href: 'https://apify.com/challenge',
}}
description={
<Text color={theme.color.neutral.textMuted} size='large'>
Learn how to extract value from the web with the Apify platform.
<Text color={theme.color.neutral.textMuted} size="large">
Learn how to extract value from the web with the Apify
platform.
</Text>
}
/>
Expand All @@ -74,7 +81,7 @@ export default function Home() {
<div className={styles.bannerContent}>
<div className={styles.bannerContentDescription}>
<Heading type="titleXl">Getting started</Heading>
<Text size='medium' color={theme.color.neutral.textMuted}>
<Text color={theme.color.neutral.textMuted}>
Apify is all about Actors—a new way to package your code to make it easy to share, integrate, and build upon.
</Text>
<ThemedImage
Expand Down