Navigation Menu

Skip to content
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

Move styles inline for React progress components #8756

Merged
merged 14 commits into from Jun 7, 2016

Conversation

joshlory
Copy link
Contributor

@joshlory joshlory commented Jun 3, 2016

The change moves the CSS styles inline for the React progress components. I've updated the UI tests to check CSS color instead of class name.

There's still one external jQuery dependency on the class name of the level dots (in loadApp.js). I plan to move this to use the Redux store in a separate PR.

@joshlory
Copy link
Contributor Author

joshlory commented Jun 3, 2016

No rush on this PR! I'm OOF today and won't be able to look at feedback until Monday.

display: React.PropTypes.oneOf(['dots', 'list']).isRequired,
stages: React.PropTypes.arrayOf(STAGE_TYPE)
},

getRow(stage) {
if (this.props.display === 'dots') {
return <CourseProgressRow stage={stage} key={stage.name} />;
return <CourseProgressRow stage={stage} key={stage.name} currentLevelId={this.props.currentLevelId} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, dumb question.. is it normal to use these kinds of custom tags in react?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@breville This is how you pass props to child components (i.e. The CourseProgressRow component will now have a prop named currentLevelId set to the same value as this component's currentLevelId

@breville
Copy link
Member

breville commented Jun 3, 2016

looks great to me. react stuff is still new to me, but didn't see any issues.

@@ -2,29 +2,47 @@
import React from 'react';
import { STAGE_TYPE } from './types';
import StageProgress from './stage_progress.jsx';
import color from '../../color';

var style = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could be const. also our convention has been to call this variable styles rather than style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c149942cf4e47f8b6c9508cc71a2d89bb899558a.

@Bjvanminnen
Copy link
Contributor

couple nits, but generally looks good

@joshlory joshlory force-pushed the react-progress-inline-styles branch from 97aad59 to 8e1efcc Compare June 6, 2016 23:22
@joshlory
Copy link
Contributor Author

joshlory commented Jun 7, 2016

@Bjvanminnen ready for another look when you get a chance.

@@ -2,29 +2,47 @@
import React from 'react';
import { STAGE_TYPE } from './types';
import StageProgress from './stage_progress.jsx';
import color from '../../color';

const STYLES = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit, but our convention thus far is to have this be a lower case styles

largeDots={this.props.largeDots}
saveAnswersFirst={this.props.saveAnswersFirst}
/>, ' '
]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're mapping each to an array of ProgressDot? I think you can get rid of the brackets and just map each to a ProgressDot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to get the exact Code Studio™ spacing in the header we actually need a space between the elements 😄. I tried to recreate it with margin but it's not a whole number of pixels, and seems to round differently. I can look at getting rid of the ' ' in a future PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh. missed the space. Makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gif showing the difference with margin vs. spacing from white space:
dot_spacing

White spacing:
before

Margin:
after

I think the diff is acceptable so I'll go ahead and remove ' ' and add the margin. It may be a small enough change to not trigger an Eyes test failure.

@Bjvanminnen
Copy link
Contributor

Couple of high level nits (I didn't comment on every instance)
styles vs STYLES. I don't have a great argument as to why, other than this is what we've been doing elsewhere.
A bunch of places you're using let where you could be using const. Preference should be to use const anywhere you can, as it makes it easier to know which variables you have to worry about when thinking about what is/isnt mutable.

@joshlory
Copy link
Contributor Author

joshlory commented Jun 7, 2016

Ah you're totally right, the Airbnb style guide we reference recommends lowercase const names.

import StageProgress from './stage_progress.jsx';
import color from '../../color';

const STYLES = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

styles

@Bjvanminnen
Copy link
Contributor

looks like there's still one instance of STYLES vs. styles, otherwise lgtm

@joshlory joshlory merged commit 1341eda into staging Jun 7, 2016
@joshlory joshlory deleted the react-progress-inline-styles branch June 7, 2016 17:53
deploy-code-org added a commit that referenced this pull request Jun 7, 2016
2230104 Merge pull request #8780 from code-dot-org/npm-piskel (Brad Buchanan)
69e5430 Merge branch 'test' into staging (Josh Lory)
d9c4601 Merge branch 'production' into test (Josh Lory)
a895055 Merge pull request #8811 from code-dot-org/test (Josh Lory)
0585f54 Merge pull request #8783 from code-dot-org/pcardune-content-security-policy (Paul Carduner)
e873ec7 Merge pull request #8786 from code-dot-org/pcardune-apps-coverage-report (Paul Carduner)
2d57ffd Merge pull request #8809 from code-dot-org/revert-8748-firebase-basics (David Bailey)
0e85abc Revert "Firebase basics" (David Bailey)
bdf3fbb Merge pull request #8784 from code-dot-org/hide_solution_link_for_pd (Mehal Shah)
c274d51 Merge pull request #8808 from code-dot-org/hotfix-progress-dots (Josh Lory)
3fda3ff Hotfix: fix unplugged progress dots rendering issue (Josh Lory)
e1bcd99 Amend 799c13c (Josh Lory)
bfde939 Merge pull request #8787 from code-dot-org/bounce-ui-tests (David Bailey)
460c2d6 Merge pull request #8748 from code-dot-org/firebase-basics (David Bailey)
85bfdce Merge pull request #8794 from code-dot-org/fixPrivilegesUI (ashercodeorg)
fa1d792 Merge pull request #8788 from code-dot-org/fix-test-iphone-hocReset (Andrew Oberhardt)
0ae0e16 Merge pull request #8791 from code-dot-org/cucumber-logs-on-s3 (Brad Buchanan)
d36fa89 Merge pull request #8806 from code-dot-org/test (Josh Lory)
a644205 PR feedback - going back to using forbidden (Mehal Shah)
fc95f09 Merge pull request #8804 from code-dot-org/staging (Josh Lory)
c373dff Merge pull request #8803 from code-dot-org/progress-dots-fix (Josh Lory)
799c13c Unplugged dots should be small when not the current level (Josh Lory)
9baccd6 Merge pull request #8801 from code-dot-org/localsLevel (Brent Van Minnen)
6826eeb locals.level instead of just level (Brent Van Minnen)
5d82aee Merge remote-tracking branch 'origin/staging' into cucumber-logs-on-s3 [ui test] (Brad Buchanan)
267321f Extract log uploader from runner.rb (Brad Buchanan)
5a59be7 Merge pull request #8800 from code-dot-org/staging (Brent Van Minnen)
436eee6 Use branchname as S3 prefix for log (Brad Buchanan)
ce5fd7a Merge pull request #8797 from code-dot-org/pcardune-fix-netsim (Brent Van Minnen)
d48a4ad Use locals to refer to variables passed in (Paul Carduner)
1341eda Merge pull request #8756 from code-dot-org/react-progress-inline-styles (Josh Lory)
f28869e Load Piskel via nonfingerprinted path (Brad Buchanan)
6d6e7d0 Code review feedback [ci skip] (Josh Lory)
76ad952 Merge pull request #8796 from code-dot-org/levelbuilder (Josh Lory)
e53f5c2 Level builder changes (Continuous Integration)
5e53305 Add some more documentation (Paul Carduner)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants