-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[HTD-36] Feat: Add
Integration cta / hero
component (#54)
* 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
1 parent
feb204a
commit 6221327
Showing
14 changed files
with
326 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')}; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/components/sections/integration/cta/components/icon-rows/icon-rows.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}); | ||
`} | ||
} | ||
`; |
19 changes: 19 additions & 0 deletions
19
src/components/sections/integration/cta/components/icon-rows/icon-rows.types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/components/sections/integration/cta/components/icon-rows/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
Oops, something went wrong.