8000 Homework week2 by annagabain · Pull Request #5 · annagabain/JavaScript3 · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@annagabain
Copy link
Owner

No description provided.

Copy link
@mattiaslundberg mattiaslundberg left a comment

Choose a reason for hiding this comment

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

almost

I would like to see the comments fixed (most of them are still there from week 1)! For the actual task for this week, great job converting fetchJSON to promises!

margin-left: 2px;

display: grid;
grid-template-columns: 33.3333% 33.3333% 33.3333%;

Choose a reason for hiding this comment

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

It's probably better to use flex-sizing here: grid-template-columns: 1fr 1fr 1fr; (three columns with the same flex factor = the same width)

Copy link
Owner Author

Choose a reason for hiding this comment

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

fixed, thank you :)

box-shadow: 10px 5px 5px grey;
}
span {
display: row;

Choose a reason for hiding this comment

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

I don't think display: row; exists. You're probably looking for display: block;, but if you're doing that you should probably use a div instead of span

Choose a reason for hiding this comment

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

Or are you trying do make the span behave like a table, in that case it's display: table-row;

Copy link
Owner Author

Choose a reason for hiding this comment

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

I tried 'millions' of options looking for a way to display the contributions block in three columns having picture, name and number in separate rows. Gave it up for now since the focus is the js anyway :))

.then((contribData) => {
contribData.forEach(contributor => {
// createAndAppend('p', contribs, { text: 'hej'});
createAndAppend('img', contribs, { src: contributor.avatar_url, height: 40, class: 'picture' });

Choose a reason for hiding this comment

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

As in week 1 I'm not a fan of this html structure as it doesn't provide any clue how to group the items. See linked comment for more details.


box-shadow: 10px 5px 5px grey;
}
#forContributorsBlock {

Choose a reason for hiding this comment

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

I'm kind of following what you want to do here, but would prefer another solution (this one doesn't use semantic html and isn't easy to understand):

I'm assuming a html-strucuture like this:

<div class="container contributors">
  <h2>Contributors</h2>
  <ul class="forContributorsBlock">
    <li class="contributor">
      <a href="...">contributor name</a>
      <img src="..." />
      <span>5</span>
    </li>
  </ul>
</div>
.contributors {
 color: rgb(48, 0, 20);
 margin: ...;
 padding: ...;
 border: ...;
}

.forContributorsBlock {
 list-style: none;
}

Copy link
Owner Author

Choose a reason for hiding this comment

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

Oh, yes that would be awesome to achieve. I think I still need to practice more DOM manipulations to be able to complete this one :(

fetchJSON(url)
.then(repositoryData => {
const select = createAndAppend('select', root);
createAndAppend('option', select, { text: 'Click here to choose a Repository' });

Choose a reason for hiding this comment

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

I'm still missing:

  1. Data is loaded for the first repository when the app/page loads
  2. The repos are sorted by name

Copy link
Owner Author

Choose a reason for hiding this comment

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

Sorted by name, still thinking how to start the first repo onload

Choose a reason for hiding this comment

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

Sorting looks good! Let me know if you need any pointers for first repo onload.

Copy link
Owner Author

Choose a reason for hiding this comment

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

yes, please

Choose a reason for hiding this comment

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

What you need to do is basically the following:

  1. Move the function that you send in as a callback to the eventhandler on line 53 to a separate function
  2. Call this function in the event-handler on line 53
  3. Call this function when the page loads

Is it clearer how to proceed?

Copy link
@mattiaslundberg mattiaslundberg left a comment

Choose a reason for hiding this comment

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

Approved

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.

3 participants

0