-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from vtex-apps/feature/shelf-with-title
Create shelf component with title
- Loading branch information
Showing
17 changed files
with
157 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './components/Shelf' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react' | ||
import { ExtensionPoint } from 'vtex.render-runtime' | ||
import { useCssHandles } from 'vtex.css-handles' | ||
|
||
import styles from './styles.css' | ||
|
||
interface Props { | ||
title?: string | ||
products?: Product[] | ||
} | ||
|
||
const CSS_HANDLES = ['shelfTitleContainer', 'shelfTitle'] | ||
|
||
const Shelf: StorefrontFunctionComponent<Props> = ({ title, products }) => { | ||
const handles = useCssHandles(CSS_HANDLES) | ||
|
||
return ( | ||
<div className="flex-none tc"> | ||
{title && ( | ||
<div className={`mv4 v-mid ${handles.shelfTitleContainer}`}> | ||
<span className={`${styles.shelfTitle} ${handles.shelfTitle}`}> | ||
{title} | ||
</span> | ||
</div> | ||
)} | ||
{(!products || products.length === 0) && ( | ||
<ExtensionPoint id="list-context.product-list" /> | ||
)} | ||
{products && products.length > 0 && ( | ||
<ExtensionPoint | ||
id="list-context.product-list-static" | ||
products={products} | ||
/> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
Shelf.schema = { | ||
title: 'admin/editor.shelf.title', | ||
} | ||
|
||
export default Shelf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.shelfTitle { | ||
text-transform: uppercase; | ||
font-weight: 600; | ||
font-size: 1.25rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.slide--shelf { | ||
margin-bottom: 25px; | ||
padding-left: .5rem; | ||
padding-right: .5rem; | ||
} | ||
|
||
.layoutContainer--shelf { | ||
margin-top: 20px; | ||
margin-bottom: 20px; | ||
max-width: 96rem; | ||
} |