Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homepage Documentation, Support Resources, Announcements and FAQ sections #20

Merged
merged 25 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2cbde8b
feat: update start here, tutorials and devportal icons
aliceoq Dec 12, 2023
2ce3140
feat: update landing page documentation section messages
aliceoq Dec 12, 2023
b3109db
feat: update documentation section with new cards
aliceoq Dec 13, 2023
3225053
feat: update graph, paper and warning icons
aliceoq Dec 14, 2023
5c0263c
feat: create faq section messages
aliceoq Dec 14, 2023
c6405d7
feat: create faq data element
aliceoq Dec 15, 2023
c125b0a
feat: create faq section
aliceoq Dec 15, 2023
9752ee0
feat(icons): add health check icon
aliceoq Dec 18, 2023
36a81c1
feat(support): create support data and messages
aliceoq Dec 18, 2023
d35589c
feat(support): create support section
aliceoq Dec 18, 2023
59eb959
style: fix font size in documentation and faq sections
aliceoq Dec 18, 2023
26bde4b
feat: update messages related to the news section
aliceoq Dec 18, 2023
07ef4f8
feat: create announcements section
aliceoq Dec 18, 2023
ac35382
feat: add announcement section icons
aliceoq Dec 18, 2023
cd7ce83
feat: add announcement section
aliceoq Dec 18, 2023
88c0928
fix: add announcement functions
aliceoq Dec 18, 2023
197fbfc
feat(announcement): add see all news button
aliceoq Dec 20, 2023
702ca6f
feat: update education section
aliceoq Dec 20, 2023
b6c2b47
feat: add landing page messages
aliceoq Dec 21, 2023
84b03bd
feat: update homepage first section
aliceoq Dec 21, 2023
bdd0fc5
fix(messages): fix message id in spanish
aliceoq Dec 21, 2023
4825a46
fix: reduce size of homepage image
aliceoq Dec 22, 2023
8d20678
fix(landing): add alt prop to image
aliceoq Jan 3, 2024
d01da6a
fix(landing): add key to announcement timeline items
aliceoq Jan 3, 2024
214dfbb
fix(icons): use camelCase in prop names
aliceoq Jan 3, 2024
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
23 changes: 18 additions & 5 deletions src/components/documentation-section-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import Tooltip from 'components/tooltip'
import styles from './styles'
import { useEffect, useRef, useState } from 'react'
import { useIntl } from 'react-intl'
import LongArrowIcon from 'components/icons/long-arrow-icon'

