Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
add content-visibility to sections
Browse files Browse the repository at this point in the history
  • Loading branch information
tlgimenes committed Mar 3, 2022
1 parent 7efcc63 commit f7aa56a
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 30 deletions.
10 changes: 10 additions & 0 deletions src/components/sections/Section/Section.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.pages__section {
display: inline-block;
width: 100%;
content-visibility: auto;
contain-intrinsic-size: auto 500px;

.title-section {
margin-bottom: var(--space-3);
}
}
10 changes: 10 additions & 0 deletions src/components/sections/Section/Section.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import './Section.scss'

import React from 'react'
import type { PropsWithChildren } from 'react'

function Section({ children }: PropsWithChildren<unknown>) {
return <section className="pages__section">{children}</section>
}

export default Section
1 change: 1 addition & 0 deletions src/components/sections/Section/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Section'
69 changes: 39 additions & 30 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Hero from 'src/components/sections/Hero'
import IncentivesHeader from 'src/components/sections/Incentives/IncentivesHeader'
import ProductShelf from 'src/components/sections/ProductShelf'
import ProductTiles from 'src/components/sections/ProductTiles'
import Section from 'src/components/sections/Section'
import { mark } from 'src/sdk/tests/mark'
import type { PageProps } from 'gatsby'
import type { HomePageQueryQuery } from '@generated/graphql'
Expand Down Expand Up @@ -57,7 +58,7 @@ function Page(props: Props) {
Sections: Components imported from '../components/sections' only.
Do not import or render components from any other folder in here.
*/}
<section className="page__section">
<Section>
<Hero
title="New Products Available"
subtitle="At FastStore you can shop the best tech of 2022. Enjoy and get 10% off on your first purchase."
Expand All @@ -66,41 +67,49 @@ function Page(props: Props) {
imageSrc="https://storeframework.vtexassets.com/arquivos/ids/190897/Photo.jpg"
imageAlt="Quest 2 Controller on a table"
/>
</section>
</Section>

<section className="page__section">
<Section>
<IncentivesHeader />
</section>
</Section>

<section className="page__section page__section-shelf / grid-section">
<h2 className="title-section / grid-content">Most Wanted</h2>
<div className="page__section-content">
<ProductShelf products={products?.slice(0, 5)} />
</div>
</section>
<Section>
<section className="page__section-shelf / grid-section">
<h2 className="title-section / grid-content">Most Wanted</h2>
<div className="page__section-content">
<ProductShelf products={products?.slice(0, 5)} />
</div>
</section>
</Section>

<section className="page__section / grid-section grid-content">
<h2 className="title-section">Just Arrived</h2>
<div className="page__section-content">
<ProductTiles products={products?.slice(5, 8)} />
</div>
</section>
<Section>
<section className="grid-section grid-content">
<h2 className="title-section">Just Arrived</h2>
<div className="page__section-content">
<ProductTiles products={products?.slice(5, 8)} />
</div>
</section>
</Section>

<section className="page__section / grid-section">
<BannerText
title="Receive our news and promotions in advance."
caption="Enjoy and get 10% off on your first purchase."
actionPath="/"
actionLabel="Call to action"
/>
</section>
<Section>
<section className="grid-section">
<BannerText
title="Receive our news and promotions in advance."
caption="Enjoy and get 10% off on your first purchase."
actionPath="/"
actionLabel="Call to action"
/>
</section>
</Section>

<section className="page__section page__section-shelf / grid-section">
<h2 className="title-section / grid-content">Deals & Promotions</h2>
<div className="page__section-content">
<ProductShelf products={products?.slice(9, 14)} />
</div>
</section>
<Section>
<section className="page__section-shelf / grid-section">
<h2 className="title-section / grid-content">Deals & Promotions</h2>
<div className="page__section-content">
<ProductShelf products={products?.slice(9, 14)} />
</div>
</section>
</Section>
</>
)
}
Expand Down

0 comments on commit f7aa56a

Please sign in to comment.