generated from vtex-sites/base.store
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Feat: Add tokens to SuggestionProductCard
#135
Merged
ArthurTriis1
merged 1 commit into
main
from
feat/FSSS-383-Add-tokens-to-SuggestionProductCard
Jul 5, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { product } from './product' | ||
export { productGridItems } from './productGridItems' |
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,67 @@ | ||
export const product = { | ||
id: '99988212', | ||
slug: 'apple-magic-mouse-99988212', | ||
sku: '99988212', | ||
brand: { | ||
brandName: 'adidas', | ||
name: 'adidas', | ||
}, | ||
name: 'Magic white', | ||
gtin: '1503', | ||
isVariantOf: { | ||
productGroupID: '99995945', | ||
name: 'Apple Magic Mouse', | ||
}, | ||
image: [ | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190902/unsplash-magic-mouse.jpg?v=637800136963870000', | ||
alternateName: 'Magicwhite', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190923/lena-de-fanti-nQ_j5d-klVU-unsplash.jpg?v=637867501523500000', | ||
alternateName: 'magicbox', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190924/anthony-choren-e7dG26YCrZU-unsplash.jpg?v=637867501835430000', | ||
alternateName: 'magicblackwhite', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190925/maheshkumar-painam-GZdfLeL-MDk-unsplash.jpg?v=637867502064000000', | ||
alternateName: 'magiccombo', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190926/math-0U9fBLGP3EY-unsplash.jpg?v=637867502325830000', | ||
alternateName: 'magicback', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190927/marek-levak-YPeqMN_wfw0-unsplash.jpg?v=637867502641430000', | ||
alternateName: 'magictable', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190928/mouse8.jpg?v=637867504048970000', | ||
alternateName: 'magichand', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190929/harpal-singh-KuvEVL7lXYQ-unsplash.jpg?v=637867509459130000', | ||
alternateName: 'magicstyle', | ||
}, | ||
{ | ||
url: 'https://storeframework.vtexassets.com/arquivos/ids/190930/chris-hardy-182PzOtcmWc-unsplash.jpg?v=637867509778300000', | ||
alternateName: 'magicscale', | ||
}, | ||
], | ||
offers: { | ||
lowPrice: 950, | ||
offers: [ | ||
{ | ||
availability: 'https://schema.org/InStock', | ||
price: 950, | ||
listPrice: 999, | ||
quantity: 10000, | ||
seller: { | ||
identifier: '1', | ||
}, | ||
}, | ||
], | ||
}, | ||
} |
File renamed without changes.
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
102 changes: 102 additions & 0 deletions
102
src/components/search/SuggestionProductCard/SuggestionProductCard.stories.mdx
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,102 @@ | ||
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs' | ||
import { SearchInputProvider } from 'src/sdk/search/useSearchInput' | ||
import { SessionProvider } from '@faststore/sdk' | ||
import { LocationProvider } from '@reach/router' | ||
import storeConfig from 'store.config' | ||
import { | ||
TokenTable, | ||
TokenRow, | ||
TokenDivider, | ||
} from 'src/../.storybook/components' | ||
import { product } from 'src/../.storybook/mocks' | ||
|
||
import SuggestionProductCard from '.' | ||
|
||
<Meta | ||
title="Features/Search/SuggestionProductCard" | ||
component={SuggestionProductCard} | ||
args={{ | ||
product, | ||
index: 1 | ||
}} | ||
/> | ||
|
||
export const Template = (args) => ( | ||
<LocationProvider> | ||
<SessionProvider initialState={{ channel: storeConfig.channel }}> | ||
<SearchInputProvider> | ||
<SuggestionProductCard {...args} /> | ||
</SearchInputProvider> | ||
</SessionProvider> | ||
</LocationProvider> | ||
) | ||
|
||
<header> | ||
|
||
# Suggestion Product Card | ||
|
||
Card to show details of the product and suggest in search dropdown. | ||
|
||
</header> | ||
|
||
## Overview | ||
|
||
The `SuggestionProductCard` differs from `ProductCard` because it is used in the `Search` feature and is called by the `Suggestion` component. | ||
|
||
--- | ||
|
||
## Usage | ||
|
||
`import SuggestionProductCard from '../components/search/SuggestionProductCard'` | ||
|
||
<Canvas> | ||
<Story name="SuggestionProductCard">{Template.bind({})}</Story> | ||
</Canvas> | ||
|
||
<ArgsTable story="SuggestionProductCard" /> | ||
|
||
## Nested Elements | ||
|
||
### Link | ||
|
||
<TokenTable> | ||
<TokenRow | ||
token="--fs-suggestion-product-card-link-padding" | ||
value="var(--fs-spacing-1) var(--fs-spacing-3)" | ||
/> | ||
</TokenTable> | ||
|
||
### Image | ||
|
||
<TokenTable> | ||
<TokenRow | ||
token="--fs-suggestion-product-card-image-border-radius" | ||
value="var(--fs-border-radius)" | ||
/> | ||
<TokenRow | ||
token="--fs-suggestion-product-card-image-margin-right" | ||
value="var(--fs-spacing-3)" | ||
/> | ||
<TokenRow | ||
token="--fs-suggestion-product-card-image-height" | ||
value="3.5rem" | ||
/> | ||
</TokenTable> | ||
|
||
### Title | ||
|
||
<TokenTable> | ||
<TokenRow | ||
token="--fs-suggestion-product-card-title-margin-bottom" | ||
value="var(--fs-spacing-0)" | ||
/> | ||
<TokenRow | ||
token="--fs-suggestion-product-card-title-line-height" | ||
value="1.2" | ||
/> | ||
<TokenRow | ||
token="--fs-suggestion-product-card-title-color" | ||
value="var(--fs-color-text)" | ||
isColor | ||
/> | ||
</TokenTable> |
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
53 changes: 53 additions & 0 deletions
53
src/components/search/SuggestionProductCard/suggestion-product-card.module.scss
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,53 @@ | ||
@import "src/styles/scaffold"; | ||
|
||
.fs-suggestion-product-card { | ||
// -------------------------------------------------------- | ||
// Design Tokens for Suggestion Product Card | ||
// -------------------------------------------------------- | ||
|
||
// Suggestion Product Card Link | ||
--fs-suggestion-product-card-link-padding : var(--fs-spacing-1) var(--fs-spacing-3); | ||
|
||
// Suggestion Product Card Image | ||
--fs-suggestion-product-card-image-border-radius : var(--fs-border-radius); | ||
--fs-suggestion-product-card-image-margin-right : var(--fs-spacing-3); | ||
--fs-suggestion-product-card-image-height : 3.5rem; | ||
|
||
// Suggestion Product Card Title | ||
--fs-suggestion-product-card-title-margin-bottom : var(--fs-spacing-0); | ||
--fs-suggestion-product-card-title-line-height : 1.2; | ||
--fs-suggestion-product-card-title-color : var(--fs-color-text); | ||
|
||
[data-fs-suggestion-product-card-image] { | ||
display: flex; | ||
height: var(--fs-suggestion-product-card-image-height); | ||
margin-right: var(--fs-suggestion-product-card-image-margin-right); | ||
overflow: hidden; | ||
border-radius: var(--fs-suggestion-product-card-image-border-radius); | ||
} | ||
|
||
[data-fs-suggestion-product-card-content] { | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
[data-fs-suggestion-product-card-title] { | ||
margin-bottom: var(--fs-suggestion-product-card-title-margin-bottom); | ||
line-height: var(--fs-suggestion-product-card-title-line-height); | ||
color: var(--fs-suggestion-product-card-title-color); | ||
text-decoration: none; | ||
outline: none; | ||
|
||
@include truncate-title; | ||
} | ||
|
||
[data-fs-suggestion-product-card-prices] { | ||
display: flex; | ||
align-items: baseline; | ||
} | ||
|
||
[data-fs-link] { | ||
padding: var(--fs-suggestion-product-card-link-padding); | ||
text-decoration: none; | ||
} | ||
} |
48 changes: 0 additions & 48 deletions
48
src/components/search/SuggestionProductCard/suggestion-product-card.scss
This file was deleted.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Could you please update it on Nextjs starter as well if it's not too much work?
I noticed there we have mocks and mock folders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! I'm opening the PR!