Skip to content

Commit

Permalink
[HTD-36] Feat: Add Integration cta / hero component (#54)
Browse files Browse the repository at this point in the history
* feat(HTD-36): add integration cta / hero

* fix(HTD-36): change icons for new ones

* fix(HTD-36): add missing keys

* fix(HTD-36): make appear icons

---------

Co-authored-by: Gerald Martinez <[email protected]>
  • Loading branch information
RBoraurito and nephlin7 committed Apr 19, 2024
1 parent feb204a commit 6221327
Show file tree
Hide file tree
Showing 14 changed files with 326 additions and 19 deletions.
6 changes: 5 additions & 1 deletion src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export default async function Blog() {
<Container>
<Heading color="textGradient">Blog</Heading>
{posts?.map((post, i) => (
<Link href={`/blog/${post.slug}`} style={{ marginBottom: 10, display: 'block', textDecoration: 'none' }}>
<Link
key={i}
href={`/blog/${post.slug}`}
style={{ marginBottom: 10, display: 'block', textDecoration: 'none' }}
>
<Heading as="h3" fontSize="xs" key={post.slug}>
{/* TODO: Remove ban-ts-comment once work on blog post tasks */}
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
Expand Down
38 changes: 27 additions & 11 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { NavigationSidebarLinks } from '@/components/modules/navigation-sidebar-
import { TableContent } from '@/components/modules/table-content';
import { CTA } from '@/components/sections/cta';
import { FeatureLine } from '@/components/sections/feature-line';
import { IntegrationCTA } from '@/components/sections/integration/cta';
import { IntegrationGrid } from '@/components/sections/integration/grid';
import { IntegrationSinglePageHero } from '@/components/sections/integration/single-page/hero';
import { IntegrationSteps } from '@/components/sections/integration/single-page/steps';
Expand Down Expand Up @@ -109,19 +110,19 @@ export default async function Home() {
const nonCollapsibleTableContent = [
{
text: 'Terms Of Service',
href: '#example',
href: '#example-1',
},
{
text: 'Terms Of Service (“Terms”)',
href: '#example',
href: '#example-2',
},
{
text: 'What information do we collect?',
href: '#example',
href: '#example-3',
subItems: [
{
text: 'Information automatically collected',
href: '#example',
href: '#example-5',
},
],
},
Expand All @@ -134,7 +135,7 @@ export default async function Home() {
title: 'Android',
text: 'Android integration for apps and mobile browsers, including automated setup, per-app interception, and system-level certificate injection for complete visibility into emulators and rooted devices.',
link: {
href: '/example',
href: '/example-1',
target: '_blank',
},
},
Expand All @@ -143,7 +144,7 @@ export default async function Home() {
title: 'Javascript',
text: 'Android integration for apps and mobile browsers, including automated setup, per-app interception, and system-level certificate injection for complete visibility into emulators and rooted devices.',
link: {
href: '/example',
href: '/example-2',
target: '_blank',
},
},
Expand All @@ -155,28 +156,28 @@ export default async function Home() {
subitems: [
{
text: 'Standard checkout',
href: '#example',
href: '#example-1',
},
{
text: 'Internet transfer',
href: '#example',
href: '#example-2',
},
],
},
{
text: 'How to pay?',
href: '#example',
href: '#example-3',
},
{
text: 'Troubles with payment',
subitems: [
{
text: 'How to find your money',
href: '#example',
href: '#example-4',
},
{
text: 'My money has gone',
href: '#example',
href: '#example-5',
},
],
},
Expand Down Expand Up @@ -595,6 +596,21 @@ export default async function Home() {
/>
<IntegrationGrid integrations={[...integrationsCard, ...integrationsCard, ...integrationsCard]} />
<Statistics title="Why `*HTTP Toolkit*`?" text="Numbers that speak for themselves:" />
<IntegrationCTA
$variant="hero"
title="Automatic setup and powerful integration for all your tools"
text="With deep integrations into a huge range of popular components & tools, HTTP Toolkit lets you intercept mobile apps, whole devices, bash scripts, entire Docker containers and more, so you can see & modify anything in just one click."
/>
<IntegrationCTA
$variant="cta"
title="Integrations"
text="Explore a vast array of integrations and applications designed to streamline your work, consolidate information, and enhance collaboration effortlessly. "
button={{
$small: true,
$variant: 'secondary',
children: 'See all integrations',
}}
/>
<IntegrationTextImage
title="HTTP Toolkit is a beautiful & open-source toolfor debugging, testing and building with HTTP(S)on Windows, Linux & Mac."
subtitle="what is http toolkit?"
Expand Down
4 changes: 2 additions & 2 deletions src/components/elements/highlighted-text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const HighlightedText = ({ title }: { title: string }) =>
title.split('`').map(segment => {
title.split('`').map((segment, index) => {
const isHighlighted = segment.includes('*');
if (!isHighlighted) {
return segment;
}
return <span>{segment.replaceAll('*', '')}</span>;
return <span key={index}>{segment.replaceAll('*', '')}</span>;
});
11 changes: 11 additions & 0 deletions src/components/elements/show-on-mobile/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use client';

import { styled } from '@/styles';

export const ShowOnMobileOrDesktop = styled.div<{ $mobile?: boolean }>`
display: ${({ $mobile }) => ($mobile ? 'block' : 'none')};
@media (min-width: ${({ theme }) => theme.screens.lg}) {
display: ${({ $mobile }) => (!$mobile ? 'block' : 'none')};
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const FooterColumnBlock = ({ column }: { column: FooterColumn }) => {
}

return (
<li role="listitem">
<li role="listitem" key={link.label}>
<Link key={link.href} href={link.href}>
{link.label}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/growing-numbers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const GrowingNumbers = ({ stats }: GrowingNumbersProps) => {
stats.map(stat => {
const [number, suffix] = convertToMax3DigitsWithSuffix(stat.number);
return (
<StyledGrowingNumbersStat>
<StyledGrowingNumbersStat key={stat.number}>
<StyledGrowingNumberStatNumber>
{<NumberIncreaser maxValue={number} suffix={suffix} />}
{stat.isOver && '+'}
Expand Down
6 changes: 3 additions & 3 deletions src/components/modules/navigation-sidebar-links/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ export const NavigationSidebarLinks = ({ title, links }: NavigationSidebarLinksP
<StyledNavigationSidebarLinksContentWrapper>
{Array.isArray(links) &&
links?.length > 0 &&
links.map(link => (
<StyledNavigationSidebarLinksContentItem>
links.map((link, index) => (
<StyledNavigationSidebarLinksContentItem key={index}>
<StyledNavigationSidebarLinksContentTitle fontSize="m" fontWeight="bold" color="white">
<ItemTitleComponent {...link} />
</StyledNavigationSidebarLinksContentTitle>
{Array.isArray(link.subitems) &&
link.subitems?.length > 0 &&
link.subitems.map(link => (
<StyledNavigationSidebarLinksContentLink href={link.href}>
<StyledNavigationSidebarLinksContentLink key={link.href} href={link.href}>
{link.text}
</StyledNavigationSidebarLinksContentLink>
))}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
'use client';

import type { StyledIconRowItem } from './icon-rows.types';

import { styled } from '@/styles';

const iconsSize = 72;

export const StyledIconRowsWrapper = styled.div<StyledIconRowItem>`
display: flex;
gap: 12px;
@media (min-width: ${({ theme }) => theme.screens.lg}) {
flex-direction: column;
${({ $orientation, $offset }) =>
$orientation === 'right'
? `
margin-right: calc(-${iconsSize}px * ${$offset});
`
: `
margin-left: calc(-${iconsSize}px * ${$offset});
`}
}
`;

export const StyledIconRow = styled.div<StyledIconRowItem>`
display: flex;
gap: 12px;
flex-direction: column;
padding-top: calc(${iconsSize}px * ${({ $offset }) => $offset});
@media (min-width: ${({ theme }) => theme.screens.lg}) {
flex-direction: row;
padding-top: 0;
${({ $orientation, $offset }) =>
$orientation === 'right'
? `
justify-content: start;
padding-left: calc(${iconsSize}px * ${$offset});
`
: `
justify-content: end;
padding-right: calc(${iconsSize}px * ${$offset});
`}
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Icon } from '@phosphor-icons/react';

import type { CustomIcon } from '@/components/elements/icon/custom/types';

export interface IconRowItem {
icons: (Icon | CustomIcon)[];
offset: number;
}

export interface StyledIconRowItem {
$orientation: IconRowsProps['$orientation'];
$offset: IconRowItem['offset'];
}

export interface IconRowsProps {
rows: IconRowItem[];
$offset: IconRowItem['offset'];
$orientation: 'right' | 'left';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { StyledIconRow, StyledIconRowsWrapper } from './icon-rows.styles';
import type { IconRowsProps } from './icon-rows.types';

import { SquareIcon } from '@/components/elements/square-icon';

const parserOffset = (offset: number) => {
const additionalOffset = Math.floor(offset) * 0.16; // .16 is the sixth part of the icon size (72)
return offset + additionalOffset;
};

export const IconRows = ({ rows, $orientation, $offset }: IconRowsProps) => {
return (
<StyledIconRowsWrapper $offset={$offset} $orientation={$orientation}>
{Array.isArray(rows) &&
rows?.length > 0 &&
rows.map((row, rowIndex) => (
<StyledIconRow key={rowIndex} $offset={parserOffset(row.offset)} $orientation={$orientation}>
{Array.isArray(row.icons) &&
row.icons?.length > 0 &&
row.icons.map((icon, iconIndex) => <SquareIcon key={iconIndex} icon={icon} $size="xLarge" />)}
</StyledIconRow>
))}
</StyledIconRowsWrapper>
);
};
83 changes: 83 additions & 0 deletions src/components/sections/integration/cta/cta.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
'use client';

import { styled } from 'styled-components';

import type { StyledIntegrationCTAProps } from './cta.types';

export const StyledIntegrationCTAWrapper = styled.section<StyledIntegrationCTAProps>`
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
width: 100%;
position: relative;
overflow: hidden;
${({ $variant, theme }) =>
$variant === 'cta'
? `
background-color: ${theme.colors.inkBlack};
box-shadow: ${theme.colors.borderGradient};
padding: 32px 16px 0;
gap: 42px;
`
: `
padding: 32px 16px 0;
gap: 32px;
`}
&::before {
content: '';
background: linear-gradient(0deg, ${({ theme }) => theme.colors.darkGrey} 13%, rgba(30, 32, 40, 0) 93.25%);
position: absolute;
right: 0;
left: 0;
bottom: 0;
width: 100%;
height: 130px;
}
@media (min-width: ${({ theme }) => theme.screens.lg}) {
flex-direction: row;
${({ $variant }) =>
$variant === 'cta'
? `
padding: 128px 0;
gap: 99px;
`
: `
padding: 96px 0;
gap: 35px;
`}
&::before, &::after {
content: '';
position: absolute;
background: linear-gradient(90deg, ${({ theme }) => theme.colors.darkGrey} 13%, rgba(30, 32, 40, 0) 93.25%);
width: 200px;
height: 100%;
top: 0;
bottom: unset;
}
&::before {
left: 0;
right: unset;
transform: unset;
}
&::after {
right: 0;
left: unset;
transform: rotate(180deg);
}
}
`;

export const StyledIntegrationCTAContent = styled.div<StyledIntegrationCTAProps>`
display: flex;
flex-direction: column;
align-items: center;
gap: 24px;
`;
11 changes: 11 additions & 0 deletions src/components/sections/integration/cta/cta.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { ButtonProps } from '@/components/elements/button/button.types';

export interface StyledIntegrationCTAProps {
$variant: 'hero' | 'cta';
}

export interface IntegrationCTAProps extends StyledIntegrationCTAProps {
title: string;
text: string;
button?: ButtonProps;
}

0 comments on commit 6221327

Please sign in to comment.