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

I love the dynamic stuff (but could be better signposted) #34

Open
jackbridger opened this issue Jul 19, 2019 · 0 comments
Open

I love the dynamic stuff (but could be better signposted) #34

jackbridger opened this issue Jul 19, 2019 · 0 comments

Comments

@jackbridger
Copy link

To reiterate it is so cool how you pull all of the line names dynamically and add the shadow class dynamically.

Some key lines:

const shadowedNames = [
  "hammersmith-city",
  "circle",
  "victoria",
  "waterloo-city"
];

function requiresShadow(lineID){
  return shadowedNames.includes(lineID);
}

let shadow = requiresShadow(line.id) ? "tube-line-shadow" : "";
li.classList.add("tube-line-li");

 li.innerHTML = `
    <span class="tube-line-name line-${line.id} ${shadow}">${line.name}</span>

I took a lot of inspiration from this thank you. It took me a while to understand though so maybe it could be a little clearer signposted? E.g. clearer name of 'shadow' or comments above the helper functions or some comments in the feature-tube request call as quite a lot going on. Or maybe more helper functions in there to shorten that call.

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

No branches or pull requests

1 participant