Skip to content

Commit

Permalink
Merge pull request #39 from vtexdocs/feature/vtex-io
Browse files Browse the repository at this point in the history
Feature/VTEX IO Page Layout
  • Loading branch information
leonardoAnjos16 authored May 30, 2022
2 parents 1319422 + 4528650 commit 2a03fac
Show file tree
Hide file tree
Showing 10 changed files with 326 additions and 13 deletions.
Binary file added public/images/vtex-io.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 15 additions & 7 deletions src/components/sidebar-section/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Flex, Box, Text } from '@vtex/brand-ui'
import { useState } from 'react'
import { useContext, useState } from 'react'

import HelpIcon from 'components/icons/help-icon'
import SearchIcon from 'components/icons/search-icon'
import SideBarToggleIcon from 'components/icons/sidebar-toggle-icon'
import SideBarElements from 'components/sidebar-elements'

import { Context } from 'utils/contexts/context'
import type { SidebarItemPropTypes } from 'components/sidebar-elements'
import type { DocumentationTitle, UpdatesTitle } from 'utils/typings/unionTypes'
import styles from './styles'
Expand All @@ -17,14 +18,15 @@ export interface SidebarSectionProps {

const SidebarSection = ({ title, data }: SidebarSectionProps) => {
const [searchValue, setSearchValue] = useState('')
const [sideBarToggle, setSideBarToggle] = useState(false)
const { sidebarSectionHidden, setSidebarSectionHidden } = useContext(Context)

return (
<Box
className={sideBarToggle ? 'active' : ''}
className={sidebarSectionHidden ? 'active' : ''}
sx={styles.sidebarElementsContainer}
>
<Box
className={sideBarToggle ? 'sidebarHide' : ''}
className={sidebarSectionHidden ? 'sidebarHide' : ''}
sx={styles.sidebarElementsBox}
>
<Text sx={styles.sidebarTitle}>
Expand All @@ -46,13 +48,19 @@ const SidebarSection = ({ title, data }: SidebarSectionProps) => {
</Box>
<Flex
className="toggleIcon"
sx={sideBarToggle ? styles.toggleIconBoxActive : styles.toggleIconBox}
sx={
sidebarSectionHidden
? styles.toggleIconBoxActive
: styles.toggleIconBox
}
>
<SideBarToggleIcon
onClick={() => {
setSideBarToggle(!sideBarToggle)
setSidebarSectionHidden(
(sidebarSectionHidden) => !sidebarSectionHidden
)
}}
sx={sideBarToggle ? styles.toggleIcon : {}}
sx={sidebarSectionHidden ? styles.toggleIcon : {}}
/>
</Flex>
</Box>
Expand Down
10 changes: 9 additions & 1 deletion src/messages/language.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,13 @@
"api_guide_documentation_page_contributors.title": "Contributors",
"api_guide_documentation_page_contributors.toggleText": "See less",
"release_notes_page.title": "Release Notes",
"release_notes_page.subtitle": "VTEX platform documentation release notes"
"release_notes_page.subtitle": "VTEX platform documentation release notes",
"vtex_io_page.title": "Welcome to the VTEX IO Developer Documentation",
"vtex_io_page.subtitle": "VTEX IO is a low-code development platform that simplifies the delivery of headless commerce experiences. Learn how to develop web storefronts, custom admin apps and back-end integrations.",
"vtex_io_page_other_resources.title": "Other resources",
"vtex_io_page_other_resources_community.description": "The VTEX Community is an ecosystem where our clients and partners can interact, ask questions, and exchange information among themselves. It's the go-to place to find answers and talk about VTEX products.",
"vtex_io_page_other_resources_learning_center.description": "The Learning Center contains courses about specific aspects of the IO platform and Store Framework.",
"vtex_io_page_other_resources_github.description": "VTEX IO open-source apps and documentation are fully stored in the VTEX Apps Organization on GitHub.",
"vtex_io_page_other_resources_help_center.description": "The Help Center contains beginner tutorials, reference guides and troubleshooting articles about the VTEX Admin panel.",
"vtex_io_page_other_resources_support.description": "All clients have access to the services provided by our Technical Support team. These specialists are extensively prepared to give you the best experience possible when solving your tickets. To contact them, you need to open a ticket to VTEX support."
}
77 changes: 74 additions & 3 deletions src/pages/docs/vtex-io/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
const VtexIOPage = () => {
return <h2>Vtex-IO</h2>
import Image from 'next/image'
import { useState } from 'react'
import { Box, Flex, Link, Text } from '@vtex/brand-ui'

import ContextProvider from 'utils/contexts/context'
import Sidebar from 'components/sidebar'

import { getMessages } from 'utils/get-messages'
import { resources } from 'utils/constants'

import image from '../../../../public/images/vtex-io.png'

import styles from 'styles/vtex-io'

const VTEXIOPage = () => {
const messages = getMessages()
const [sidebarSectionHidden, setSidebarSectionHidden] = useState(false)

return (
<ContextProvider
sidebarSectionHidden={sidebarSectionHidden}
setSidebarSectionHidden={setSidebarSectionHidden}
>
<Flex sx={styles.container}>
<Sidebar sectionSelected="VTEX IO" />
<Box sx={styles.mainContainer}>
<Box sx={styles.welcomeOuterContainer}>
<Flex sx={styles.welcomeInnerContainer}>
<Text sx={styles.welcomeText}>
{messages['vtex_io_page.title']}
</Text>
<Box sx={styles.welcomeImageOuterContainer}>
<Box sx={styles.welcomeImageInnerContainer}>
<Box sx={styles.welcomeImageGradient}></Box>
<Image src={image} />
</Box>
</Box>
</Flex>
</Box>

<Box sx={styles.divider(sidebarSectionHidden)}></Box>

<Box sx={styles.contentContainer}>
<Text sx={styles.subtitle}>
{messages['vtex_io_page.subtitle']}
</Text>

<Box sx={styles.resourcesSectionContainer}>
<Text sx={styles.resourcesSectionTitle}>
{messages['vtex_io_page_other_resources.title']}
</Text>
<Box>
{resources.map((resource) => (
<Box key={resource.title} sx={styles.resourceContainer}>
<Link
target="_blank"
href={resource.link}
sx={styles.resourceTitle}
>
{resource.title}
</Link>
<Text sx={styles.resourceDescription}>
{resource.description}
</Text>
</Box>
))}
</Box>
</Box>
</Box>
</Box>
</Flex>
</ContextProvider>
)
}

export default VtexIOPage
export default VTEXIOPage
152 changes: 152 additions & 0 deletions src/styles/vtex-io.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import type { SxStyleProp } from '@vtex/brand-ui'

const container: SxStyleProp = {
pt: '5rem',
width: '100%',
backgroundColor: 'white',
}

const mainContainer: SxStyleProp = {
width: '100%',
}

const welcomeOuterContainer: SxStyleProp = {
overflow: 'hidden',
}

const welcomeInnerContainer: SxStyleProp = {
flexDirection: ['column-reverse', 'row'],
position: ['initial', 'relative'],
left: [
'initial',
'calc(50% - 1194px / 2 + 325px)',
'calc(50% - 1194px / 2 + 325px)',
'calc(50% - 1194px / 2 + 325px)',
'calc(50% - 1280px / 2 + 280px)',
'calc(50% - 1213px / 2 + 247px)',
],
justifyContent: 'space-between',
alignItems: ['center', 'initial'],
}

const welcomeText: SxStyleProp = {
boxSizing: 'initial',
maxWidth: ['324px', 'initial'],
width: ['auto', '345px', '345px', '345px', '345px', '720px'],
textAlign: ['center', 'initial'],
fontSize: ['20px', '28px'],
lineHeight: ['30px', '38px'],
fontWeight: '400',
color: '#4A4A4A',
position: ['initial', 'absolute'],
pt: ['initial', '115px'],
px: ['18px', 'initial'],
mt: ['32px', 'initial'],
}

const welcomeImageOuterContainer: SxStyleProp = {
width: '100%',
overflow: 'hidden',
}

const welcomeImageInnerContainer: SxStyleProp = {
position: 'relative',
mx: ['auto', 'initial'],
left: ['initial', '308px', '308px', '308px', '339px', '621px', '863px'],
top: ['-92px', '-122px'],
width: ['360px', '592px'],
height: ['128px', '222px'],
}

const welcomeImageGradient: SxStyleProp = {
zIndex: 1,
width: '100%',
height: '100%',
position: 'absolute',
top: ['92px', '122px'],
background: [
'linear-gradient(180deg, rgba(255, 255, 255, 0) -3.42%, #FFFFFF 103.17%)',
'linear-gradient(47.76deg, #FFFFFF -41.03%, rgba(255, 255, 255, 0) 28.93%)',
],
}

const divider: (sidebarSectionHidden: boolean) => SxStyleProp = (
sidebarSectionHidden
) => ({
margin: 0,
padding: 0,
float: 'right',
borderWidth: 0,
borderBottom: '1px solid #E7E9EE',
transition: 'width 0.3s ease-in-out',
width: [
0,
'100%',
'100%',
`calc(100vw - 72px - ${sidebarSectionHidden ? 24 : 300}px)`,
],
})

const contentContainer: SxStyleProp = {
mx: 'auto',
mt: ['16px', '32px'],
mb: ['32px', '64px'],
px: ['18px', 'initial'],
maxWidth: ['324px', 'initial'],
width: ['auto', '544px', '544px', '544px', '720px'],
boxSizing: 'initial',
}

const subtitle: SxStyleProp = {
textAlign: ['center', 'initial'],
fontSize: ['16px', '18px'],
lineHeight: ['22px', '24px'],
fontWeight: '400',
color: '#4A4A4A',
}

const resourcesSectionContainer: SxStyleProp = {
mt: '24px',
}

const resourcesSectionTitle: SxStyleProp = {
fontSize: ['18px', '22px'],
lineHeight: ['30px', '32px'],
fontWeight: '400',
color: '#4A4A4A',
}

const resourceContainer: SxStyleProp = {
mt: '24px',
fontSize: '16px',
fontWeight: '400',
lineHeight: '22px',
}

const resourceTitle: SxStyleProp = {
color: '#E31C58',
}

const resourceDescription: SxStyleProp = {
mt: '8px',
color: '#4A4A4A',
}

export default {
container,
mainContainer,
welcomeOuterContainer,
welcomeInnerContainer,
welcomeText,
welcomeImageOuterContainer,
welcomeImageInnerContainer,
welcomeImageGradient,
divider,
contentContainer,
subtitle,
resourcesSectionContainer,
resourcesSectionTitle,
resourceContainer,
resourceTitle,
resourceDescription,
}
39 changes: 39 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ import ReleaseNotesIcon from 'components/icons/release-notes-icon'
import DocumentationUpdatesIcon from 'components/icons/documentation-updates-icon'

import { getMessages } from 'utils/get-messages'
import {
getCommunityURL,
getLearningCenterURL,
getGithubURL,
getHelpCenterURL,
getSupportURL,
} from 'utils/get-url'

import {
DocDataElement,
UpdatesDataElement,
ReleaseElement,
ResourceDataElement,
} from './typings/types'

export const messages = getMessages()
Expand Down Expand Up @@ -93,3 +102,33 @@ export const releaseData: ReleaseElement[] = [
actionType: 'fixed',
},
]

export const resources: ResourceDataElement[] = [
{
title: 'Community',
description: messages['vtex_io_page_other_resources_community.description'],
link: getCommunityURL(),
},
{
title: 'Learning Center',
description:
messages['vtex_io_page_other_resources_learning_center.description'],
link: getLearningCenterURL(),
},
{
title: 'GitHub',
description: messages['vtex_io_page_other_resources_github.description'],
link: getGithubURL(),
},
{
title: 'Help Center',
description:
messages['vtex_io_page_other_resources_help_center.description'],
link: getHelpCenterURL(),
},
{
title: 'Support',
description: messages['vtex_io_page_other_resources_support.description'],
link: getSupportURL(),
},
]
Loading

0 comments on commit 2a03fac

Please sign in to comment.