Skip to content

Commit

Permalink
Merge pull request #15 from compolabs/feat/trading-platform-layout
Browse files Browse the repository at this point in the history
trading platform layout
  • Loading branch information
AnnaKuvarina authored Jun 7, 2024
2 parents 646080d + eebb380 commit 08c3d6b
Show file tree
Hide file tree
Showing 14 changed files with 405 additions and 45 deletions.
3 changes: 2 additions & 1 deletion src/core/components/LandingPage/Background.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from "react";

import useWindowWidth from "@/core/hooks/useWindowWidth";

import bg from "./../../../../public/images/frameBackground.png";
import bg from "./../../../../public/images/FrameBackground.png";

// TODO: try to refactor using Next Image
export default function Background() {
const width = useWindowWidth();
return (
Expand Down
3 changes: 2 additions & 1 deletion src/core/components/LandingPage/Features/FeatureCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const FeatureCard = ({ card }: { card: FeatureCardType }) => {
return (
<div css={cssStyles.card}>
<DecorationPlus>
{badge && <Badge text={badge} styles={cssStyles.badge} />}
{badge && <Badge content={badge} styles={cssStyles.badge} bgColor={theme.colors.black[22]} />}
<div css={cssStyles.imageContainer}>
{imageLabel && (
<div css={cssStyles.labelContainer}>
Expand Down Expand Up @@ -81,6 +81,7 @@ const cssStyles = {
badge: css`
margin-top: ${theme.spacing.custom[20]};
margin-bottom: ${theme.spacing.large};
font-size: ${theme.text.size.tiny};
${theme.media.tabletBreakPoint} {
margin-top: ${theme.spacing.huge};
Expand Down
18 changes: 2 additions & 16 deletions src/core/components/LandingPage/GetStartedSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import Image from "next/image";

import SectionWrapper from "@/core/components/common/SectionWrapper";
import theme from "@/core/styles/theme";
import ExternalLinkButton from "@/core/components/common/ExternalLinkWrapper";
import { externalLinks } from "@/core/constants/externalLinks";
import RegularTradeButton from "@/core/components/LandingPage/components/RegularTradeButton";

const GetStartedSection = () => {
return (
Expand All @@ -16,11 +15,7 @@ const GetStartedSection = () => {
Begin with a bespoke onboarding session to align our platform
capabilities with your trading methodologies.
</p>
<ExternalLinkButton
href={externalLinks.tradeApp}
label="Launch trading"
styles={cssStyles.linkButton}
/>
<RegularTradeButton styles={cssStyles.linkButton} label="Launch trading" />
</main>

<div css={cssStyles.imageContainer}>
Expand Down Expand Up @@ -113,15 +108,6 @@ const cssStyles = {
`,

linkButton: css`
display: flex;
justify-content: center;
padding: ${theme.spacing.normal};
background: ${theme.colors.gradients.buttonCTA};
font-size: ${theme.text.size.body};
border-radius: ${theme.borderRadius.default};
width: 100%;
box-shadow: ${theme.shadow.inset};
${theme.media.tabletBreakPoint} {
max-width: 13.75rem;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/LandingPage/LandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useMainFont from "@/core/hooks/useMainFont";
import HeroSection from "./HeroSection";
import Features from "./Features/Features";
import InterfaceSection from "./InterfaceSection";
import TradingPlatformSection from "./TradingPlatformSection";
import { TradingPlatformSection } from "./TradingPlatformSection";
import ResourcesSection from "./ResourcesSection";
import GetStartedSection from "./GetStartedSection";
import Background from "./Background";
Expand Down
10 changes: 0 additions & 10 deletions src/core/components/LandingPage/TradingPlatformSection.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { css } from "@emotion/react";

import TextHighlighter from "@/core/components/common/TextHighlighter";
import theme from "@/core/styles/theme";

import { tradingFeatures } from "./constants";

const TradingFeatures = () => {
return (
<div css={cssStyles.container}>
{tradingFeatures.map(({ title, paragraph, highlight}) => (
<article key={title} css={cssStyles.article}>
<h4 css={cssStyles.title}>{title}</h4>
<p>
<TextHighlighter
text={paragraph}
highlight={highlight}
color={theme.colors.pink}
styles={cssStyles.content}
/>
</p>
</article>
))}
</div>
);
};

const cssStyles = {
container: css`
display: flex;
justify-content: center;
flex-wrap: wrap;
margin: 0 auto;
${theme.media.tablet} {
max-width: 39rem;
width: 100%;
justify-content: space-between;
}
${theme.media.desktop} {
max-width: 55.5rem;
}
`,
article: css`
margin-bottom: ${theme.spacing.extraHuge};
max-width: 20rem;
text-align: center;
&:first-of-type {
margin-bottom: ${theme.spacing.extra};
}
${theme.media.tablet} {
max-width: 16.25rem;
&:first-of-type {
max-width: 17.5rem;
}
}
${theme.media.desktop} {
max-width: 25.5rem;
&:first-of-type {
max-width: 25.5rem;
}
}
`,
title: css`
margin-bottom: ${theme.spacing.normal};
font-size: ${theme.text.size.small};
color: ${theme.colors.white.default};
font-weight: ${theme.text.weight.regular};
${theme.media.tablet} {
margin: 0 auto ${theme.spacing.large};
font-weight: ${theme.text.weight.medium};
font-size: ${theme.text.size.medium};
max-width: 12.5rem;
}
`,
content: css`
font-size: ${theme.text.size.extraTiny};
${theme.media.tablet} {
font-size: ${theme.text.size.small};
}
`,
};

export default TradingFeatures;
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { css, SerializedStyles } from "@emotion/react";

import {
activeIndex, bottomLeftActiveIndex, bottomRightActiveIndex, postActiveIndex,
preActiveIndex,
tradingKeyAttributes
} from "@/core/components/LandingPage/TradingPlatformSection/constants";
import Badge from "@/core/components/common/Badge";
import theme from "@/core/styles/theme";

const getBadgeStyles = (index: number): SerializedStyles | string => {
switch (index) {
case preActiveIndex:
return cssStyles.preActive
case postActiveIndex:
return cssStyles.postActive;
case bottomLeftActiveIndex:
return cssStyles.bottomLeftActive;
case bottomRightActiveIndex:
return cssStyles.bottomRightActive;
default:
return ""
}
};

const TradingKeyAttributes = () => {
return (
<div css={cssStyles.container}>
{tradingKeyAttributes.map((attribute, index) => (
<Badge
key={attribute}
content={attribute}
borderStyles={getBadgeStyles(index)}
styles={index === activeIndex ? cssStyles.active : '' }
bgColor={theme.colors.grey.dark}
/>
))}
</div>
);
};

const cssStyles = {
container: css`
margin: 0 auto ${theme.spacing.extraHuge};
display: flex;
flex-wrap: wrap;
justify-content: center;
max-width: 23.25rem;
gap: ${theme.spacing.normal} ${theme.spacing.default};
${theme.media.tablet} {
max-width: 36rem;
}
${theme.media.desktop} {
max-width: 50.5rem;
}
`,
active: css`
background: ${theme.colors.gradients.buttonTrading};
box-shadow: ${theme.shadow.inset};
${theme.media.tablet} {
background: ${theme.colors.green[100]};
box-shadow: ${theme.shadow.green};
}
`,
preActive: css`
${theme.media.tablet} {
background: linear-gradient(84.21deg, #2a2a2a 88.38%, rgba(105, 255, 195, 0.3825) 97.67%);
}
`,
postActive: css`
${theme.media.tablet} {
background: linear-gradient(275.51deg, #2a2a2a 72.5%, rgba(105, 255, 195, 0.3825) 95.75%);
}
`,
bottomRightActive: css`
${theme.media.tablet} {
background: linear-gradient(333.6deg, rgba(134, 101, 255, 0) 69.92%, rgba(105, 255, 195, 0.3825) 103.32%);
}
`,
bottomLeftActive: css`
${theme.media.tablet} {
background: linear-gradient(4.11deg, rgba(134, 101, 255, 0) 59.35%, rgba(105, 255, 195, 0.3825) 107.33%);
}
`,
};

export default TradingKeyAttributes;
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { css } from "@emotion/react";
import Image from "next/image";

import { SourceNames } from "@/core/utils/pageSources";
import { getIdAnchor } from "@/core/utils/getidAnchor";
import SectionWrapper from "@/core/components/common/SectionWrapper";
import { useMobileWindowWidth } from "@/core/hooks/useMobileWindowWidth";
import theme from "@/core/styles/theme";
import TextHighlighter from "@/core/components/common/TextHighlighter";
import RegularTradeButton from "@/core/components/LandingPage/components/RegularTradeButton";

import {
tradingDescriptionHighlight,
tradingToolkitDescription
} from "./constants";
import TradingKeyAttributes from "./TradingKeyAttributes";
import TradingFeatures from "./TradingFeatures";

const TradingPlatformSection = () => {
const isMobile = useMobileWindowWidth();

return (
<SectionWrapper>
<div
id={getIdAnchor(SourceNames.TradeSmart)}
css={cssStyles.section(isMobile)}
>
<div css={cssStyles.titleWrapper}>
<h2 css={cssStyles.title}>Trading Toolkit: </h2>
<TextHighlighter
text={tradingToolkitDescription}
highlight={tradingDescriptionHighlight}
color={theme.colors.gradients.text}
styles={cssStyles.subtitle}
isGradient
/>
</div>

<TradingKeyAttributes />

<div css={cssStyles.imageContainer}>
<Image
src="./images/trade-platform.png"
alt="trade-platform"
fill
/>
</div>

<TradingFeatures />

<RegularTradeButton label= "Try it" styles={cssStyles.tryBtn} />
</div>
</SectionWrapper>
);
};

const cssStyles = {
section: (isMobile: boolean) => css`
padding: ${isMobile ? `${theme.spacing.custom[40]} 0 ${theme.spacing.custom[20]}` : `${theme.spacing.section} 0`};
width: 100%;
`,
titleWrapper: css`
margin: 0 auto ${theme.spacing.huge};
max-width: 30rem;
text-align: center;
${theme.media.tablet} {
max-width: 43rem;
}
`,
title: css`
margin-bottom: ${theme.spacing.normal};
font-size: ${theme.text.size.small};
color: ${theme.colors.white.default};
${theme.media.tablet} {
margin-bottom: ${theme.spacing.medium};
}
`,
subtitle: css`
font-size: ${theme.text.size.small};
${theme.media.tablet} {
font-size: ${theme.text.size.subtitle};
}
`,
imageContainer: css`
margin: ${theme.spacing.extraHuge} auto;
position: relative;
width: 20rem;
height: 12.5rem;
${theme.media.tablet} {
width: 31.5rem;
height: 21.5rem;
}
`,
tryBtn: css`
max-width: 20.5rem;
margin: 0 auto;
${theme.media.tabletBreakPoint} {
max-width: 14.5rem;
}
`,
}

export default TradingPlatformSection;
Loading

0 comments on commit 08c3d6b

Please sign in to comment.