Skip to content

Commit

Permalink
base layout for resources section (#22)
Browse files Browse the repository at this point in the history
* base layout for resources section

* style improvement

---------

Co-authored-by: anna.kuvarina <AnnaKuvarina>
  • Loading branch information
AnnaKuvarina authored Jun 8, 2024
1 parent 442aba1 commit 4b8cd5d
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 1 deletion.
76 changes: 76 additions & 0 deletions src/core/components/LandingPage/ResourcesSection/NumberedCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { css } from "@emotion/react";

import { CommonEntity } from "core/types";

import TextHighlighter from "@/core/components/common/TextHighlighter";
import theme from "@/core/styles/theme";
import { convertPxToRem } from "@/core/utils/convertPxToRem";

interface PropTypes extends CommonEntity {
number: number,
title: string,
paragraph: {
text: string,
highlight: string,
},
}

const NumberedCard = ({ number, title, paragraph, children, styles }: PropTypes) => {
return (
<article css={[cssStyles.card, styles]}>
<span css={cssStyles.cardNumber}>{number}</span>

<h4 css={cssStyles.title}>{title}</h4>

<TextHighlighter
text={paragraph.text}
highlight={paragraph.highlight}
color={theme.colors.gradients.text}
styles={cssStyles.paragraph}
isGradient
/>

{children}
</article>
)
};

const cssStyles = {
card: css`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
`,
cardNumber: css`
margin-bottom: ${theme.spacing.huge};
font-size: ${theme.text.size.medium};
color: ${theme.colors.grey.medium};
border: ${convertPxToRem(1)} solid ${theme.colors.grey[33]};
border-radius: 50%;
width: ${convertPxToRem(35)};
height: ${convertPxToRem(35)};
`,
title: css`
margin-bottom: ${theme.spacing.normal};
color: ${theme.colors.white.default};
font-size: ${theme.text.size.tiny};
font-weight: ${theme.text.weight.bold};
${theme.media.tabletLandscape} {
margin-bottom: ${theme.spacing.medium};
}
`,
paragraph: css`
margin-bottom: ${theme.spacing.custom[40]};
max-width: ${convertPxToRem(500)};
${theme.media.tabletLandscape} {
max-width: ${convertPxToRem(732)};
font-size: ${theme.text.size.subtitle};
}
`,
}

export default NumberedCard;
57 changes: 57 additions & 0 deletions src/core/components/LandingPage/ResourcesSection/ResourceLinks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { css } from "@emotion/react";

import ExternalLinkButton from "@/core/components/common/ExternalLinkWrapper";
import { convertPxToRem } from "@/core/utils/convertPxToRem";
import theme from "@/core/styles/theme";
import { resourceLinks } from "@/core/components/LandingPage/ResourcesSection/constants";

const ResourceLinks = () => {
return (
<div css={cssStyles.wrapper}>
{resourceLinks.map(({ label, href, svgIcon}) => (
<ExternalLinkButton key={label} href={href} styles={cssStyles.link}>
<span>{label}</span>
{svgIcon}
</ExternalLinkButton>
))}
</div>
);
};

const cssStyles = {
wrapper: css`
display: flex;
flex-direction: column;
align-items: center;
gap: ${theme.spacing.normal};
width: 100%;
${theme.media.tabletBreakPoint} {
flex-direction: row;
justify-content: center;
}
`,
link: css`
display: flex;
justify-content: space-between;
align-items: center;
padding: ${theme.spacing.normal};
background: ${theme.colors.black.default};
box-shadow: ${theme.shadow.inset};
color: ${theme.colors.white.default};
font-size: ${theme.text.size.body};
border-radius: ${theme.borderRadius.default};
max-width: ${convertPxToRem(320)};
width: 100%;
& > img {
padding: ${theme.spacing.small};
}
${theme.media.tabletBreakPoint} {
max-width: ${convertPxToRem(230)};
}
`
};

export default ResourceLinks;
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,36 @@ import { SourceNames } from "@/core/utils/pageSources";
import SectionWrapper from "@/core/components/common/SectionWrapper";
import { DecorationPlus } from "@/core/components/common/DecorationPlus";
import theme from "@/core/styles/theme";
import { resourceCards } from "@/core/components/LandingPage/ResourcesSection/constants";
import NumberedCard from "@/core/components/LandingPage/ResourcesSection/NumberedCard";
import { convertPxToRem } from "@/core/utils/convertPxToRem";

const ResourcesSection = () => {
return (
<SectionWrapper>
<div id={getIdAnchor(SourceNames.Resources)} css={cssStyles.container}>
<div
id={getIdAnchor(SourceNames.Resources)}
css={cssStyles.container}
style={{
backgroundImage: "url(./images/bg2.png)",
backgroundRepeat: "no-repeat",
backgroundSize: "cover",
}}
>
<DecorationPlus>
<h2 css={cssStyles.title}>Knowledge & Insights:</h2>

{resourceCards.map(({ title, paragraph, renderContent}, index) => (
<NumberedCard
key={title}
number={index + 1}
title={title}
paragraph={paragraph}
styles={cssStyles.card}
>
{renderContent()}
</NumberedCard>
))}
</DecorationPlus>
</div>
</SectionWrapper>
Expand All @@ -23,15 +46,39 @@ const cssStyles = {
container: css`
padding: ${theme.spacing.custom[20]} 0 ${theme.spacing.extraHuge};
margin-bottom: ${theme.spacing.custom[20]};
margin-top: ${theme.spacing.custom[20]};
position: relative;
width: 100%;
text-align: center;
border-radius: ${theme.borderRadius.default};
background-color: ${theme.colors.grey.dark};
${theme.media.tabletBreakPoint} {
padding: ${theme.spacing.custom[40]} 0;
}
`,
title: css`
margin-bottom: ${theme.spacing.huge};
color: ${theme.colors.grey.light};
font-weight: ${theme.text.weight.regular};
font-size: ${theme.text.size.tiny};
${theme.media.tabletLandscape} {
margin-bottom: ${convertPxToRem(80)};
font-weight: ${theme.text.weight.medium};
font-size: ${theme.text.size.subtitle};
}
`,
card: css`
&:first-of-type {
margin-bottom: ${theme.spacing.section};
}
${theme.media.tabletLandscape} {
&:first-of-type {
margin-bottom: ${convertPxToRem(116)};
}
}
`,
}

Expand Down
38 changes: 38 additions & 0 deletions src/core/components/LandingPage/ResourcesSection/constants.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Image from "next/image";

import ResourceLinks from "@/core/components/LandingPage/ResourcesSection/ResourceLinks";
import SVGIcon from "@/core/components/common/SVGIcon";
import { externalLinks } from "@/core/constants/externalLinks";

export const resourceCards = [
{
title: "Resource Library:",
paragraph: {
text: "Explore a rich repository of resources, tailored for those who seek to deepen their understanding",
highlight: "Explore a rich repository of resources,",
},
renderContent: () => <ResourceLinks />
},
{
title: "Expert-Led Learning:",
paragraph: {
text: "Gain exclusive insights from industry leaders tailored for those who seek to deepen their understanding",
highlight: "Gain exclusive insights from industry leaders",
},
// TODO: replace with slider
renderContent: () => <div>Slider</div>,
},
];

export const resourceLinks = [
{
label: "Github",
svgIcon: <SVGIcon iconName="Github" size={[32, 32]} />,
href: externalLinks.github,
},
{
label: "Documentation",
svgIcon: <Image src="./images/svg/docs.svg" alt="doc" width={32} height={32} />,
href: externalLinks.docsDevelopers,
},
];
2 changes: 2 additions & 0 deletions src/core/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ const landingTheme = {
bgDark: "#232322",
lightDark: "#3d3d3d",
textLight: "#8E8E8E",
medium: "#999393",
45: "#A3A3A373",
33: "#99939347",
},
black: {
default: "#000",
Expand Down

0 comments on commit 4b8cd5d

Please sign in to comment.