-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create component for Recipe card, Add storybook support #41
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d5d5003
Progress
vreddi 2f88a47
Add like component, update card design
vreddi bb4425f
Fix like component, organize content in recipe card component
vreddi 45f158e
Fixed issues with Like component and set text colors on Recipe card
vreddi c65ab01
Made some improvements to the like component
vreddi 640ffd5
Fix like component, add storybook
vreddi 714aeaf
Add tests
vreddi d74d2a1
Resolving PR comments
vreddi 6cf540a
Resolving PR comments - part 2
vreddi dcf83b3
Correct line ending
vreddi 3c4b7f2
Merge branch 'develop' into vreddi/AddRecipeCard
vreddi 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { configure } from '@storybook/react'; | ||
|
||
function loadStories() { | ||
require('../src/stories'); | ||
require('../src/storybook'); | ||
} | ||
|
||
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
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
"start": "webpack-dev-server --open", | ||
"build": "webpack", | ||
"test": "jest", | ||
"clean": "rm -rf node_modules", | ||
"clean": "rm -rf node_modules && npm cache clean --force", | ||
"reinstall": "npm run clean && npm install", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should also probably add |
||
"lint": "eslint . --ext .js --ext .jsx || exit 0", | ||
"lint:fix": "eslint --fix . --ext .js --ext .jsx || exit 0", | ||
|
@@ -96,7 +96,12 @@ | |
"style-loader": "^0.19.0", | ||
"url-loader": "^0.6.2", | ||
"webpack": "^3.11.0", | ||
"webpack-dev-server": "^2.11.2" | ||
"webpack-dev-server": "^2.11.2", | ||
"@storybook/react": "^3.4.8", | ||
"@storybook/addon-actions": "^3.4.8", | ||
"@storybook/addon-links": "^3.4.8", | ||
"@storybook/addons": "^3.4.8", | ||
"babel-runtime": "^6.26.0" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
|
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import './stories/Chip.story'; | ||
import './stories/CardContainer.story'; | ||
import './stories/IngredientCard.story'; | ||
import './stories/RecipeCard.story'; | ||
import './stories/Header.story'; | ||
import './stories/SearchBox.story'; | ||
import '../base.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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import RecipeCard from 'components/RecipeCard/RecipeCard'; | ||
|
||
storiesOf('RecipeCard', module) | ||
.add('Spicy Hotdogs', () => ( | ||
<RecipeCard | ||
title="Spicy Hotdogs" | ||
image="https://cdn.cnn.com/cnnnext/dam/assets/171027052520-processed-foods-exlarge-tease.jpg" | ||
cooktime={20} | ||
description="Pork and beef are the traditional meats used in hot dogs. Less expensive hot dogs are often made from chicken or turkey, using low-cost mechanically separated poultry. Hot dogs often have high sodium, fat and nitrite content, ingredients linked to health problems." | ||
authorName="Rebecca Jones" | ||
authorImage="http://www.attractivepartners.co.uk/wp-content/uploads/2017/06/profile.jpg" | ||
/> | ||
)); |
File renamed without changes.
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.
Sorry, I didn't mean we should just scope the folders. I mean't to decouple storybook from src completely. So the stories should live in the
stories
folder as a sibling tosrc
.This repo is a good example. https://github.com/airbnb/react-dates
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.
That might not be the move. I have seen plenty of repos that keep the stories in the
src
. Following our existing convention of__test__
being insrc
which utilizes the components,stories
should also be insrc
as they too utilize components.Further-more:
Here is what the official doc says:
"There’s no hard and fast rule for this. But, keeping stories close to your components is a good idea.
For example, let’s say your UI components live in a directory called:
src/components
. Then you can write stories inside thesrc/stories
directory.This is just one way to do that. You can always edit your storybook config file and ask it to load stories from anywhere you want."
https://storybook.js.org/basics/writing-stories/
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.
Our tests aren't in src. And I personally prefer things to be decoupled as much as possible. In fact, since our tests are decoupled outside of src, it would make more sense to decouple the stories too.
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.
#47