Skip to content

Comments

Scales for Dummies#9

Open
Nicklye26 wants to merge 8 commits intorocketacademy:mainfrom
Nicklye26:main
Open

Scales for Dummies#9
Nicklye26 wants to merge 8 commits intorocketacademy:mainfrom
Nicklye26:main

Conversation

@Nicklye26
Copy link

No description provided.

"react-scripts": "5.0.1"
},
"scripts": {
"predeploy": "npm run build",

Choose a reason for hiding this comment

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

is this inserted by github pages? Seems a bit inefficient to me :D

function App() {
return (
<div className="App">
<HomePage id="Home" />

Choose a reason for hiding this comment

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

HomePage seems odd naming to me for a single-page application! Maybe something like Hero, Heading, or something along these lines would fit better, depending on what the section actually contains.

@@ -0,0 +1,21 @@
.about-container {

Choose a reason for hiding this comment

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

I'd just name this file about.css

Comment on lines +10 to +29
<button className="button-1">
<a href="#basics-section">
<img src={MenuIcon1} alt="" />
</a>
</button>
<button className="button-1">
<a href="#intervals-section">
<img src={MenuIcon2} alt="" />
</a>
</button>
<button className="button-1">
<a href="#major-scales-section">
<img src={MenuIcon3} alt="" />
</a>
</button>
<button className="button-1">
<a href="#circle-of-fifths-section">
<img src={MenuIcon4} alt="" />
</a>
</button>

Choose a reason for hiding this comment

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

This here seems quite repetitive. We could probably use an array of objects for this, and render this via a array.map!

Copy link

@Flashrob Flashrob Nov 4, 2022

Choose a reason for hiding this comment

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

Suggested change
<button className="button-1">
<a href="#basics-section">
<img src={MenuIcon1} alt="" />
</a>
</button>
<button className="button-1">
<a href="#intervals-section">
<img src={MenuIcon2} alt="" />
</a>
</button>
<button className="button-1">
<a href="#major-scales-section">
<img src={MenuIcon3} alt="" />
</a>
</button>
<button className="button-1">
<a href="#circle-of-fifths-section">
<img src={MenuIcon4} alt="" />
</a>
</button>
const buttons = [{ href: "#basics-section", icon: <MenuIcon1 /> }, .....]
{buttons.map((buttonItem) =>
<button className="button-1">
<a href={buttonItem.href}>
<img src={buttonItem.icon} alt="" />
</a>
</button>
)}

<>
<div className="container" id="homepage">
<div className="wrapper">
<div className="home-title-1">Welcome to</div>

Choose a reason for hiding this comment

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

Instead of using classes like home-title-1 I think we could be a bit more descriptive.
In this case I would do something like home__title and home__subtitle or similarly. Can check BEM convention for CSS for more guidance https://getbem.com/naming/

Choose a reason for hiding this comment

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

Oh right, and since these are headers, it would be better to use headings instead of a div. h1,h2,h3 etc.

<>
<div className="padding-container" id="intervals-section">
<div className="container-flex">
<div className="title">Intervals</div>

Choose a reason for hiding this comment

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

we shouldn't use divs for everything. Divs are more like sectional dividers. For content like such, a paragraph or heading would make more sense semantically.

<p>Half tone - H</p>
</div>
</div>
<div className="separation-line"></div>

Choose a reason for hiding this comment

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

Could use an hr tag and style it here, I think. Or maybe use borders on the previous or following elements to create a separation line.

</button>
</div>
<div className="flex-text">
<div>C D E F G A B C</div>

Choose a reason for hiding this comment

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

It would be great if you could create variables containing this data, and utilize a function like .map in order to dynamically generate the html for the whole file. Ideally we want to be as lazy as possible and try to avoid manual labour as much as possible. Try to use code to do these motivation-killing tasks for you.

</button>
</div>
<div className="flex-text">
<div>Bb C D Eb F G A Bb</div>

Choose a reason for hiding this comment

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

Yup this whole file could be generated dynamically almost.

</button>
</div>
<div className="flex-text">
<div>Bb C Db Eb F Gb Ab Bb</div>

Choose a reason for hiding this comment

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

Same as with major scales, use functions to generate the HTML. See it like this, we try to let our computers work for us, not the other way around. When you write repetitive code, ask yourself if you could create this code in an easier and dynamic way. If we don't strive for that, it would be like endlessly filling in excel tables by hand.

@@ -0,0 +1,33 @@
import "./App.css";

const Basics = () => {

Choose a reason for hiding this comment

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

components always capital letter, as well as the file name

import "./App.css";
import ScrollToTop from "./components/scrollToTop";

const CircleOfFifths = () => {

Choose a reason for hiding this comment

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

capital file name for components

@@ -0,0 +1,26 @@
import "./about-style.css";

const About = () => {

Choose a reason for hiding this comment

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

capital file name for components

import MenuIcon3 from "../assets/menu-icons-01.png";
import MenuIcon4 from "../assets/menu-icons-04.png";

const NavLinks = () => {

Choose a reason for hiding this comment

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

capital file name for components

@@ -0,0 +1,17 @@
import MenuIcon5 from "../assets/menu-icons-05.png";

const ScrollToTop = () => {

Choose a reason for hiding this comment

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

This sounds like a function, not like a component. I think we could rename this. If the first word in a name is an action, it is always a function usually. Plus the file name for components need to be capital letter

import "./App.css";
import NavLinks from "./components/nav-links";

const Welcome = () => {

Choose a reason for hiding this comment

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

capital file name for components

import About from "./components/about";
import Welcome from "./homepage-welcome";

const HomePage = () => {

Choose a reason for hiding this comment

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

capital file name for components

@@ -0,0 +1,30 @@
import "./App.css";

const Intervals = () => {

Choose a reason for hiding this comment

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

capital file name for components

import "./table-style.css";
import { Howl } from "howler";

const MajorScales = () => {

Choose a reason for hiding this comment

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

capital file name for components

import "./table-style.css";
import { Howl } from "howler";

const MinorScales = () => {

Choose a reason for hiding this comment

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

capital file name for components

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