-
Notifications
You must be signed in to change notification settings - Fork 685
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add context menu to cart items
- Loading branch information
Showing
24 changed files
with
862 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
function loadStories() { | ||
const context = require.context('../src', true, /__stories__\/.+\.js$/); | ||
context.keys().forEach(context); | ||
} | ||
|
||
configure(loadStories, module); |
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,63 @@ | ||
const path = require('path'); | ||
|
||
const configureBabel = require('../babel.config.js'); | ||
const babelOptions = configureBabel('development'); | ||
console.log(babelOptions); | ||
|
||
const base_config = require('./webpack.config.js'); | ||
|
||
const themePaths = { | ||
src: path.resolve(__dirname, '../src'), | ||
assets: path.resolve(__dirname, '../web'), | ||
output: path.resolve(__dirname, '../web/js'), | ||
node: path.resolve(__dirname, '../../../') | ||
}; | ||
|
||
console.log(themePaths.node); | ||
|
||
const testPath = path.resolve('../'); | ||
|
||
module.exports = (storybookBaseConfig, configType) => { | ||
storybookBaseConfig.module.rules.push({ | ||
include: [themePaths.src], | ||
test: /\.js$/, | ||
use: [ | ||
{ | ||
loader: 'babel-loader', | ||
options: { ...babelOptions, cacheDirectory: true } | ||
} | ||
] | ||
}); | ||
|
||
storybookBaseConfig.module.rules.push({ | ||
test: /\.css$/, | ||
use: [ | ||
'style-loader', | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
importLoaders: 1, | ||
localIdentName: '[name]-[local]-[hash:base64:3]', | ||
modules: true | ||
} | ||
} | ||
] | ||
}); | ||
|
||
storybookBaseConfig.module.rules.push({ | ||
test: /\.(jpg|svg)$/, | ||
use: [ | ||
{ | ||
loader: 'file-loader', | ||
options: {} | ||
} | ||
] | ||
}); | ||
|
||
storybookBaseConfig.resolve.alias = { | ||
src: themePaths.src | ||
}; | ||
storybookBaseConfig.resolve.modules = ['node_modules']; | ||
|
||
return storybookBaseConfig; | ||
}; |
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
31 changes: 31 additions & 0 deletions
31
packages/venia-concept/src/components/MiniCart/__stories__/Kebab.js
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,31 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
|
||
import Kebab from '../kebab'; | ||
import Section from '../section'; | ||
import 'src/index.css'; | ||
|
||
const stories = storiesOf('Mini Cart/Kebab', module); | ||
|
||
const styles = { | ||
width: '150px', | ||
height: '150px', | ||
display: 'grid' | ||
}; | ||
|
||
stories.add('Kebab Closed', () => ( | ||
<div style={styles}> | ||
<Kebab /> | ||
</div> | ||
)); | ||
|
||
stories.add('Kebab Open', () => ( | ||
<div style={styles}> | ||
<Kebab isOpen={true}> | ||
<Section icon="heart" text="Section 1" /> | ||
<Section icon="x" text="Section 2" /> | ||
<Section icon="chevron-up" text="Section 3" /> | ||
<Section text="Non-icon Section" /> | ||
</Kebab> | ||
</div> | ||
)); |
43 changes: 43 additions & 0 deletions
43
packages/venia-concept/src/components/MiniCart/__stories__/ProductList.js
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 { storiesOf } from '@storybook/react'; | ||
|
||
import ProductList from '../productList'; | ||
import 'src/index.css'; | ||
|
||
const stories = storiesOf('Mini Cart/Product List', module); | ||
|
||
const items = [ | ||
{ | ||
item_id: 1, | ||
name: 'Product 1', | ||
price: 10, | ||
qty: 1, | ||
sku: 'TEST1', | ||
image: 'test.jpg' | ||
}, | ||
{ | ||
item_id: 2, | ||
name: 'Product 2', | ||
price: 5, | ||
qty: 1, | ||
sku: 'TEST2', | ||
image: 'test.jpg' | ||
}, | ||
{ | ||
item_id: 3, | ||
name: 'Product 3', | ||
price: 15, | ||
qty: 1, | ||
sku: 'TEST3', | ||
image: 'test.jpg' | ||
} | ||
]; | ||
|
||
stories.add('Product List With Kebab', () => ( | ||
<ProductList | ||
items={items} | ||
currencyCode="NZD" | ||
removeItemFromCart={() => {}} | ||
showEditPanel={() => {}} | ||
/> | ||
)); |
Oops, something went wrong.
7a4cbf3
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.
Successfully aliased the URL https://magento-venia-vmqykrsgwi.now.sh to the following alias.