const DocumentationSectionCard = ({
Icon,
title,
description,
link,
isExternalLink = false,
}: DocDataElement) => {
const intl = useIntl()
const [tooltipState, setTooltipState] = useState(false)
Expand Down Expand Up @@ -56,11 +58,22 @@ const DocumentationSectionCard = ({
className="quickStartedContainer"
sx={styles.quickStartedContainer}
>
<Text className="learnMoreText" sx={styles.learnMoreText}>
{intl.formatMessage({
id: 'landing_page_documentation_documentation_card.learnMoreText',
})}
</Text>
{!isExternalLink ? (
<Text className="learnMoreText" sx={styles.learnMoreText}>
{intl.formatMessage({
id: 'landing_page_documentation_card.learnMoreText',
})}
</Text>
) : (
<Flex sx={styles.accessPortal}>
<Text className="accessPortal" sx={styles.learnMoreText}>
{intl.formatMessage({
id: 'landing_page_documentation_card.accessPortal',
})}
</Text>
<LongArrowIcon size={18} />
</Flex>
)}
</Flex>
</Flex>
</Link>
Expand Down
32 changes: 18 additions & 14 deletions src/components/documentation-section-card/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { SxStyleProp } from '@vtex/brand-ui'

const cardContainer: SxStyleProp = {
flexDirection: 'column',
margin: ['8px', '12px', '12px', '16px'],
width: ['151px', '282px'],
height: ['120px', '225px', '225px'],
margin: '16px',
width: '282px',
height: '293px',
boxSizing: 'initial',
borderRadius: '8px',
border: '1px solid #E7E9EE',
Expand Down Expand Up @@ -40,7 +40,7 @@ const cardContainer: SxStyleProp = {
}

const infoContainer: SxStyleProp = {
py: ['8px', '16px', '24px'],
py: '24px',
px: '16px',
flexDirection: 'column',
alignItems: 'center',
Expand All @@ -53,34 +53,32 @@ const infoContainer: SxStyleProp = {
}

const icon: SxStyleProp = {
width: ['24px', '32px'],
width: '24px',
height: 'auto',
}

const title: SxStyleProp = {
mt: ['8px'],
mb: ['0px', '8px'],
fontSize: ['16px', '22px'],
lineHeight: ['22px', '32px'],
mb: '8px',
fontSize: '22px',
lineHeight: '32px',
fontWeight: '400',
color: 'muted.0',
}

const description: SxStyleProp = {
display: ['none', '-webkit-box'],
fontSize: '16px',
lineHeight: '22px',
fontWeight: '400',
color: 'muted.1',
minHeight: '44px',
overflow: 'hidden',
WebkitLineClamp: 2,
WebkitBoxOrient: 'vertical',
width: '100%',
height: '100%',
}

const quickStartedContainer: SxStyleProp = {
height: ['34px', '68px'],
height: '68px',
justifyContent: 'center',
alignItems: 'center',
borderTop: '1px solid #E7E9EE',
Expand All @@ -104,12 +102,17 @@ const quickStartedContainer: SxStyleProp = {
}

const learnMoreText: SxStyleProp = {
fontSize: ['12px', '16px'],
lineHeight: ['16px', '22px'],
fontSize: '16px',
lineHeight: '22px',
fontWeight: '400',
color: 'muted.0',
}

const accessPortal: SxStyleProp = {
columnGap: '5px',
alignItems: 'center',
}

export default {
cardContainer,
description,
Expand All @@ -118,4 +121,5 @@ export default {
quickStartedContainer,
learnMoreText,
title,
accessPortal,
}
7 changes: 6 additions & 1 deletion src/components/documentation-section/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Flex } from '@vtex/brand-ui'
import { Box, Flex, Text } from '@vtex/brand-ui'

import DocumentationSectionCard from '../documentation-section-card'

Expand All @@ -11,6 +11,11 @@ const DocumentationSection = () => {
const intl = useIntl()
return (
<Box sx={styles.sectionContainer}>
<Text sx={styles.title}>
{intl.formatMessage({
id: 'landing_page_documentation.title',
})}
</Text>
<Flex
sx={styles.cardsContainer}
data-cy="documentation-section-card-list"
Expand Down
1 change: 0 additions & 1 deletion src/components/documentation-section/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SxStyleProp } from '@vtex/brand-ui'

const sectionContainer: SxStyleProp = {
px: ['8px', '12px', '96px', '38px'],
paddingTop: ['0px', '32px'],
paddingBottom: ['24px', '52px', '52px', '48px'],
margin: 'auto',
Expand Down
65 changes: 65 additions & 0 deletions src/components/faq-section-card/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import Link from 'next/link'
import { Flex, Text } from '@vtex/brand-ui'

import type { FaqDataElement } from 'utils/typings/types'
import Tooltip from 'components/tooltip'
import styles from './styles'
import { useEffect, useRef, useState } from 'react'

const FaqSectionCard = ({
Icon,
title,
description,
type,
link,
}: FaqDataElement) => {
const [tooltipState, setTooltipState] = useState(false)
const [tooltipDescription, setTooltipDescription] = useState(description)
const descriptionRef = useRef<HTMLElement>()

useEffect(() => {
const resizeObserver = new MutationObserver(function (entries) {
const target = entries[0].target as HTMLElement
if (target.offsetHeight < target.scrollHeight) setTooltipState(true)
else setTooltipState(false)
setTooltipDescription(target.innerText)
})
if (descriptionRef.current) {
resizeObserver.observe(descriptionRef.current, {
childList: true,
})
}
return () => {
resizeObserver.disconnect
}
}, [descriptionRef.current])

return (
<Tooltip placement="top" label={tooltipDescription} isCard={tooltipState}>
<Link href={link} legacyBehavior>
<Flex sx={styles.cardContainer}>
<Flex className="typeContainer" sx={styles.typeContainer}>
<Icon className="icon" sx={styles.icon} />
<Text className="type" sx={styles.type}>
{type}
</Text>
</Flex>
<Flex sx={styles.infoContainer}>
<Text className="title" sx={styles.title}>
{title}
</Text>
<Text
ref={descriptionRef}
className="description"
sx={styles.description}
>
{description}
</Text>
</Flex>
</Flex>
</Link>
</Tooltip>
)
}

export default FaqSectionCard
115 changes: 115 additions & 0 deletions src/components/faq-section-card/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import { SxStyleProp } from '@vtex/brand-ui'

const cardContainer: SxStyleProp = {
flexDirection: 'column',
margin: '16px',
width: ['292px', '292px', '441px', '441px', '441px', '441px', '441px'],
height: ['84px', '84px', '172px'],
boxSizing: 'initial',
borderRadius: '8px',
border: '1px solid #E7E9EE',
transition: 'all 0.3s ease-out',
padding: '16px',
backgroundColor: 'white',

'.title, .description, .typeContainer': {
transition: 'all 0.3s ease-out',
},

':active, :hover': {
cursor: 'pointer',
backgroundColor: 'white',
borderColor: 'muted.2',
boxShadow: '0px 0px 16px rgba(0, 0, 0, 0.1)',
transition: 'all 0.3s ease-out',

'.title': {
color: '#000711',
},

'.description': {
color: 'muted.0',
},

'.typeContainer': {
borderColor: 'muted.2',
},

'.title, .description, .typeContainer': {
transition: 'all 0.3s ease-out',
},

'.type': {
color: '#F71963',
transition: 'all 0.3s ease-out',
},

'.icon': {
color: '#F71963',
transition: 'all 0.3s ease-out',
},
},
}

const infoContainer: SxStyleProp = {
flexDirection: 'column',
alignItems: 'start',
backgroundColor: '#FEFEFE',
height: '100%',
}

const icon: SxStyleProp = {
width: ['12px', '12px', '18px'],
minHeight: '12px',
minWidth: '12px',
height: 'auto',
}

const title: SxStyleProp = {
mt: '12px',
mb: '12px',
fontSize: ['16px', '16px', '22px'],
lineHeight: ['22px', '22px', '32px'],
fontWeight: '400',
color: 'muted.0',
height: '50%',
}

const description: SxStyleProp = {
fontSize: '16px',
lineHeight: '22px',
fontWeight: '400',
color: 'muted.1',
minHeight: '44px',
overflow: 'hidden',
width: '100%',
height: '50%',
display: ['none', 'none', 'block', 'block', 'block', 'block', 'block'],
}

const typeContainer: SxStyleProp = {
height: '30px',
paddingBottom: '12px',
justifyContent: 'left',
alignItems: 'center',
borderBottom: '1px solid #E7E9EE',
transition: 'all 0.3s ease-out',
columnGap: '4px',
}

const type: SxStyleProp = {
fontSize: ['12px', '12px', '16px'],
lineHeight: '18px',
fontWeight: '400',
color: '#5E6E84',
}

export default {
cardContainer,
description,
icon,
infoContainer,
typeContainer,
type,
title,
}
42 changes: 42 additions & 0 deletions src/components/faq-section/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Box, Button, Flex, Text } from '@vtex/brand-ui'

import { faqData } from 'utils/constants'

import styles from './styles'
import { useIntl } from 'react-intl'
import FaqSectionCard from 'components/faq-section-card'

const FaqSection = () => {
const intl = useIntl()
return (
<Box sx={styles.sectionContainer}>
<Box sx={styles.titleContainer}>
<Box>
<Text sx={styles.title}>
{intl.formatMessage({
id: 'landing_page_faq.title',
})}
</Text>
<Text sx={styles.description}>
{intl.formatMessage({
id: 'landing_page_faq.description',
})}
</Text>
</Box>
<Button sx={styles.leftButton}>
{intl.formatMessage({ id: 'landing_page_faq.button' })}
</Button>
</Box>
<Flex sx={styles.cardsContainer} data-cy="faq-section-card-list">
{faqData(intl).map((card) => (
<FaqSectionCard key={card.title} {...card} />
))}
</Flex>
<Button sx={styles.bottomButton}>
{intl.formatMessage({ id: 'landing_page_faq.button' })}
</Button>
</Box>
)
}

export default FaqSection
Loading