Skip to content

Week 2 assignment submission#16

Open
sheyna wants to merge 7 commits into
modern-web-application-uw18:masterfrom
sheyna:master
Open

Week 2 assignment submission#16
sheyna wants to merge 7 commits into
modern-web-application-uw18:masterfrom
sheyna:master

Conversation

@sheyna

@sheyna sheyna commented May 7, 2018

Copy link
Copy Markdown

Week 1 HW Submission

Please fill out the information below in order to complete your assignment. Feel free to update this comment later if necessary.

  • Comfort rating on this assignment (1-5):

Probably 3. Mostly because it took so long. But I feel pretty comfortable about most things. I need to review testing, and I was unable to get the bookmark's state to change when clicked. But other than that I think I got it all done. Although I used object deconstructing in PromoBox.js when I don't think I really need to, but I couldn't figure out how to write it without that. My biggest obstacle was the size of the assignment and the fact that I had a later start on it.

This is hardly the cleanest CSS I've ever written, but I was a little thrown by the differences in how React treats CSS. I'll want to look into how to optimize it in the future. I'm thinking that React might not be the best tool for theme-ing (creating a site template the user can apply different themes to).

  • Completion rating on this assignment (complete/incomplete):

95%? I need a refresher on testing.

  • Github handles of code I've reviewed:

Watkins added 5 commits May 5, 2018 19:18
… done the css and the basic data rendering. I still need to figure out how to do if statemets in the response.
…rdingly. Added proptypes, and mocked out testing. Attempted to get the bookmark to click and unclick, but didn't get it to work.

@bhague1281 bhague1281 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent job. You seem to be pretty comfortable with the components + styling. I gave a couple comments that should help with testing.

As far as making components that are "themable", designers and developers usually have to make their own patterns. One way you could theme a component is to give each DOM element a class, but then allow the component to be assigned a custom class. E.g.

const MyComponent = (props) => {
  return <div className={props.themeName}>...</div>
}

Then, import the corresponding stylesheet and voila.


class bookmarkIcon extends Component {

// const bookmarkIcon = React.createClass({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For context, React.createClass has been removed completely from the main React library. There may be some examples out there still that use this method though.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks! This was from my attempts to get the the Bookmark state to change, and at the time that was the only example I could find.

Comment thread social-network/src/App.js
<h1>In case you missed it</h1>
<section className="promos">
{missedArticles.map((missedArticles, dex) => {
return <PromoBox key={dex} promoInfo={missedArticles} />;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dex -> idx?

const audioIcon = this.props.promoInfo.hasAudioAvailable;
const memberPreviewElem = this.props.promoInfo.memberPreview;
const backgroundMediaStyles = {
backgroundImage: 'url(' + image + ')',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice job implementing the background image styling 👍


describe('PromoBox component', () => {
it('should render', () => {
const component = ReactTestRenderer.create(<PromoBox />);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Passing the needed props to <PromoBox /> should get this test up and working.

Comment thread social-network/src/PromoBox/PromoBox.js Outdated
render() {
const {
title, description, image, link, author, postedDate, minutesToRead, hasAudioAvailable, memberPreview
} = this.props.promoInfo;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some of these variables are unused. You may want to remove the ones that aren't being used. For props like audioIcon, you can do something like this:

const { hasAudioAvailable } = this.props.promoInfo;

or

const { hasAudioAvailable } = this.props.promoInfo;
const audioIcon = hasAudioAvailable;

or

const { hasAudioAvailable: audioIcon } = this.props.promoInfo;

As far as the right way... it's just personal preference.

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.

2 participants